HowToAddItemsStendhal: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Blacklads
Quest Reward: adding hint to item quest
imported>AntumDeluge
Add GFX: add asset warning
 
(11 intermediate revisions by 3 users not shown)
Line 3: Line 3:
You can add new item to game in a few very simple steps:
You can add new item to game in a few very simple steps:


== Preparation ==
=Edit items.xml=

Download stendhal-0.xx-src.tar.gz from the stendhal-website and unpack it. All ''items''.xml files are located in the /data/conf/items/ directory. They are arranged according to ''class'' (see below) such as shields, swords, keys, food, etc.
Setup a development environment as described in [[Stendhal on Eclipse]].

==Edit items.xml==
All ''items''.xml files are located in the /data/conf/items/ directory. They are arranged according to ''class'' (see below) such as shields, swords, keys, food, etc.
The file contains all the description of the items in game.
The file contains all the description of the items in game.
Lets start with how to do weapons, for example in swords.xml:
Lets start with how to do weapons, for example in swords.xml:
Line 100: Line 104:


= Add GFX=
= Add GFX=

{{AssetWarning}}


Now place the 32x32 sprite in the folder '''data/sprites/items/<class>/<subclass>.png'''
Now place the 32x32 sprite in the folder '''data/sprites/items/<class>/<subclass>.png'''
Line 144: Line 150:
</source>
</source>


= Add Grammar =
== Add Grammar ==
Item names should be short and enough to identify the item, but in spoken and written English there may be some extra words associated with saying the item. For example, Carmen should offer to sell ''100 bottles of potion'' not ''100 potion''. (Add npc text example here?)
Item names should be short and enough to identify the item, but in spoken and written English there may be some extra words associated with saying the item. For example, Carmen should offer to sell ''100 bottles of potion'' not ''100 potion''. (Add npc text example here?)


Line 169: Line 175:
{{TODO|The new structure needs documentation on the different options for register, registerEnd and registerPrefix.}}
{{TODO|The new structure needs documentation on the different options for register, registerEnd and registerPrefix.}}


= Add to game=
== Add to game==
==Dropped by creature==
===Dropped by creature===
You can have a creature drop your newly made item. This is done by editing that creature in its XML file, found in the file location [http://arianne.cvs.sourceforge.net/viewvc/arianne/data/conf/creatures?view=markup projects/stendhal/data/conf/creatures]. Every creature in the game is located in this folder, categorized by creature type. For example, rats can be found in the file [http://arianne.cvs.sourceforge.net/viewvc/arianne/data/conf/creatures/animal.xml?view=markup projects/stendhal/data/conf/creatures/animal.xml].
Creatures can drop items, see [[HowToAddCreaturesStendhal]].


==Add to map or grower==
===Add to map or grower===
You may wish to add items to a map (for player to pick up or harvest). You can either add to zone by creating a java file (good for one - off items like the poison and scroll of Haizen's table in his hut) or add using tiled which is more work initially but allows you to add to the objects layer in tiled again and again in future. (Good for iron ore to collect from the ground, herbs etc). This needs a whole tutorial on spawners (also knows as growers), please see [[HowToAddGrowers]].
You may wish to add items to a map (for player to pick up or harvest). You can either add to zone by creating a java file (good for one - off items like the poison and scroll of Haizen's table in his hut) or add using tiled which is more work initially but allows you to add to the objects layer in tiled again and again in future. (Good for iron ore to collect from the ground, herbs etc). This needs a whole tutorial on spawners (also knows as growers), please see [[HowToAddGrowers]].


==Sold by NPC==
===Sold by NPC===
If the NPC is not already created, you can [[Stendhal NPC Coding|code a new NPC]]. Then you will need to add a seller behaviour to your NPC, which should be covered separately. Until that is done, look at Seller examples such as Margaret in Semos Tavern in your source code. The file is [http://arianne.cvs.sourceforge.net/viewvc/arianne/stendhal/src/games/stendhal/server/maps/semos/tavern/BarMaidNPC.java?view=markup src/games/stendhal/server/maps/semos/tavern/BarMaidNPC.java]. If you have any problems with the NPC understanding the item name, you might like to check [[How to test NPC Parser]].
If the NPC is not already created, you can [[Stendhal NPC Coding|code a new NPC]]. Then you will need to add a seller behaviour to your NPC, which should be covered separately. Until that is done, look at Seller examples such as Margaret in Semos Tavern in your source code. The file is [http://arianne.cvs.sourceforge.net/viewvc/arianne/stendhal/src/games/stendhal/server/maps/semos/tavern/BarMaidNPC.java?view=markup src/games/stendhal/server/maps/semos/tavern/BarMaidNPC.java]. If you have any problems with the NPC understanding the item name, you might like to check [[How to test NPC Parser]].


==Produced by NPC==
===Produced by NPC===
If the NPC is not already created, you can [[Stendhal NPC Coding|code a new NPC]]. You will need to add a Producer behaviour to your NPC, which should be covered separately. Until that is done, look at Producer examples such as Arlindo in Ados Bakery in your source code. The file is [http://arianne.cvs.sourceforge.net/viewvc/arianne/stendhal/src/games/stendhal/server/maps/ados/bakery/BakerNPC.java?view=markup src/games/stendhal/server/maps/ados/bakery/BakerNPC.java]. If you have any problems with the NPC understanding the item name, you might like to check [[How to test NPC Parser]].
If the NPC is not already created, you can [[Stendhal NPC Coding|code a new NPC]]. You will need to add a Producer behaviour to your NPC, which should be covered separately. Until that is done, look at Producer examples such as Arlindo in Ados Bakery in your source code. The file is [http://arianne.cvs.sourceforge.net/viewvc/arianne/stendhal/src/games/stendhal/server/maps/ados/bakery/BakerNPC.java?view=markup src/games/stendhal/server/maps/ados/bakery/BakerNPC.java]. If you have any problems with the NPC understanding the item name, you might like to check [[How to test NPC Parser]].


==Item Quests and Quest Rewards==
===Item Quests and Quest Rewards===
Perhaps you will want your NPC to equip the player with an item as part of a quest, see [[HowToCreateQuests]]. You can also add your items to either the [[http://stendhalgame.org/wiki/StendhalQuest#Daily_Item_Quest|DailyItem quest]] or the [[http://stendhalgame.org/wiki/StendhalQuest#Kirdneh_Museum_needs_help.21|Weekly item quest]], related to the appearance in the world (e.g. rare item?).
Perhaps you will want your NPC to equip the player with an item as part of a quest, see [[HowToCreateQuests]]. You can also add your items to either the [[StendhalQuest#Daily_Item_Quest|Daily Item quest]] or the [[StendhalQuest#Kirdneh_Museum_needs_help.21|Weekly item quest]], which are related to the appearance around the world (e.g. rare item?).