Contents
- Introduction to Monsters
- How do I make a monster?
- Fleshing out your monster
- Additional Functions
- Special Attack
Introduction to Monsters
All monsters must include the following lines:
inherit MONSTER;
void setup() {
}
The line inherit MONSTER; is the base for all monsters. This gives your monster
abilities like descriptions, combat etc. Without this your monster will not load.
Just about all of your monster code will go inside the {}'s in setup.
Make your monster code (and all code for that matter) as clean as
possible. Indent! ( The 'I' command within ed does indentation.)
How do I make a monster?
The most basic monster is like this:
inherit MONSTER;
void_setup() {
set_in_room_desc( "A monster");
set_name( "The monster" );
set_id("monster");
set_long("This is a really ugly monster!");
setup_monster("humanoid", 2, "fighter");
}
set_in_room_desc()
USAGE: set_in_room_desc(string str)
This is what players see when they walk into a room. It is up to
you if you use articals (like "a" and "the"). Usually the first
word is capitalized.
set_name()
USAGE: set_name(string str)
This string of words is seen at various times such as when the
monster emotes something. You will need to play with the articals
and capitalization to decide what you like best.
set_name( "The monster" );
set_id()
USAGE: set_id(string array str...)
set_id( "monster","it","other id","another id" );
This is what the players use to identify the monster.
This is also what the game uses to identify the monster
in some cases.
It should be in all lower case.
The id's you set up should be logical and be comprised of anything
the players will try to type to identify the monster.
I see this happen to much in the mud:
Player types look in the mud, see 'a rock lies here'.
The player then types la rock, and the mud doesn't know what the player
is trying to look at because the wizard set the in room desc to 'rock'
and the id's to 'stone'.
The point is to be careful with your id's, we don't want the players to
have to guess at what the items are.
Another very important note with respect to set_id, and set_adj
The _first_ argument passed to set_id will become the 'primary id'. Combined with the
'primary adj' they compose the 'primary name' of the item. This is the name that you
typically see used in the mud.
set_long()
USAGE: set_long(string str)
When a player looks at a monster, this is part of what he will
see. This helps the player picture the monster, so don't be
skimpy on the description (like this example is!).
set_long("this is a monster");
setup_monster()
USAGE: setup_monster(string type, int level, string guild)
This is the meat of the monster. The first variable in this
function defines what type of monster you have. To see the
possible monster types from inside the mud type 'monsters'.
Pick whichever arguement best fits your monster. If none seem to
fit, select "other". Keep in mind that monsters of the same level
will still vary slightly based on there race. For example, a
level 20 dragon will be harder to fight than a level 20 humanoid,
and will also give more experience.
The second variable is the monster's level. On Islands of Myth,
the monsters can vary from level 1 on up to level 50. You might
need to play with your monster's level to get it where you want
it.
The following commands should help you when you are
trying to determine what level to make your monster:
1) mhits - Gives you a list of the hitpoints for
that type for each monster level.
2) mworth - Gives you a list of the monster's exp
worth for that type of monster at each level.
3) deeplook - After coding your monster, clone it then use
this command to get some of the specifics on your monster.
The third variable is the basic guild of your monster.
This will control the default spells and skills used by your
monster. If you do not include this variable, the game will
pick any spells and skills (which is just fine for some types
of monsters). the other options are: "fighter", "caster",
and "none." With "none" your monster will not do any
any spells or skills (good for animals or if you are adding
custom spells and skills).
"Fleshing out" your Monster
Well, your monster is pretty boring. Lets make a more exciting monster and
add some new functions to him. The following functions should be used
in most monsters.
inherit MONSTER;
void setup() {
set_in_room_desc( "Dudly, the big and ugly orc" );
set_name("Dudly");
set_id("dudly");
add_id("orc");
set_adj("big");
add_adj("ugly");
set_long("You look up and Dudly...and up and up and up! You have never "
"seen such a massive monster! His legs are as thick as tree trunks "
"and his arms are thick enough to crush an iron rod! He is not a "
"good looking fellow, however. His lower jaw juts out to show a row of "
"long, yellow teeth. You doubt that mouth can be used for normal speech. "
"His pig-eyes are too close together and you doubt there is much "
"thought behind them.");
set_alignment(-200);
set_gender(1);
setup_monster( "humanoid", 2); /*note: no defined guild*/
}
add_id()
USAGE: add_id(string str)
This adds an id to your monster. This does not affect the
primary id. So if you do the following:
set_id("foo","foo2");
add_id("foo3");
Your monster still has a primary id of foo.
Note that if you want you can do this all through set_id().
Just remember that the first ID listed is the 'primary ID.
set_adj()
USAGE: set_adj(string array str...)
English 101 - Adjectives are any word that describes a noun. Ugly
dog, fat dog, young dog, pretty dog, innocent dog, lustful dog,
crazy dog, etc. are examples of an adjective and its noun
(in this case, "dog").
As with set_id(), set_adj() can take a list of adj's. Again the
first one specified is the 'primary' adjective. This gets combined
with the primary id to form the primary name.
If your monster has an adjective in its set_in_room_desc(), you
should include an add_adj(""); line to your code. This
allows a player to walk into the room and type "kill big orc".
Players may use any combination of adjectives and IDs to
identify your monster.
set_adj("big","ugly","fat");
add_adj()
USAGE: add_adj(string array str...)
Just like with IDs, if your monster has more than one adjective, you
should include all of the adjectives by using this function. You can
use it as many times as you would like. If you prefer you can pass
them all through set_adj() keeping in mind the first is the
primary adj.
add_adj() has no affect on the primary adj.
add_adj("ugly");
set_alignment()
USAGE: set_alignment(int i)
This defines how good or evil your monster is. Alignment
range from -1000 to 1000. Negative numbers are more evil while
positive numbers are more saintly. The two extremes (-1000 and
1000) should be used rarely and probably only for quest or
eq monsters.
Note in many examples and many monsters in the game you will see
2 numbers passed to set_alignment(). Please ignore those, the
second number was removed as it was just to confusing and really
served no purpose, and all the monsters havent been fixed.
set_gender()
USAGE: set_gender(int i)
This makes it so the player does not have to look under the
monster's tail to see if it is a boy or a girl. The possible
arguments are as follows:
0 - genderless
1 - male
2 - female
Additional Functions
add_a_weapon()
USAGE: add_a_weapon(string str, int wield)
add_a_weapon("path",1)
This function adds a weapon to the monster. The first
arguement is the file name. The second arguement defines
if the monster should be wielding the weapon or not, 1 means the
monster should be wielding it and 0 means the monster should only
have the weapon in his inventory.
add_a_armor()
USAGE: add_a_armor(string str, int wield)
add_a_armor("/wiz/hysteria/armors/chainmail.c", 1);
This is the same thing as add_a_weapon() but it is specific
for worn armor. Again, the first arguement is the complete file
name. The second defines if the monster should be wearing the
armor or not. 1 is worn and 0 is not worn.
add_a_object()
USAGE: add_a_object(string str, int wield)
add_a_object("/wiz/hysteria/objects/rose.c");
This allows you to place an object besides armor or
weapons in the monster's inventory.
set_str_modifier
USAGE: set_str_modifier(int i);
This function allows you to alter the combat strength
of your monster. You can increase the combat strength by
using positive numbers or decreased by using negitive numbers.
Notice: This should be used very rarely and if you use it,
please make sure your area reviewer is aware that you used it.
set_limbs()
USAGE: not sure if this is used anymore
This function increases the number of arms a monster
has. This will increase the number of weapons he can wield and
the number of times he hits. This is already defined in the
monster's race but can be overloaded using this function.
set_no_disarm()
USAGE: set_no_disarm(int percent)
set_no_disarm(50);
The players have a skill called "disarm" which will
strip the monster of his weapon. This function can be added
to monsters to decrease the chances of that skill working.
The higher the number, the more likely the player's skill will
fail. The maximum number is 100.
set_kill_min_level_limit()
USAGE: set_kill_min_level_limit(int i)
set_kill_min_level_limit(30);
If you don't want newbies dying to your monster, you can
set the level a player must be before he can kill the monster.
In this example, a level 29 player would not be able to kill
this monster, but a level 31 would be able to.
set_kill_max_level_limit()
USAGE: set_kill_max_level_limit(int i)
set_kill_max_level_limit(20);
If you don't want highbies mowing over your newbie
monsters, you make your monster unkillable by highbies by
using this function. In this example, players over level 20
would not be able to kill this monster.
set_kill_min_level_limit_msg()
USAGE: set_kill_min_level_limit_msg(string str)
set_kill_min_level_limit_msg("You are too small to attack the orc!\n");
This message will be sent to the newbie when he tries
to kill your monster if his level is under the monster's min
level limit.
set_kill_max_level_limit_msg()
USAGE: set_kill_max_level_limit_msg(string str)
set_kill_max_level_limit_msg("You are too small to attack the orc!\n");
This message will be sent to anyone that is too high of a level to
kill your monster.
add_resitance
USAGE: add_resitance(string type, int amount)
add_resistance( "magical", 30);
This will add 30% more magical resistance onto what the
monster has already.
add_spell()
USAGE: add_spell(string str, int chance_to_cast, int chance_of_success,string target )
add_spell("fireball", 50, 90);
This function lets you add a spell to your monster. The
first variable is the name of the spell. It should be in all
lower case.
The second variable is the % chance that at any point
a monster will start casting the spell. If you set it at
100, then every available time, the monster will try casting
this spell.
The third variable is the % of success. In this case,
The monster would have a 90% chance of succeeding each time
he casts this spell.
There is a fourth variable. It is the target. By not
defining it, like in this example, we are going to the default
target which is the target the monster is killing. The other
possibilities are:
"none"
"random" - The monster randomly picks any player in its
environment.
Example: add_spell("fireball", 30, 95, "random");
Notice: If your spell is a heal spell or any other type of spell
that is cast on the monster itself, then the target has to
be set as "none".
add_skill()
USAGE: add_skill(string str, int chance_to_cast, int chance_of_success,string target )
add_skill("punch", 30, 85);
This acts the exact same way as
track()
USAGE: track(int percent)
track(40);
All monsters have the ability to follow a player out of
the room. If you want to increase this ability, you can use
this function. In this example, the monster would have a 40%
chance of tracking the player when the player flees the room.
If you don't want your monster leaving the room, you
must add: track(0); to the monster file in the setup()
add_block
USAGE: add_block(string exit)
add_block( "north" );
This line makes it so a monster will not allow a
player to leave the room through a certain exit, forcing the
player to kill the monster before he can go through the exit.
*** You must inherit M_BLOCKEXITS as well as MONSTER; for this to work.
set_block_action
USAGE: set_block_action(mixed stuff)
set_block_action(
"The orc grunts and won't let you pass.\n");
This is used when your monster is blocking an exit. The
player will get this message when he attempts to go through
an exit that is blocked by that monster.
You can also do other nasty stuff to the players as well,
rather than displaying a message you can
do set_block_action( (: my_function :) ) and have my_function do
whatever you want as long as it returns 1 to block, 0 to let the
player through.
*** You must inherit M_BLOCKEXITS as well as MONSTER; for this to work.
set_aggressive
USAGE: set_aggressive(mixed foo)
set_aggressive(90);
This line will make your monster aggressive to a player
when he enters the room. The number represents the %
chance that the monster will try to attack the player when
he enters the room.
You can also use a function pointer to allow the monster to
either do nasty things to the player, or perhaps he is aggressive
based on race, or worth etc.
%^BOLD%^%^RED%^NOTICE:%^RESET%^ You must inherit M_AGGRESSIVE; for this to work!
set_aggressive
USAGE: set_aggressive(mixed foo)
set_aggressive(90);
set_creator
USAGE: set_creator(string who)
set_creator("zifnab")
This sets the creator (you) so when a player types "creator
orc" the game will know how to answer. This helps the players
know who to praise or report bugs to.
set_monster_damage
USAGE: set_monster_damage(mapping damages)
set_monster_damage( ([ "physical": 50, "fire" : 20, "cold" : 30]) );
This function alters the partitioning of damage types
made by a monster in unarmed combat. Usually monsters
always do physical, however this allows the coder to set
other damage types. Notice, the damage type must be a valid
damage type (see the damage types listed under resistances)
and the total of the coefficients (in this case, 50 + 20 + 30)
must equal 100.
Special Attack
Sometimes you want your monster to have a special attack. The following
is just an example. However, pretty much anything within the realm of
reasonability is possible.
Specials can be targetted to any player or just the tank
(it defaults to the tank). They don't have to deal damage.
They can heal the mosnter, for example. Anything is possible
and they help to individualize your monster.
This code should be written outside the setup()
int special_attack(object target) {
if(environment(target) != environment(this_object())) return;
**** The above checks to make sure the target is in the same
**** room as the monster. Otherwise, the special will bug if
**** the player leaves the room.
if(90 < random(100)) {
this_object()->targetted_action("The orc lifts his heavy arm and bashes $t!\n");
**** The above is the message your special will give to the
**** targets in the room.
return 200 + random(100);
/* return the damage to be done */
}
return 0;
}