HowToAddItemsStendhal: Difference between revisions

From Arianne
Jump to navigation Jump to search
imported>Herodot
No edit summary
imported>Herodot
No edit summary
(No difference)

Revision as of 09:03, 30 June 2006

You can add new item to game in a few very simple steps:

Edit items.xml

Download stendhal-0.51-src.tar.gz from the stendhal-website and unpack it. items.xml is located in the /data/conf/ directory. The file contains all the description of the items in game. For example.

	<item name="dagger">
		<type class="sword" subclass="dagger"/>
		<attributes>
			<atk value="8"/>
		</attributes>
		<weight value="0.2"/>
		<equipable>
			<slot name="lhand"/>
			<slot name="rhand"/>
			<slot name="bag"/>
		</equipable>
	</item>

It is important to understand how it works.

We must give a name to the item and it is done in the item tag. Then we specify the class and the subclass on the type tag. If you check the way sprites are structure at client you will realize that it is in a similar fashion to:

 sprites/
     items/
         class/
             subclass.png

This way we can reuse a single GFX for different items. For example: knife+1, old knife, elvish knife, ...

Inside the attributes tag you can specify the attributes the entity has:

  • ATK it is a value proportional to the damage the item can do.
  • DEF it is a value proportional to how much damage the item can block.

For Stackable items like food, money, drinks, arrows, we can use:

  • quantity

And for foods, drinks and potions we have

  • amount
  • regen
  • frecuency

Now the level and experience tags. The level is used by the balancer application and the players to measure a creature (because they don't know ATK, DEF or HP values ). The experience determine the reward the player will get by killing this creature.

Aditionally you need to specify where the item can be equipped:

  • rhand
  • lhand
  • armor
  • head
  • legs
  • feet

Add GFX

Now you need to find a nice sprite for your monster. Most RPGMaker 2000 sprites works for stendhal. But they are in 32x32 size. If you have to scale it either use scale2x or send us the original sprite and we will scale it.

Now place the sprite in the folder data/sprites/items/<class>/<subclass>.png

See also How to know graphics specifications for items

Edit GameObjects

Usually you need to register your item unless it really does nothing.

   register("item",null,Item.class);
   register("item","book",Book.class);
   register("item","food",StackableItem.class);
   register("item","drink",StackableItem.class);
   register("item","money",StackableItem.class);
   register("item","projectiles",StackableItem.class);


Add to game

You perhaps will want to add items at Quests or create them on Maps.



Back to stendhal main wiki page