In this part, you will find every detail on how to code XML to create monsters for Realm of the Mad God.
We will dive straight into the topic with our first example, the Test Chicken, and explain each of the fields one by one.
The Test Chicken Example
<Object type="0x023b" id="Test Chicken">
<Behavior numShots="3" projectileId="0"cooldown="0.6">Shoot</Behavior>
<Behavior projectileId="1" cooldown="10.0">Shoot</Behavior>
<Behavior type="Flash" color="FF0000">ShowEffect</Behavior>
<Behavior range="0.0" projectileId="0">Explode</Behavior>
Here is what each field means:
<Object type="0x023b" id="Test Chicken">
This creates the concept of an object. The “type” and “id” fields must be unique. For testing purposes, use the 0x7FXX space for types and use whatever ids you want.
Specifies the group this object belongs to. This is used by some behaviors.
This specifies that the object can take damage from players.
This is used internally.
This specifies the texture file to use. This refers to a spritesheet embedded in the SWF. The index can be either hexadecimal or decimal and determines where in the sheet the sprite is (counts starting at 0).
Counting in hex: 0 1 2 3 4 5 6 7 8 9 a b c d e f
For <Texture> it is recommended to use hexadecimals, as object sheets are arranged to have 16 items per row. Meaning 0x10 would point to the first item of the second row, 0x0f would point to the last item of the first row.
When using animated sprite sheets, <AnimatedTexture> needs to be used instead of <Texture> to prevent client errors.
For <AnimatedTexture> it is recommended to use decimals as it is easier to count and the index will only determine the row used.
Specifies the hit/death sounds for the monster. These tags can be left out and it will use the default sounds. See list at end for all available sounds.
Specifies the hit points of the monster.
Specifies a type of projectile that monster can shoot. The “id” must be a number less than 256. The following are included inside Projectile tag.
Specifies the appearance of the projectile.
Specifies the speed of the projectile.
Specifies the hitpoints lost by the player if hit by the projectile.
This specifies how long the projectile lasts in milliseconds.
This specifies the condition effect that the player will get if hit by the projectile.
A list of all condition effects can be found at the end of this document.
Other tags that can be included in the Projectile tag:
This projectile will do a random amount of damage between the two values.
This projectile will not stop when it hits a player; it can hit every player at most once.
This projectile will not stop when it hits a tree, rock, etc. It will stop when it hits a wall.
This projectile will ignore the player or enemy's defense when calculating damage done.
These give the projectile non-straight trajectories. Don’t include more than one.
These modify the trajectory of the bullet to make it follow a wave path. This is compatible with the default and Boomerang projectiles. By default, Amplitude is 0 and Frequency is 1. Frequency is in units of cycles per lifetime.
This specifies the size of the object as a percentage. The value 100 means that one pixel in the bitmap maps to 5 on the screen so multiples of 20 render well (but it is not required). Examples: player characters are rendered at 100, items at 80 and starter pets at 60.
This specifies how much damage from player projectiles is absorbed.
The amount of xp the player gets from killing a creature is determined by its hitpoints. This modifies that amount by multiplying it by the factor stated.
States, behaviors, transitions and orders will be described below. Before that, here are some other tags that can be in the Object tag. Enemies that you want to have live in the Realm, need a few extra tags:
This determines where the creature lives and is used to keep the correct counts of monsters in each terrain.
This determines the probability of this monster spawning in the Realm. It defaults to 0 (i.e. does not spawn in the Realm). A probability of 1.0 means that it will be considered for spawning every time a creature is needed in this creature’s terrain, 0.5 means it will be considered half of the time.
This tag determines the number of these enemies that will appear when it is spawned. The default is a single enemy but you can use the Spawn tag to create a group. It uses a Normal distribution with mean, standard deviation, min and max specified.
This creature can not be stasis-ed.
This creature counts as a “god” for the purposes of counting God kills.
This creature counts as a “cube” for the purposes of counting Cube kills.
This creature counts as “Oryx” for the purposes of counting Oryx kills.
Sometimes it is useful to use a non-unique for an object. This overrides the objects “id” for the purpose of displaying the text to the player.
This will cause an object to be drawn 0.3 squares above the ground. This is useful for making objects look like they are flying.
This will specify an alternative texture that can be used by the creature at certain times. The id must be an integer greater than 0. See the “SetAltTexture” behavior for how to use this.
For more simple animation cycles that work on static objects as well, use the “Animation” tag. An example is below:
<Animation prob="1.0" period="10.0">
<Animation prob="0.2" period="2.0" periodJitter="1.0">
An object with these tags has two animations. The first plays every ten seconds (period=”10.0”) every time (prob=”1.0”). This first animation has single frame that lasts for half a second (time=”0.5”).
The second animation happens between every 1.0 and 3.0 seconds (period="2.0" periodJitter="1.0") with a 20% chance (prob="0.2"). It has two frames that each last half a second and are played sequentially.
In animations, the “<Texture>” can be a RemoteTexture, RandomTexture, etc.
<Animation sync="true" period="10.0">
This is a “sync” animation which means it will be synchoronized with any other animations that have the same period. In this case, “periodJitter” is ignored and “prob” will be calculated independently for each object.
Also, instead of an <Object … > tag, you can include separate URLs thus:
This will have the server download and parse the contents of the named URL.
These tags allow you to modify the size and color of the object’s shadow.