Skip to content

Trigger

McHorse edited this page Sep 4, 2021 · 8 revisions

Trigger is a component of many Mappet features which allows you to bind some response to a specific situation that happened (player interacted with an NPC, etc.). By default, it's just a button:

Trigger

But after clicking on this button a block based editor (like condition block editor) will appear:

Trigger editor

Editing

Right click on the left part of the trigger editor, Add a trigger..., and add a new trigger block. Trigger editor supports following trigger blocks:

  • Command block, it executes a Minecraft command when trigger gets triggered
  • Sound event block, it plays a sound event when trigger gets triggered, you can also choose Target whether the sound will be played to every player (Global), or only to the Player that triggered that trigger
  • Event block, it triggers an event when trigger gets triggered
  • Dialogue block, it will try to open a dialogue to the first player when trigger gets triggered
  • Script block, it executes a script (with optional function name, main is default) when trigger gets triggered
  • Item block, it can give or take items from players
  • State block, it can add, set and remove global and player states
  • Morph block, it morphs player or an NPC found by the target selector

The fields within these blocks are pretty self-explanatory, just a button to pick the ID of the event, sound event, dialogue or script, or a text field to input the command.

Frequency

Meanwhile, frequency (formerly known as delay) field that present in almost every trigger block, allows you to specify how often in ticks to trigger the action within the trigger block. It's only useful for triggers that are called very often, for example on server tick or on NPC tick.

For example, if you want to execute a command every 20 ticks instead of every tick, in an NPC tick trigger, you input 20 into delay field, and it will execute your command in the Command trigger block every 20 ticks (every 1 second).

Clone this wiki locally