Mob Actions

Quick links:

Actions Overview

Mob actions exist to allow builders to personalize mobs, giving them things to do besides sit around waiting to be killed by money hungry players.

Mobs can use most commands that players can, although making a mob do something like 'who' just doesn't get you anywhere. The few commands mob's can't use are safeguarded so that they won't crash the system, although you may spend some time trying to figure out why this mob is not doing anything.

There are 6 parts to a mob action. These are:

  • The trigger: What event triggers the mob to act.
  • The conditions: Which people, and at what time the mob reacts.
  • The phrase: Set with some triggers, it is the text the mob will react to
  • The action: What the mob will do.
  • The chance: What % of the time the mob will react with this action.
  • The state: What state a mob must be in to do this action.
What does this mean. At certain points in the game, in reaction to certain events, the game checks to see if any mobiles are set to react to that event. For the most part, mobiles only ever react if there is someone in the room to see them reacting. Certain triggers (Init, zone reset) do not require a player to be in the room however.

If the appropriate trigger is set, it then checks to see if the person who acted should be reacted to. The phrase is checked with some phrases, to see if the command typed matches when the mob should react. If all these conditions are met, the chance is checked. If it is successful the mob performs the action, if the mob is in the appropriate state to react to this action.

Mobs can perform actions in one of 2 ways. They can either act directly (the default most of the time) or can react 'delayed'. If they react delayed, it means the next time the mob is checked for movement, etc. Rather than do a generic mob thing, it will perform the next action in its list of delayed actions. Mobs reacting to themselves or other mobs are ALWAYS set to delay, so as not to risk causing infinite mob reaction loops.

Some mob events are targeted. They are directed at a 'victim'. Others are not targeted, as the mob won't know whom in the room to target when the action is performed.

Any given mob can have as many actions defined as you want, but each additional action does cost CPU cycles. Moderation is the key, use what is necessary but don't be frivolous.

Mob Triggers

Each trigger is a flag set in the action. The trigger is activated when the mob does something, or someone in the room does something that the mob can see.

  • Enter - The mob acts when it enters a room. No victim. The phrase is the direction entered from.
  • Exit - The mob acts when it is about to leave a room. No victim. The phrase is the direction moved.
  • Update - The mob is triggered once ever 4 seconds. No victim.
  • React-say - The mob reacts to 'say' command. The phrase is text that must exist somewhere in what is said.
  • React-social - The mob reacts to generic (non-directed) socials. The phrase is the name of the social. If omitted, the mob will react to all socials.
  • React-d-social - The mob reacts to socials directed at it. The phrase is the social to react to.
  • Greet - The mob reacts when a target enters the room. The phrase is the direction entered from.
  • Leave - The mob reacts when a target is about to leave a room. The phrase is the direction moved.
  • Shop - The mob reacts when the target uses a shop command. The phrase is which shop command to react to. (buy, sell, list, browse, etc.)
  • Give - The mob reacts when given something. The phrase is what it was given ("money", or the object short description: 'a teddy bear')
  • Look - The mob reacts when someone looks at it.
  • Fight - The mob does something while it is fighting
  • Dying - The mob does something right before it dies. This can be victimless depending on how the mob dies. A mob that cannot see its killer will not perform its dying action. DON'T USE EXTRACT!
  • Surrender - The mob reacts to a victim who surrenders to it.
  • Trigger - The mob reacts to a trigger command from another mob. This is explained more under the mobact command.
  • Spell - The mob reacts to a spell being cast on them. Phrase is the spell name.
  • Message - The mob reacts to any message that's sent to rooms. The message is used as a phrase, with the original text formatting inside it ($n == actor's name, etc). A mob can react to any steal, by adding Steal as the phrase. This will allow the mob to react in whatever manner you want, to a player stealing from it. Use of this trigger should be a last resort, if another trigger exists, use it instead.
  • Get - The mob reacts to a player getting an item, either from a room or a container. The phrase of this action is the first keyword of the object.
  • Drop - The mob reacts to a player dropping an item. The phrase of this action is the first keyword of the object.
  • Door/Obj - The mob reacts to a door or object being opened, closed, locked, or unlocked. - The phrase here is which item was done, followed by the name of the object, or direction of the door.
  • Spell Result - Triggered when the mob casts a spell, The phrase is what the return code from the spell was: success, saved, syntax, affected, religon, locale, target, or failed. There is no target.
  • Zone Reset - Triggered when the mob's zone resets. There is no target.
  • Vehicle Enter - Triggered when a vehicle enters the room. The phrase is the vehicle name. There is no target.
  • Reaction - Triggered whenever the mob's reaction to a player changes.
  • Step In - Triggered when someone enters a vehicle. The phrase is the vehicle name.
  • Step Out - Triggered when someone leaves a vehicle. The phrase is the vehicle name.
  • Init - The mob calls this action when it is reset into the game. This action will be done even if no players are in the room.
  • Verb - The mob calls this in response to a spec_verb activation.
  • Delay - This is not a trigger, but a modifier. It makes the mob execute the actions in a delayed fashion, rather than all at once.
  • Specific - This is not a trigger, but a modifier. It forces the phrase of an action to match exactly, rather than partially.
  • Other - This is a generic term for additional action types that must use the phrase to specify what is being looked for. At this time, the supported phrases are:
    • "hit" - Mob scored a hit in combat.
    • "miss" - Mob missed in combat

