HowToAddCreaturesStendhal

From Arianne
Revision as of 09:03, 29 October 2007 by imported>Neoneurone
Jump to navigation Jump to search

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

Edit creature.xml

This file contains all the description of the creatures in game. For example.

<creature name="deer">
	<type class="animal" subclass="deer" tileid="36"/>
	<attributes>
		<atk value="5"/>
		<def value="5"/>
		<hp value="20"/>
		<speed value="1"/>
		<size value="1,2"/>
	</attributes>
	<level value="0"/>
	<experience value="0"/>
	<drops>
		<item value="meat" quantity="[1,4]" probability="80"/>
		<item value="ham" quantity="[1,2]" probability="40"/>
	</drops>
	<equips>
                <slot name="rhand" item="leather_skin"/>
	</equips>
	<ai>
		<profile name="animal"/>
		<profile name="non_ofensive"/>
		<profile name="coward"/>
	</ai>
</creature>

It is important to understand how it works.

We must give a name to the creature and it is done in the creature 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/
     monsters/
         class/
             subclass.png


The next attribute inside type tag is tileid that points to the position (starting from 1) of this monster sprite in the zelda_objects.png file.

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

  • ATK it is a value proportional to the damage the creature can do.
  • DEF it is a value proportional to how much damage the creature can block.
  • HP is the health measure
  • Speed it is how fast creature moves. Range from 0 to 1.
  • Size it is the size of the creature in tiles: usually 1x2

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.

Now the drops tag specify what the creature drops when it is killed. Each of the item has a probability of being dropped (probability attribute) and the quantity of it that may be dropped (quantity attribute)

Aditionally you can equip items at a creature slots:

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

It is a good idea not to equip creatures ( because they take more memory ) if it is possible.

AI is useless right now dont worry about it, just copy and paste the data.

Add GFX

Now you need to find a nice sprite for your monster. Most RPGMaker 2000 sprites works for stendhal. But they are in 24x32 size. We need to scale it using scale2x to get the best quality possible to 48x64. Either use scale2x or send us the original sprite and we will scale it.

Once you have scale2x, the command to type is scalex -k 2 old.png new.png

If the images have a coloured background like those from Charas, it needs to be made transparent. See below for how to do that in GIMP or use this Visual Guide.

  • Open your png
  • Convert it to RGB mode with Image -> Mode -> RGB
  • Add transparency to the image with Layer->Transparency->Add Alpha Channel
  • Select the coloured background (green from Charas) by doing Tools->Selection Tools->Fuzzy Select (or pressing Z), and clicking on the green background. Make sure that the 'threshold' is set to 0 which means it will only select exactly that green colour. Also turn of 'Antialiasing' and 'Feather edges'. These settings should be available on the gimp main window.
  • Remove the green background by pressing Ctrl-k (or Edit->Clear). Gimp should show the transparency as gray checker board pattern.
  • Repeat the selection and clearing steps for any remaining green areas, if everything was not cleared at once.
  • Save your changes

You can change the background to clear before you change the scale or send it to someone to change it. The order doesn't matter.

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

See also How to know graphics specifications for creatures

Edit GameObjects

Just in case your sprite is not an standard size (48x64) you will need to use a different Creature class.

   register("creature","small_animal",SmallCreature.class);
   register("creature","giant_animal",BigCreature.class);
   register("creature",null,NormalCreature.class);


Add to game

Open tiled/zelda_objects.png with your favourite GFX editor ( The GIMP ) and simply add a reduced version of your monsters to next free position, make sure you add that position to tileid attribute inside creatures.xml

You are done with it. Now let's play.

Balance a creature

If you have played against it you will have seen that the creature is either too weak or too strong for its level. So you can run games.stendhal.tools.BalanceRPGame <creature name> and it will give you correct ATK, DEF, HP, XP for the level you placed. It is important to choose a good initial values so that it works.



Back to stendhal main wiki page