INFO monster - the OLD, generic, monster DESCRIPTION This is a description of the old generic monster object, /obj/monster. Use /std/*monster instead, as they use less resources and have greater versatility. Obsolete text: There is a generic monster avaliable. To set up do : object mobj; mobj = clone_object("/obj/monster"); (For more advanced monsters, I suggest that you use /obj/smartmonster instead. Look at the file /doc/build/smartmonster!) For customization the folling routines are available : You must call this functions. set_name(n) string n. Sets the name and short description to n. Sets long description to "You see nothing special.\n" set_level(l) int l. The monster gets the level l. Hit points and ep is set as the same as player of level l. Armour class to 0 and weapon class to that of hands. For suggestions on the hp,wc and ac for a monster look in the file named monster.list. If you follow the suggestions can be almost sure of that no archwizard will be mispleased with you. You should call these functions: set_hp(hp) int hp. Sets hit points to hp. set_wc(wc) int wc. Sets the weapon class, how much the damage it will do, to wc. The damage inflicted is in the range 0..wc-1 . set_ac(ac) int ac. Armour class is set to ac. This are the optional functions. set_ep(ep) int ep. Sets ep to ep. set_al(al) int al. Sets the alignment to al, negativ is evil, pos good. set_alias(n) string n. Adds and alternate name for the monster. set_alt_name(n) string n. Adds another alternate name for the monster. set_race(r) string r. Adds an alternate generic name for the monster. set_gender(a) int a. Sets the gender of the monster. a=0 means neuter, a=1 means male and a=2 means female set_short(sh) string sh. Sort description is set to sh. Long to capitalize(short)+".\n" set_long(long) string long. Long description is set to long. set_aggressive(a) int a. 0 means peaceful until attacked. 1 that it will attack everyone it sees. set_move_at_reset() If this routine is called the monster will do a random move at every reset. set_frog() If anyone kisses the monster he will turn into a frog. set_whimpy() When monster get low on hp it will flee. init_command(string cmd) Force the monster to do a command. The force_us() function isn't always good, because it checks the level of the caller, and this function can be called by a room. set_real_dead_ob(ob) object ob. The function 'monster_died' in 'ob' will be called just before the monster dies. The argument to 'monster_died' will be the nearly dead monster object. The return value from 'monster_died' determins the fate of the monster. A 1 means that the monster will survive 0 that it will die. set_dead_ob(ob) This was the old way to do the same thing, and it is kept for compatibility. The difference from "set_real_ded_ob" is that when 'monster_died' is called, the stupid monster is already dead! set_init_ob(ob) object ob. The function 'monster_init' in 'ob' will be called from init in the monster. The argument to 'monster_init' will be the the monster object. The return value from 'monster_init' determins if the monster will attack, if it's aggressive. A 1 means that the monster will not attack, 0 that it will function as usually. These are the spell functions: set_spell_mess1(m) string m. This is the message that the other players in the room get when the monster cast's a spell. set_spell_mess2(m) string m. This is the message that the victim of the spell get. set_chance(c) int c. This is the percent chance of casting a spell. set_spell_dam(d) int d. How much damage the spell will do if it hits. The damage will be randomly 0 .. d-1 . You should try to use these functions often in highlevel monsters, after all, the players have spell so why shouldn't the monsters have some too? These are the chat functions: The chat options enables the monster to say something every heart beat. load_chat(c,str) int c. string str. Load the chat strings. c is the percent chance of saying something. str must be an array of strings. The monster will then pick one of them to say. load_a_chat(c,str) Same as above but is used when to monster is under attack. Here are the catch talk functions. Catch talk gives the the monster the possibility to act upon what it hears and sees. All messages streams that are sent to the monster are compared to a set of loadable strings. If a match occurs a function in a given object is called with the matching string as an argument. You can have one function per sentence or multiple senetence per function. set_match(ob,func,type,match) object ob. Tells which object 'ob' that holds the functions. This object becomes the default object. string func. This is the function name that shall be called when a match occour. string type. This is the second word of sentence to match. If you want do catch the sentence 'Humhum gives flower to lady' you should set type to 'gives'. string match. This is rest of the string to match. If you want do catch the sentence 'Humhum gives flower to lady' you should set match to 'flower to lady'. func,type and match must be arrays of strings and the size of the arrays must be equal. EXAMPLE string function, type, match; function=allocate(3); type = allocate(3); match = allocate(3); /* * This cathes 'name gives flower to Lady.' and * 'name gives flower to Ann.' and binds it to * the function 'handle_give' in the current object. */ function[0] = "handle_give"; type[0] = "gives"; match[0] = "flower to Lady."; match[1] = "flower to Ann."; /* * This cathes 'name say: daisy' and binds it to * the function ''handle_say' in the current object. */ function[2] = "handle_say"; type[2] = "says:"; match[2] = "daisy"; dam = clone_object("/obj/monster"); dam -> set_name("mary"); dam -> set_alias("lady"); dam -> set_short("an old lady"); dam -> set_ac(0); dam -> set_level(5); dam -> set_al(200); dam -> set_hp(30); dam -> set_wc(7); dam -> set_aggressive(0); /* Load the catch arrays */ dam -> set_match(this_object(),functions,type,match); . . handle_give(str) { object giver; if(dam && living(dam)) { string who, rest; sscanf(str, "%s %s\n", who, rest); giver = present(lower_case(who),environment(this_player())); alig = giver -> query_alignment(); if(alig > 0 ) { say("Ann says: Oh thank you " + who + ".\n"); say("Ann says: You look like a fine young man.\n"); } else { say("Ann says: Oh thank you " + who + ".\n"); } } } handle_say(str) { if(dam && living(dam)) { string who, rest; sscanf(str, "%s %s\n", who, rest); say("Ann says: Sheeit " + who + ", ah' really likes daisys.\n"); } }
Help topics available:
armour | drinks | food | key | monster |
smartmonster | weapon |
You are guest number 203 since November 2019.
This file was last modified: June 2000.