Mob Conditions

Conditions are requirements for the action to execute. They give more control over the circumstances which cause the trigger to happen. Many conditions work as groups. For instance, Day and Night are grouped. If None of the group members are set, then that group is ignored. If any of the group members are set, then all the conditions of that group are active. At least one entry of NPC/PC/IMM/criminal group must be selected for triggers with a target.

  • Evil - Must be set if the mob is to react to evil targets.
  • Neutral - Must be set if the mob is to react to neutral targets.
  • Good - Must be set if the mob is to react to good targets.
  • Same-Sex - Must be set if the mob is to react to targets of the same sex as the mob.
  • Opp-Sex - Must be set if the mob is to react to targets of a different sex than the mob.
  • Night - Must be set if the mob is to react at night.
  • Day - Must be set if the mob is to react during the day.
  • SameRace - Must be set if the mob is to react to members of the same race.
  • OppRace - Must be set if the mob is to react to members of other races.
  • PC - Must be set if the mob is to react to players that are not criminals and are not immortals
  • NPC - Must be set if the mob is to react to other mobs
  • Criminal - Must be set if the mob is to react to players who have criminal flags.
  • IMM - Must be set if the mob is to react to players who are immortals.
  • Self - Must be set if the mob is to react to itself.
  • Not busy - The mob will not react if it has actions in its delayed action list.
  • Not Fighting - The mob will not react if it is fighting.
  • Newbie - The mob will react only to players under level 6.
  • Hero - The mob will react only to players of level 91.
  • Memory - The mob will only react to players who match the mob's current action memory. (See mobact memory)
  • Master - The mob will only react to its current master, or imms.
  • Friend - A friend is a mob who has a reaction of > 50 to the player.
  • Enemy - An enemy is a mob who has a reaction of < -25 to the player.
  • LENSCRunning - The mob must be currently running a LensC program. Strongly suggested for any action using mobact signal
  • LENSCNotRunning - The mob cannot be currently running a LensC program. Strongly suggested for any action that will end up running a program.
  • Lensmoor - The mob will only react to Lensmoorian players.
  • Antrippa - The mob will only react to Antrippan players.
  • Not Running - The mob will only react when it is not running, and when the player is not running.

Phrase

The phrases were defined under their respective triggers. If you leave phrase blank with one of those triggers, the mob will react to ALL instances of that trigger. If the trigger flag 'specific phrase' is set then the mob will only react if the phrase matches the input exactly.

Chance

This is a % chance that the action will be performed. Only one action is ever performed on a given trigger. Having 2 actions at 50% both keying on a trigger will give a 50% chance of the first action going off, if it doesn't go off, a 50% chance of the other action going off, and an overall 25% chance of no actions going off.

State

The state of an action allows complex paths of action to be possible. An action with state of 0 will always be performed, and will set the mob's state to 0. An action with state of 9999 will always be performed, but not alter the mob's state. If the state of an action is set to any other number, the mob will only react when the mob is in that state. A mob's state is set with the 'mobact state' action. This allows a mob to react to one trigger, changing its state.

Action

This is what the mob will do. For the most part, you write this field as if you were the mob, executing one command at a time. Each line of the action field is processed separately, as a separate command. In addition, multiple commands can be specified on the same line by separating them with semicolons. Any line ending with a / will be continued on the next line - in this way, you can enter commands longer than the text wrapper allows.

LML tags can be used withing the body of an action, but, there are definate problems with this. First, the first and last lines of the action have to be <LML> and </LML>. Secondly, LML auto-wraps the resulting text. As mob action processing uses line breaks to designate different commands, you will have to work very hard to make sure that the wrapped line breaks fall where needed. Finally, tags only work in actions where there is a character triggering the action. Update, Init, Enter, Leave, and Zone Reset actions won't process LML tags.

Within the action text, three characters will be replaced if possible.

  • $ - Replaced with the target's name (or disguise, as appropriate).
  • % - Replaced with the target's name (no disguise).
  • _ - Replaced with whatever is in the mob's memory.
  • + - Replaced with the phrase of the action.
  • \(expression)\ - Replaced with the processing of an expression. See Help IF
