All armor must include the following lines: inherit ARMOR; void setup() { } The line ARMOR; is the base for all armor. It gives you the ability to set descriptions, slots, etc. Without this your armor will not function properly. Most, if not all, of your armor code will go inside the {}s of the void setup() function. Make your code as clean as possible. Indent! (The 'I' command within ed does indentation).
The most basic armor file is like this: inherit ARMOR; void setup() { set_proper_name( "A mithril breastplate" ); set_id( "breastplate", "armor" ); set_adj( "mithril" ); set_long( "This is well-crafted armor.\n"); set_slots( ({ "torso" }) ); }
set_proper_name()
USAGE: set_proper_name(string str) This string is seen when a player looks at the armor or when he checks his inventory. _DO NOT_ use articles such as 'a', or 'the' when using this. /* I think this is no longer needed the combination of set_id/ || set_adj should set the primary id for the item. || -- zifnab */ set_proper_name("mithril breastplate");
set_id()
USAGE: set_id(primary id, secondary id, ...) This is what the players use to identify the piece of armor. It should be in all lower case. The set_id() should be the most logical name for the armor and include any noun that is in the description. Notice you can pass multiple ids to set_id(). The first one passed will be considered the "primary id". See also: add_id set_id("breastplate","armor");
set_adj()
USAGE: set_adj(primary adj, secondary adj,...) 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 all examples of an adjective and its noun (in this case the noun is "dog"). As with set_id(), set_adj() can take a list of adjectives. Again, the first one specified is the 'primary' adjective. This gets combined with the primary id to form the primary_name If your armor has an adjective in its set_proper_name(), you should include an set_adj(adjective); line to your code. This allows a player to type "wear mithril breastplate" and have the mud know what they are referring to. set_adj("mithril");
set_long()
; USAGE: set_long(long desc here); When a player looks at the armor, this is what he will see. This helps the player to visualize the armor, so don't be skimpy on the description (like this example is)! set_long("This is a well crafted piece of armor.");
set_slots()
USAGE: set_slots( array of slots) This allows you to define where the armor is worn. It should be in agreement with the description of the armor. This function can also hold multiple arguements. For example, let's say that you had some gloves that covered the hands and the arms. You would do: set_slots( ({ "hands", "arms" }); To find out what slots are available use the slots command from inside the mud.
Well, right now your armor is pretty boring and nothing special. To make the armor useful, one can use any or all of the following functions outlined in the next example.
inherit ARMOR; void setup() { set_proper_name( "A mithril breastplate" ); set_id( "breastplate", "armor" ); set_adj( "mithril" ); set_long( "The armor glistens dimly in the light. It is finely crafted "+ "from a fine mithril. Obviously this was the work of a master "+ "smith! Strong leather straps, crafted from dragon hide, would "+ "hold the armor firmly in place.\n"); set_slots( ({ "torso" }) ); set_material( "mithril" ); set_wear_message("Your skin tingles slightly as you strap on " "your mithril breastplate.\n"); set_remove_message("Your skin stops tingling when you remove " "your mithril breastplate.\n"); add_stat_bonus( "str", 3); add_stat_bonus( "all_spells", -2); add_resist_bonus( "physical", 3); set_creator("Pavilion"); set_armor_class(45); }
set_material()
USAGE: set_material(string) This function defines what your object is made of, currently on Islands of Myth this is purely for display uses only and can be any material you like --zif set_material("mithril");
set_wear_message()
USAGE: set_wear_message(string) This is the message the player will see when he wears the armor. This message should be in the form used by the Messages module Although it is not necessary as this example shows. set_wear_message("Your skin tingles as...");
set_remove_message()
USAGE: set_remove_message(string) This is the message the player will see when he removes the armor. This message should be in the form used by the Messages module Although it is not necessary as this example shows. set_remove_message("Your skin returns to normal...");
add_stat_bonus()
USAGE: add_stat_bonus(stat,amount) This function makes it so the armor gives stat bonuses to the player when he wears the armor. The stats include: str - strength con - constitution dex - dexterity wis - wisdom int - intelligence sta - stamina cha - charisma hp_regen - hit point regeneration sp_regen - spell point regeneration ep_regen - endurance point regeneration all_skills - all of the player's skills all_spells - all of the player's spells The first arguement is the stat that is being raised. The second arguement is the amount you want to raise the stat by. The mud ignores negative numbers. We now have an automated 'stat checker' for armor and weapons. When an item is cloned its stats are checked against a table of valid values. If it is illegal a warning is put on the wizinfo channel. We also have a check in place to see if the item is too good for the monster that is holding it. This will also produce a warning message on the wizinfo channel. From inside the mud type 'help eqstats' to see the help file showing the table of valid values. add_stat_bonus("str",3);
add_resist_bonus()
This function makes it so when a player wears the armor he gets added protection from a defined damage type (the first arguement). The second arguement is the amount, in %, that the resistance is increased by. There are the following damage types in Islands of Myth: - physical - cold - electric - psionic - fire - holy - poison - acid - unholy - asphyxiation - magical A helpful command is 'deeplook' to get an idea on the values assigned to your armor. We now have an automated 'stat checker' for armor and weapons. When an item is cloned its stats are checked against a table of valid values. If it is illegal a warning is put on the wizinfo channel. We also have a check in place to see if the item is too good for the monster that is holding it. This will also produce a warning message on the wizinfo channel. From inside the mud type 'help eqstats' to see the help file showing the table of valid values. add_resist_bonus("physical",3);
set_creator()
USAGE: set_creator(name) This function, used in combination with the "creator" command, tells the player who created this piece of armor. set_creator("pavilion")
set_armor_class()
USAGE: set_armor_class(number) This function is used to set the armor's armor class. This is a measure of how good the item protects. Keep in mind the limits set on equipment from the 'help eqstats' document. set_armor_class(45);
set_public_wear_message
USAGE: set_public_wear_message(string) This function allows you to set a message that will be seen by everyone in the room when a player wears this armor. Like set_wear_message (which only shows to the player) this can take a string in the form provided by the messages module. set_public_wear_message("$N $vslip on $p mithril breastplate\n");
set_identify_message()
USAGE: set_identify_message(string) The spell identify gives the players information on equipment. However, the spell is not all inclusive, and there might be special information that you want to include. This function lets you include a message in the identify spell. set_identify_message("This armor increases the wearer's chance "+ "to escape death.");
add_skill_bonus(), add_spell_bonus()
USAGE: add_skill_bonus(skill, amount) If you would like your armor to increase a player's % in one specific skill or spell , you can use this function. The first arguement is the name of the skill or spell and the second arguement is the % bonus. In this case a player with quick chant trained to 60% would have it at 70% when wearing this armor. The player must have the skill trained in order to gain the bonus. We now have an automated 'stat checker' for armor and weapons. When an item is cloned its stats are checked against a table of valid values. If it is illegal a warning is put on the wizinfo channel. We also have a check in place to see if the item is too good for the monster that is holding it. This will also produce a warning message on the wizinfo channel. From inside the mud type 'help eqstats' to see the help file showing the table of valid values. add_skill_bonus("quick chant",10)
add_ability_bonus()
USAGE: add_ability_bonus(string) This function gives the coder a way to add racial abilities to the the player. These abilities are not always good things, and can be an interesting way to add "negatives" to your eq. Available abilities are as follows: 1) infravision - Ability to see in the dark. 2) eats corpses - Ability to eat corpses. 3) regens only in dark - Requires dark to regenerate. 4) regens only in light - Requires light to regenerate. 5) escape death - Player has a chance of escaping death when he normally would die. add_ability_bonus("infravision");
set_light()
USAGE: set_light(number) This function makes it so that the armor actually emits light, light that will effect everyone in the room. Positive numbers give light while negative numbers make the object absorb light. set_light(1);
Sometimes you are going to want your armor to have a special defense ability. The follow is just an example and the possible combinations are endless. If you can imagine it, odds are it is possible. The return value of this function is the PERCENT of damage that will be protected by the special. So if you return 0, no protection is provided, if you return 100, no damage is taken. Be careful with the figures, it can become very powerful. Wizards should advise an arch or admin when adding such functions to an armor.Thee following code should be located outside the void setup() {}
int special_defense( int damage, string type, object me, object hitter ) { if (random(50)) return; me->simple_action( "$N $vreflect the hit, blocking some of " "the damage!\n"); return random(50); }
Basically each time the player gets hit, the armor has a 98% chance of having no effect. However, 2% of the time, the damage will be decreased by a random percentage varying from 0 to 50.
For very rare pieces of armor, it is possible to have the piece of armor actually add to the offensive power of the player. This should only be done rarely.The following code should be located outside the void setup() {}
void special_attack(object target) { object attacker = query_worn_by(); if (random(6)) return; attacker->combat_targetted_action("$P piece of armor flares with a bright " "light, hurting $t with magical energy!\n", target); target->hit_me(100 + random(100), "magical", attacker); }
This function is called every round, once per round. So the first random says that in average the special occurs one round out of 6. The combat_targetted_action is a special messenging function that will not be displayed to people that have silent combat on. The armor will hit the player for an extra 100 + (0-99) of magical damage