HowToAddItemsStendhal: Difference between revisions

Content deleted Content added
imported>Teiv
imported>Kymara
correct the registering of items, the file is not called GameObjects any more.
Line 105:
If you want your item image animated (like money) simply make a 32N x 32 sprite. E.g. if it has 5 frames in the animation it will be a 160 x 32 sprite. It will automatically appear animated.
 
= EditRegister GameObjectsthe class =
Usually you need to register your item class unless it really does nothing. If you're adding an item which is like what we already have (i.e. justajust a new shield) it's done for you, the shield class is registered. <!--ToAdd do:your whereitem doesto thisthe gorest now-->in ''src/games/stendhal/client/entity/EntityMap.java''
 
register("item",null,Item.class);
Line 119:
Creatures can drop items, see [[HowToAddCreaturesStendhal]]. Perhaps you will want your NPC to equip the player with an item as part of a quest, see [[HowToCreateQuests]] or an NPC to sell the item. For the latter you will need to understand NPC seller behaviour which should be covered separately. Until that is done, look at Seller examples such as Margaret in Semos Tavern in your source code.
 
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]] - so watch this space!.