From the NannyMUD documentation

LAST CHANGE

2005-01-18

NAME

        simple_monster - A simple monster object.

INHERITS

        /std/basic_monster
        /std/msg

FUNCTIONS

SETUP FUNCTIONS

        add_chat
        remove_chat
        set_chat_chance
        start_walking
        stop_walking
        add_attack

QUERY FUNCTIONS

        query_busy      - returns number of hearts beats this monster is busy.
        query_attacks   - returns a copy of the attacks array.
        query_chats     - returns a copy of the chats array.

OTHER FUNCTIONS

        remote_handle_move_monster
        remote_handle_moved
        remote_prevent_enter
        remote_peace_beat
        remote_fight_beat

        remove_attack

PROPERTIES

INTERNAL PROPERTIES


PROPERTY NAME

        walk_all_over - Allow a walker to leave your area.

DESCRIPTION

        Adding this property will make a walking monster able to
        leave the area of his creator.

PROPERTY NAME

        walk_when_fighting - The monster can walk in the middle of a fight.

DESCRIPTION

        Adding this property will make the monster able to walk
        even if it is involved in a fight. Usually when monsters
        are in a fight they will not move away, unless wimpy.

PROPERTY NAME

        speed_chat - Make the monster say the entire chat in one go.

DESCRIPTION

        Chats are queued, and in each heart beat, only one line of text is
        displayed. To get the whole queue emptied at once, add this property.

DESCRIPTION

        This file implements some basic functions needed for many monsters
        such as chats, attacks and walking around.

FUNCTION


NAME

        add_chat - Add chat strings.

SYNTAX

        void add_chat(string chat)

SYNTAX

        void add_chat(string *chats)

DESCRIPTION

        This function adds one or more 'chats' to the monster. Chats are
        strings that the monster will echo when there are players present
        and it is not under attack. You can either give it one chat string
        at a time, or send it as an array of chats.

NOTE

        Chats are queued, and in each heart beat, only one line of text is
        displayed. To get the whole queue emptied at once, use the property
        speed_chat. Also note that the chats are automatically broken down
        into chunks of 74 characters each.

FUNCTION


NAME

        remove_chat - Remove chats.

SYNTAX

        void remove_chat(string chat)

SYNTAX

        void remove_chat(string *chat)

DESCRIPTION

        This function does exactly what add_chat does, only backwards.

FUNCTION


NAME

        set_chat_chance - Set the chance to be obnoxious.

SYNTAX

        mixed set_chat_chance(mixed chance)

DESCRIPTION

        This sets the chance (in percent) for the monster to echo one of
        the chat strings every heart beat. ie. A chance of 1 will in average
        do a chat every 200 seconds, a chance of 2 will do one every 100
        seconds, etc etc.
        The argument is passed through eval(). Thus, you can calculate the 
        chat chance in a function defined in the monster file.

FUNCTION


NAME

        start_walking - Make monster walk around.

SYNTAX

        void start_walking(int speed)

DESCRIPTION

        This function starts the monster walking. It will in average walk
        every  seconds.

        By default, the monster will only walk in its creator's area.
        If the property walk_all_over is set, the monster will walk around
        in all areas, unless the property no_walkers is set in the
        room it is about to enter. This will not work if the monster
        use remote_prevent_enter.
        
        If the property walk_when_fighting is set, the monster will walk
        even while fighting.

SEE ALSO

        sequence in std/misc/sequence

FUNCTION


NAME

        stop_walking - Stop a monster's walk.

SYNTAX

        void stop_walking()

DESCRIPTION

        This function will stop the monster's current walk by setting the
        walk speed to 0. You can start it again if you use the function
        start_walking(int), see above.

FUNCTION


NAME

        add_attack - Add an attack to the monster.

SYNTAX

        void add_attack(string message,
                        int chance,
                        int damage,
                        int busy,
                        int sp,
                        string type,
                        int shots)

DESCRIPTION

        This function adds an attack to the monster, the args are as follows:

        message
                This will be sent to msg(). \b1PRON will be the name of
                the monster, \b2PRON the name of the attacker.
        chance
                This is the chance that the spell will be executed.

        damage (optional)
                This spell will make random(damage) damage to the opponent.

        busy (optional)
                If this is given, the monster will not cast any more spells
                for this long. If this is zero, the monster may cast another
                spell during the same heart_beat.

        sp (optional)
                If this is given, this attack will use that many of the
                monsters spell points. This might be a good way to make
                monsters more equal to players.

        type (optional)
                The attack will do damage of the type given. Note that if
                the attack does inflict damage, this argument must be set.
                See help damage_types for more info.

        shots (optional)
                If this is set to a value > 0, the monster will only do the
                attack that many times. Useful for example in a monster with
                a limited number of throwing knives.

        All arguments are sent to eval() with the opponent as second argument.

FUNCTION


NAME

        remove_attack - Remove an attack to the monster.

SYNTAX

        void remove_attack(string message,
                           int chance,
                           mixed damage,
                           mixed busy,
                           mixed sp,
                           mixed type,
                           mixed shots)

DESCRIPTION

        This function removes an attack previously added with add_attack.
        The arguments to this function must match those given to add_attack
        exactly for the attack to be removed.

FUNCTION


NAME

        query_attacks - Get the attacks the monster has.

SYNTAX

        mixed query_attacks()

DESCRIPTION

        This function returns a copy of the array in which all attacks are
        stored.

FUNCTION


NAME

        query_chats - Get the chat strings.

SYNTAX

        mixed query_chats()

DESCRIPTION

        This function returns a copy of the chats array.

FUNCTION


NAME

        remote_handle_move_monster - Handle monster moving.

SYNTAX

        string *remote_handle_move_monster(object monster)

DESCRIPTION

        This function is called when the monster wants to move to find out
        what directions it has to choose from. It should return an array of
        commands that the monster can choose from.

FUNCTION


NAME

        remote_handle_moved - Handle new locations.

SYNTAX

        void remote_handle_moved(object monster)

DESCRIPTION

        This function is called when the monster has walked into a new room
        it could be used to greet people in the room or similar things.

FUNCTION


NAME

        remote_prevent_enter - Prevent entering some locations.

SYNTAX

        int remote_prevent_enter(object monster, string filename)

DESCRIPTION

        This function is called to see if the monster may enter the room
        with the file with the given filename. If it is not allowed to
        this function should return 1, otherwise 0.

EXAMPLE

        remote_prevent_enter(object monster, string filename)
        {
          /* not allowed to enter the forest */
          if (filename == "/examples/room/forest") return 1;
        }

FUNCTION


NAME

        remote_peace_beat - Function called when we're not fighting.

SYNTAX

        void remote_peace_beat(object monster)

DESCRIPTION

        This function is called every 2 seconds when there are players in
        the room and the monster isn't fighting.

FUNCTION


NAME

        remote_fight_beat - Function called when we are fighting.

SYNTAX

        void remote_fight_beat(object monster)

DESCRIPTION

        This function is called every 2 seconds when we are fighting someone,
        it can be used to make really really special attacks.