Module m_actions

Documentation for the modules-m_actions module in /std/modules/m_actions.c.

Module Information

This module adds functions in monsters so they can do actions or respond to actions.

Functions

void set_delay_time(int x)

Sets the amount of time between possible actions. The minimum value is 5, which is default and is fine for most situations. For a large number of action objects, increasing this number (and increasing the chance that an action can be executed at the same time) could be beneficial.

void do_game_command(string str)

Emulates handling of emotes and player commands for NPCs that inherit this module. E.g. do_game_command(“wield sword”). do_game_command(“smile hap*”).

void respond(string str)

Does a command [using do_game_command] after a small delay. This is the best way to have NPCs react to events, as a slight delay makes it a bit more believable, and also if you do things immediately, the action may PRECEDE the thing you are responding to. Example: Troll which attacks anyone who says ‘foo’. I say ‘foo’, you and the troll are in the room. If the message is delivered to the troll before you, the troll will attack me BEFORE the message gets to you.

void set_actions(int delay, string *actions)

This function sets a list of actions and a delay, and chooses one to be executed time each time that delay elapses. This function should only be called from within setup().

File generated by Lima 1.1a4 reStructured Text daemon.