Mob Reactions

23.5.7 Mob Reactions

Denizen reactions are very basic scripts that offer you the ability to
customise the way your loyal denizens react to the world around you. You can
make it so that your loyal denizens will greet your loved ones, spit on your
enemies, and fawn over you on command.


How Do Reactions Work?
----------------------
Reactions consist of a trigger, an action, and an optional condition. Whenever
the denizen detects the initiation of the trigger, the denizen will perform the
action. If the reaction has a condition attached to it, the denizen will only
perform the action if the trigger is initiated with the condition met.

What Can Use Reactions?
-----------------------
Only pets, house mobs and shopkeepers are supported at this time.

What Are Triggers?
------------------
Triggers are events in Aetolia that your mob might observe. Some examples of
triggers are: hearing something in the room, seeing somebody enter the room, or
being attacked. The full list of triggers that you can detect in your denizen
reactions will be listed in the command summaries below.

Triggers can also have parameters associated with them. These parameters allow
you to fine-tune the situations in which your denizen will react to a trigger.
Parameters are contextually linked to certain triggers and will behave
different across different trigger types. The list of trigger parameters that
you can use will be listed in the command summaries below.


What Are Actions?
-----------------
Actions are things that the denizen can do. Some examples of actions are:
saying something, attacking someone, or performing an emote. The full list of
actions that denizens can take in reactions will be listed in the command
summaries below.


What Are Conditions?
--------------------
Conditions are options that can be applied universally to any trigger. They are
similar to trigger parameters, but work the same for all triggers, whereas
parameters can work differently for different triggers. Each reaction can only
have one condition. Examples of conditions are: reacting only when a personal
enemy performs an action, or reacting only when a member of an organization
performs an action. The list of reaction conditions will be listed in the
command summaries below.


How Do I Set Reactions?
-----------------------
First, you must acquire a denizen reaction slot. You can purchase slots for
credits in a variety of package sizes. Once you have a slot, you then assign a
mob and reaction to that slot. You will be able to freely make modifications to
that reaction for a 24-hour period. After 24 hours, the reaction will become
locked and you will not be able to make any further modifications to it.

You can unlock a reaction slot for 1 credit, which will then give you another
24-hour period during which you can make any modifications you want to the
reaction.

If you want to delete a reaction and use its slot for another mob, you can
remove the reaction for 5 credits.