Back to top

Mobact Command

This is a command a mob can use with a trigger to accomplish something it couldn't normally do. Used in the right situations, this enables a mob to kill someone who surrenders to it, to create items in reaction to an event, or to do a restore effect. Mobact uses 'subcommands' which allow the mob to do many things with just one command. Charmed mobs lose their access to this command.

Mobact subcommands

mobact affstrip target spellname

This removes all traces of a named spell from the target.

mobact charm target duration

This makes the mob a charmie of the target for the duration specified.

mobact clear

This clears the mob's queue of pending commands to be processed.

mobact consume item / All

This allows the mob to remove an item it is carrying (or all the items it is carrying) from the game without any message.

mobact deduct amount victim

This deducts amount silver from the victim. It will deduct as much as possible, and consider itself successful if it gets as much as it asked for.

mobact delay

This makes the mob process the remained of an action in delay mode, rather than immediate mode. It does nothing if the action is already delayed.

mobact echo text

This echos text to the room.

mobact extract

This removes the mob from the game without any messages. Don't ever use this without a delay.

mobact forget

This clears all of a mob's memories.

mobact freeze victim seconds

This places a freeze on the victim's input for a number of seconds. If no time is specified, 3 seconds is the default.

mobact if

See Help IF

mobact interpret victim command

Makes the victim execute the command as if they had typed it.

mobact langteach language victim

This teaches a language to a player. The player must have a practice to spend.

mobact loadmob vnum

This creates a mob with the specified vnum and puts it in the room with the acting mob. There is no message.

mobact loadobj vnum

This creates an object with the specified vnum. If it can be carried, it is put in the mob's inventory, otherwise it is put in the room. There is no message.

mobact objtrigger object victim

This sends an object trigger to the specified object, with the victim as the actor.

mobact peace

This stops all combat in the room. It removes aggressiveness from mobs as well.

mobact pecho victim text

This echos text to the victim.

mobact reaction reaction victim

This sets the mob's reaction to a victim. Reaction ranges from 100 to -100, where 100 is best friends, and -100 is attack on sight.

mobact recho victim text

This echos text to everyone in the room except the victim.

mobact remember victim

This sets the mob's action memory to the specified victim. This can be accessed in the action parsing with the '_' replacement.

mobact restore victim

This restores a character. If no name is specified, the mob restores itself.

mobact run vnum argument

The mob runs the specified lensc program.

mobact scatter...

The mob uses the scatter command. See help scatter.

mobact signal vnum argument

The mob sends the argument text to the running lensc program with the specified vnum. Only the mob that started the program may signal to that program.

mobact seize object victim

This takes an item from a victim and gives it to the mob. There is no message.

mobact set practices/trains number

This is used to set the mob's pracpractices or trains. This is useful because the mob's practices are the extra-reset 1 and trains are extra-reset 2 for use with th various spec_funcs.

mobact setspec specname

This sets the mob's spec_func to the specified function. If an invalid name is given, it is cleared. (so, "none" clears it.)

mobact slay victim

This slays a victim outright.

mobact state number

This sets the mob's state field to the specified value.

mobact timer item time

This sets the extract timer on an item in the mob's inventory to the time indicated, in minutes.

mobact trans ALL/victim vnum (hidden)

This transfers a player, or all players, to a specified location. There is no message, but, the players will see that they were moved unless hidden is specified,

mobact trigger actor phrase

This sends a trigger action to the room. The actor for this new trigger is specified in this command, it is not the mob executing this command.

mobact unseen

This toggles a special state, in which anything the mob does is unseen. Executing this command once puts the mob in that state, a second time, removes that state.

mobact vehicle vehicle action

Performs one of the following vehicle actions:
  • Door Open - opens the vehicle door.
  • Door Close - closes the vehicle door.
  • Start - Starts the vehicle, if the vehicle has a path specified.
  • Echo text - Echos the text to the inside of the vehicle

mobact zonequest victim prior state new state

This changes the zonequest state of the victim, for the zone the area that the player is in. The player must be in the prior state, and is moved to the new state. New state is typically a number, but can be done - indicating that the player receives the quest award.

Back to top

Samples


Action: say hi $ ; poke $ If a player 'testbob' triggers this action, the mob will respond with 2 actions: say hi testbob poke testbob
To clear existing items during a fight: Trigger: fight Conditions: PC, IMM, CRIMINAL Chance: 100 State: 0, unless you've got more complex states Action: mobact clear This will clear the mob's action cue when the mob starts fighting, and abort any previously queue'd actions.