Denizen/Triggers
< Denizen
Triggers are what allow NPCs to react to player actions such as chatting to the NPC, clicking the NPC, attacking the NPC, or just walking near the NPC.
How To Make A trigger
First, you must enable the trigger:
You can enable them just by running the command - Trigger
- trigger [name:chat/click/damage/proximity] (state:true/false) (cooldown:<#.#>) (radius:<#>)
This is usually done in the assignment script - on assignment, but it can be done anywhere else as well.
Then you must make an Interact Script and include the trigger to react however.
You can also use Assignment script actions "on click", "on enter proximity", and "on exit proximity".
Chat Trigger
A Chat trigger is written like so:
chat Trigger: '1': Trigger: "/Hello/ there npc!" Script: - CHAT "Hello, <player.name>!" '2': Trigger: "/Bye/ npc!" Script: - CHAT "Goodbye, <player.name>!" '3': Trigger: /REGEX:.+/ Script: - CHAT "I don't know what <player.chat_history> is!"
Any message that contains the /Message/ will activate that part of the trigger.
You can also include any RegEx by prefixing it with REGEX:
Click Trigger
click Trigger: Script: - CHAT "Hehe, that tickles!"
Click triggers happen when a player right-clicks an NPC.
Damage Trigger
Damage Trigger: Script: - CHAT "Ow! That hurt, <player.name>!"
Click triggers happen when a player right-clicks an NPC.
Proximity Trigger
Proximity Trigger: entry: Script: - CHAT "Hello there, <player.name>! exit: Script: - CHAT "Goodbye, <player.name>!" move: Script: - CHAT "This is optional and will spam you =D"
Proximity triggers fire when a player enters or leaves the radius defined by the - trigger command.