Syntax
------

 REACTION SUMMARY
  - See a list of the mobs on which you have set denizen reactions.
  - This also shows you your number of free denizen reaction slots.

 REACTION BUY <n>
  - Purchase some reaction slots. Slot packages and prices:
   1 slot:   25 credits
   3 slots:  50 credits (16.6 credits each)
   5 slots:  75 credits (15 credits each)
   7 slots: 100 credits (14.2 credits each)
   9 slots: 125 credits (13.8 credits each)
  11 slots: 150 credits (13.6 credits each)
  13 slots: 175 credits (13.4 credits each)
  15 slots: 200 credits (13.3 credits each)
  20 slots: 225 credits (11.3 credits each)
  25 slots: 250 credits (10 credits each)

 REACTION <mob> LIST
  - See the list of reactions assigned to a specific mob.

 REACTION <mob> ADD <trigger>
  - Adds a new reaction to one of your loyal denizens.
  - You will be able to freely modify the new reaction for 24 hours before
    it will become locked.
  - Denizens can react to the following triggers:
    * ENTER - the mob sees a player enter the room
    * LEAVE - the mob sees a player leave the room
    * SAY - something is said in the room
    * TELL - someone tells something to the mob
    * GIVE - something is given to the mob
    * ATTACKED - the mob is attacked
    * EMOTED - an emote is targetted at the mob
    * EMOTE_SEEN - the mob sees an emote being used
    * RANDOM - fires randomly every so often. Can only be used with 'say' and 'emote' actions.

 REACTION <mob> <id> TRIGGER <trigger> [<parameters>]
  - Modify the triggering action of one of the denizens's existing reactions.
  - Parameters allow you trigger the reaction based on more specific instances
    of the trigger.
  - Parameters are context-specific to certain triggers:
    * SAY <text> - something including the provided text is said in the room
    * TELL <text> - someone tells something including the provided text to the mob
    * GIVE <list> - something from the provided list is given to the mob; the list can include more entries
    * EMOTED <text> - an emote containing the text is targetted at the mob
    * EMOTE_SEEN <text> - the mob sees an emote containing the text being used

 REACTION <mob> <id> CONDITION <condition>
  - Add a qualifying condition to one of the denizens's existing reactions.
  - Denizens can act based on the following conditions:
     * MEMBER OF <org> - player is a member of the provided org
     * MEMBER OF <org> RANK Y / Y+ / Y- - player is a member of the provided org at a rank of Y / Y or more / Y or less. 
     * NOTMEMBER OF <org> - player is not a member of the provided org
     * ORGENEMY <org> - player is an enemy of the organisation. Includes unwanted status.
     * ENEMY - player is an enemy of the mob's owner
     * ALLY - player is an ally of the mob's owner

 REACTION <mob> <id> CHANCE <chance>
  - Gives the denizen a random chance to react to the trigger.
  - By default, denizen triggers always activate.
  - Chance can be between 1 and 100.

 REACTION <mob> <id> ACTION <action>
  - Sets the action that a denizen will take when the trigger is matched.
  - Valid actions:
     * SAY <something> - can only be used if the mob is sentient.
     * TELL <something> - tells something to the player initiating the action.
     * RETURN <emote> - only usable with the GIVE trigger; returns the given item back. If an emote is provided, it is displayed.
     * DROP <emote> only usable with the GIVE trigger; drops the given item. If an emote is provided, it is displayed.
     * ATTACK - attacks the player triggering the action.
     * EMOTE <emote> - performs the chosen emote; it can be a built-in or a custom one.
  - You can use the following variables in actions to create personalized
    responses.
    * $(who) - The person who performed the trigger
    * $(he), $(him), $(his), $(He), $(Him), $(His) - Pronouns set according
      to the gender of the person who performed the trigger.
    * $(text) - The text that was said or emotes.
    * $(item) - The description of an item that was returned to the giver.

 REACTION <mob> <id> ENABLE
  - Enable a denizen reaction.
  - This will make the reaction permanent and you will be unable to make any
    further modifications to the reaction.
  - If you wish to make changes to any reactions, you will have to remove the
    reaction from the mob and create a new one with the new changes.

 REACTION <mob> <id> DISABLE
  - Prevent a reaction from being triggered.

 REACTION <mob> <id> UNLOCK
  - Costs 1 credit.
  - Unlocks the reaction and allows you to freely make any modifications
    you want to it for 24 hours.

 REACTION <mob> <id> REMOVE
  - Costs 5 credits.
  - Removes a reaction from a denizen and allows you to reuse its slot for
    another denizen.

Examples:

Create a reaction on a denizen that makes her mob greet people who enter the
room:

REACTION <denizen> ADD ENTER
REACTION <denizen> <id> ACTION greet $(who)
REACTION <denizen> <id> ENABLE

Create a reaction on a denizen that makes the denizen respond whenever it hears
the word "Razmael"

REACTION <denizen> ADD SAY
REACTION <denizen> <id> TRIGGER say razmael
REACTION <denizen> <id> ACTION say He's quite the impressive chicken chef, isn't he?
REACTION <denizen> <id> ENABLE

Create a reaction on a denizen that makes the denizen attack whenever an enemy
of Enorian enters the room.

REACTION <denizen> ADD ENTER
REACTION <denizen> <id> CONDITION orgenemy of enorian
REACTION <denizen> <id> ACTION attack $(who)
REACTION <denizen> <id> ENABLE