/inherit/monster.c(1) MAJIK MUDLIB /inherit/monster.c(1) DDEESSCCRRIIPPTTIIOONN /inherit/monster.c is the base object of all monsters. It provides the basic functionality for monsters what should be enough for every common monster out there. If you need something more special not listed here, you have to code it yourself. CCOODDEERRSS Monster object is mainly coded by Dazzt with some help from Namhas. All things concerning monsters should be forwarded to them. MMOONNSSTTEERR CCRREEAATTIIOONN _s_e_t___n_a_m_e_(_s_t_r_i_n_g _| _s_t_r_i_n_g _*_) Every monster has to have a name, which has to be set using this function. If you have multiple names the monster can be indexed with the first one is used in monster actions. _s_e_t___s_h_o_r_t_(_s_t_r_i_n_g_)_, _s_e_t___l_o_n_g_(_s_t_r_i_n_g_) These functions define the corresponding short and long descriptions of the monster. There are sepa­ rate help files concerning the descriptions. _s_e_t___r_a_c_e_(_s_t_r_i_n_g_) Every monster *must* have a race. Calling this function will set many important variables (stats and hps for example) for without the monster will not function properly. You can manually adjust the values later if you know what you are doing. List of available races and their abilities is listed in /data/monster/races. _s_e_t___l_e_v_e_l_(_m_a_p_p_i_n_g _l_e_v_e_l_s_) Levels describe monsters' education, ie. what they have learned during their lives. Higher level will contribute towards better stats and more compli­ cated skills and spells, depending on the level type. Levels are given in type : value pairs, for example set_level(([ "fighter" : 10, "caster" : 5 ])); would give the monster ten fighter levels and five caster levels. Currently available level types are 'fighter' and 'caster'. _a_d_d___o_b_j_e_c_t_(_o_b_j_e_c_t_)_, _a_d_d___w_e_a_p_o_n_(_o_b_j_e_c_t_)_, _a_d_d___a_r_m_o_u_r_(_o_b_j_e_c_t_) Of course monsters will need equipment. With these functions you can give any object to monster. Add_weapon() and add_armour() functions will Majik 21 Nov 1997 1 /inherit/monster.c(1) MAJIK MUDLIB /inherit/monster.c(1) automatically (try to) wield / wear the objects given. Same rules for wielding and wearing apply for monsters as they do for players. MMOONNSSTTEERR BBEEHHAAVVIIOORR Monster that just stands in the room quietly waiting to be killed is a quite boring one. There are many functions for modifying monsters' behavior, which when correctly used will make monsters more interesting and unique. _s_e_t___t_a_l_k_(_s_t_r_i_n_g _| _s_t_r_i_n_g _*_) Monsters can also talk, sometimes giving helpful hints or maybe just general chatter. With this function you can set the phrases for the monster which it will repeat randomly. _s_e_t___l_a_n_g_u_a_g_e_(_s_t_r_i_n_g_) By default, monsters speak common, but you can set them to speak any language you wish. Language given is the monster's native language, and it will speak it with skill at 100%. _s_e_t___t_a_l_k___d_e_l_a_y_(_i_n_t_) Normally monsters chat every 30-60 seconds, but if you need to do it with different intervals you can modify it with this function. _s_e_t___e_m_o_t_e_(_s_t_r_i_n_g _| _s_t_r_i_n_g _*_) This function is otherwise identical to set_talk(), but instead of saying the messages will be echoed to room every now and then. _s_e_t___e_m_o_t_e___d_e_l_a_y_(_i_n_t_) Same for emotes as set_talk_delay() is for talks. _a_d_d___a_n_s_w_e_r_(_s_t_r_i_n_g _| _s_t_r_i_n_g _*_t_o_p_i_c_, _s_t_r_i_n_g _a_n_s_w_e_r_) As monsters can answer questions made by players you can define the answers with this function. Syn­ tax should be quite straightforward. _s_e_t___w_a_n_d_e_r_(_i_n_t_, _i_n_t_, _i_n_t _| _s_t_r_i_n_g _*_) Monsters don't need to stand still, but they can also move. Monsters can have three different kinds of wandering behavior. Calling set_wander(0) will disable wandering. Majik 21 Nov 1997 2 /inherit/monster.c(1) MAJIK MUDLIB /inherit/monster.c(1) _s_e_t___w_a_n_d_e_r_(_1_, _i_n_t _d_e_l_a_y_) In the first wandering type monster will wander randomly in any direction, but it will stay in the same area, which is defined in the room code with set_area() function. 'delay' is in seconds. _s_e_t___w_a_n_d_e_r_(_2_, _i_n_t _d_e_l_a_y_, _i_n_t _d_i_s_t_a_n_c_e_) Second wandering type limits the wander for maximum of 'distance' rooms away from the start location of the monster. _s_e_t___w_a_n_d_e_r_(_3_, _i_n_t _d_e_l_a_y_, _s_t_r_i_n_g _*_c_o_m_m_a_n_d_s_) Third wandering type can be a really powerful tool. You must give an array of commands as third argu­ ment, which can be from just a path for movement to a series of commands including walking, opening doors, emoting and perhaps other more complicated actions. Monsters can use exactly the same commands as mortals. _s_e_t___m_o_v_e_(_i_n_t_) This function modifies the wandering delay which is set in the set_wander() function. This function is obsolete and exists only for compatibility pur­ poses! _s_e_t___p_i_c_k_(_i_n_t_)_, _s_e_t___d_r_o_p_(_i_n_t_) Monsters can also pick up and drop objects. The chance of taking or dropping an object in every heart beat (one second) is given as percents. Giv­ ing high values will result in monster quickly looting all the stuff so lower values are recom­ mended unless you really need high ones. CCOOMMBBAATT BBEEHHAAVVIIOORR _s_e_t___a_g_g_r_e_s_s_i_v_e_(_) Calling this function makes the monster automati­ cally attack every player it encounters. _s_e_t___w_i_m_p_y_(_i_n_t _w_h_e_n_, _i_n_t _c_h_a_n_c_e_) Intelligent monsters can flee from combat. 'When' is the percent of hp left before having a chance of 'chance' percents to attempt fleeing. If you set the chance near 100%, the monster becomes nearly impossible to kill because it will most of the time run out of the room before players have chance of hitting it. Majik 21 Nov 1997 3 /inherit/monster.c(1) MAJIK MUDLIB /inherit/monster.c(1) -- Dazzt Majik 21 Nov 1997 4