From The Mana World
Revision as of 10:49, 17 October 2008 by Kess (talk | contribs) (→‎NPC section suggestion: Now a suggestion on the whole Map objects section)

Irving Rivas, 31/7/07:

Perhaps we should regulate comments?

EOF newline

I’d like to propose that all script files should have a mandatory newline at the end of file, to ease working with shell scripts on these files. —kess 14:01, 14 October 2008 (CEST)

Suggestion: Map objects

Key
<TAB> a tab
text static text, do not change
text obligatory value, change this
text optional value, may be skipped

These sections describe how to define map objects.

Warps

Warps are what move players between maps. They can also be used to move players around a single map, if needed. Warps are defined like this:

map1,startX,startY<TAB>warp<TAB>name<TAB>width,height,map2,endX,endY

Where

  • map1 is the map which the player will warp from
  • startX is the x-coordinate of the tile the player will warp from
  • startY is the y-coordinate of the tile the player will warp from
  • name is the name of the warp, unused but must be defined
  • width is the width of the warp
  • height is the height of the warp
  • map2 is the map which the player will warp to
  • endX is the x-coordinate of the tile the player will end up on
  • endY is the y-coordinate of the tile the player will end up on

Width and height are described in detail in Warp Details.

// Warp example (npc/new_10-1-xmas/passages.txt)

new_10-1.gat,69,19	warp	tovillage	4,1,new_11-1.gat,69,127

Monsters

Monsters are defined like this:

map,x,y,width,height<TAB>monster<TAB>name<TAB>mobID,count,spawn1,spawn2,event

Where

  • map is the map the monsters should appear on
  • x is the x-coordinate of the spawn tile
  • y is the y-coordinate of the spawn tile
  • width is the tile width of the spawn area
  • height is the tile height of the spawn area
  • name is the name of the mob, unused but must be defined
  • mobID is the mob identifier of the desired monster (in the monster database [1])
  • count is the number to spawn
  • spawn1 is the minimum delay between successive spawns (per individual)
  • spawn2 is the minimum delay between death and respawn (per individual)
  • event is the script event to fire upon death

A detailed description of position and area can be found in Mob Details.

// Monster example (npc/new_9-1-woodland/monsters.txt)

new_9-1.gat,0,0,0,0	monster	EvilMushroom	1013,25,0,0,0
new_9-1.gat,0,0,0,0	monster	SleepFlower	1014,40,0,0,0
new_9-1.gat,0,0,0,0	monster	Alzarin	1032,1,2700000,1800000,0

NPCs

NPCs are defined like

map,x,y,direction<TAB>script<TAB>name<TAB>npcID,area1,area2,{

script

}

Where

  • map is the map the NPC is located in
  • x is the x-coordinate of the NPC
  • y is the y-coordinate of the NPC
  • direction is the direction the NPC faces, unused but must be defined
  • name is the name of the NPC, to hide (the latter part of) a name to the client begin (that part of) the name with a hash (#)
  • npcID is the NPC identifier (in the NPC database [2])
  • area1 and area2 describe the map area which activates the NPC, optional
  • script is the NPC script, see the below

The name of the NPC can be hidden to the player, part of the name or the whole. Begin the name with a hash (#) to hide the whole name, or add it before the part which should be truncated (it will be truncated to the end).

// NPC example with activation area (npc/new_37-1-woodland-mine/miners.txt)

new_37-1.gat,78,59,0	script	Miner	109,1,1,{
	mes "[Miner]";
	mes "\"I'm sorry, but this area is closed off.\"";
}

Shops

Shops are defined like

map,x,y,direction<TAB>shop<TAB>name<TAB>npcID,inventory

Where

  • map is the map the shop is located in
  • x is the x-coordinate of the shop
  • y is the y-coordinate of the shop
  • direction is the direction the shop faces, unused but must be defined
  • name is the name of the shop, to hide (the latter part of) a name to the client begin (that part of) the name with a hash (#)
  • npcID is the NPC identifier for the shop
  • inventory is a comma separated inventory list of items to sale

The inventory is defined like

itemID:price[,itemID:price]*

Where [...]* means that part can be repeated as necessary, and

  • itemID is the item identifier (in the item database [3])
  • price is the price the item is sold for

You add an item:price pair for any item that should be sold by the shop.

// Shop example (npc/new_23-1-dimonds-cove/dimonds.txt)

new_23-1.gat,24,27,0	shop	Bartender	107,539:175,567:500,568:500

Comments

I’m learning a little about the eAthena scripting, so I’m putting it here for now. If anyone has a suggestion on how to write the syntax, please tell. I’d personally prefer something unambivalent and terse, but as this page is about being easily understood that’s perhaps not the perfect choice. I’ll continue to add here as I learn more. ✎ Kess☽ 12:49, 17 October 2008 (CEST)