Functions which must be called to set values:
From the standard object (read /doc/build/building for details):
set("id", string *names); set_name(string name); set("short", "short desc");
set("long", string long_dec); set_weight(int weight); set("value", int val);
Things which must be set which are specific to weapons:
set_ac(int ac);
Example: set_ac(2);
This will give the weapon a value representing the level of protection
it affords the limbs in which it is being wielded. Balance documents
outline specific armour class limits for this mud.
set_wc(int wc);
Example: set_wc(10);
This will give the weapon a value representing the quality of the weapon.
Again see balance documentation for specific weapon class ranges.
set_type(string type);
Example: set_type("blade");
Sets what type of weapon the weapon is. Valid types are listed in your mud's
balance documentation.
***************************************************************************
Special functions which you may use to do fun things:
See the standard object's:
set("read", string|function);
void set_decay_rate(int);
Example: set_decay_rate(1000);
Sets how many hits a weapon can make before decaying one degree in quality.
You should see the balance documents for your mud for decay rate ranges.
void set_wield(string|function);
Examples: set_wield("You feel the power of the butter knife!");
set_wield( (:this_object(), "wield_butter":));
You may pass either a function or a string to this function as an argument.
If you pass a string, the string will be written to the player every
time the weapon is wielded in place of the "You wield foo" generic
wield message. If you pass a function, when a player tries to wield a
weapon, that function will be called. If that function returns a 1,
the player can wield the weapon. If it returns 0, the wielding is
not allowed. Example:
void create() {
::create();
...
set_wield( (: this_object(), "wield_butter" :) );
...
}
int wield_butter() {
if((string)this_player()->query_class() != "cleric") return 0;
else return 1;
}
See /doc/lpc/data_types/function for more info on the function data type.
set_hit(string|function)
Examples: set_hit("You bash your opponent with the butter knife!");
set_hit( (: this_object(), "weapon_hit" :));
Every time the weapon hits an opponent, if you have passed a string,
the string will be written to the wielder. If you passed a function,
the function you passed will be called passing the enemy object as an
argument. Whatever your function returns will be added to the damage
done. Example:
void create() {
::create();
...
set_hit( (: this_object(), "weapon_hit" :) );
...
}
int weapon_hit(object attacker) {
if((string)attacker->query("race") == "artrell") return random(10);
else return 0;
}
void set_unwield(string|function);
Examples: set_unwield("You are no longer burdened by the butter knife.");
set_unwield( (: this_object(), "unwield_butter" :) );
Exactly the same as set_wield(), except this is called when the player
unwields a weapon.
void set("skill level", int);
Example: set("skill level", 50);
Makes it so that only a person with a skill in the weapon's weapon type
above what you set may wield the weapon.
****************************************************************************
Functions which may be called externally or internally to change the weapon:
void add_poisoning(int)
Example: add_poisoning(10);
Makes the weapon a poison weapon capable of poisoning opponents.