Denizen/Triggers

From Citizens Wiki

For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.

If you want a full tutorial to help get you set up, check out the Tutorial Videos on youtube or the Beginner's Guide text website.

If you need quick help, visit our Discord group.




This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!





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.