Skip to content

Trigger block

McHorse edited this page Sep 4, 2021 · 4 revisions

Trigger is a Mappet block which allows you to add triggers for when a player left or right clicks on the block. Trigger block can be used for variety of things:

  • Open a dialogue for a player to inspect some kind of item lying on the floor (let's say inspect a skull)
  • Open a dialogue with a crafting table (this will create an immersion of a workbench)
  • Execute an event which will open a secret door
  • Decorative block that upon hitting will be doing some sound (like a bell), etc.

You can acquire a trigger block in Mappet's creative item tab.

Trigger block

Finding a trigger block

Since trigger blocks are non solid invisible blocks, it might be hard to find them when creating a map. However, you can see the locations of trigger blocks (yellow cubes) when F3 debug screen is enabled.

This works only in creative mode.

Trigger block in F3 debug screen

Configuration

To configure a trigger block, place it down somewhere, and right click it. You'll see following screen:

Trigger block's configuration screen

Left and right click triggers

Left and right click triggers allow to setup a trigger which will be executed upon player left clicking and right clicking the block.

In creative mode, however, you can't test left click trigger (you'll need to change to survival or adventure mode), because it will break the block. However you can test right click trigger by sneaking and right clicking the block.

Trigger variables

Additionally, x, y and z variables are provided to trigger's context, which are XYZ block position of the trigger block in the world. For example, if you want to create a relative portal, you could use a command trigger block with following command:

/tp ${subject} ${x} ${y + 10} ${z}

This command will teleport player who left or right clicked, 10 blocks above the trigger block itself. Using /tp ${subject} ~ ~10 ~ will not be a good idea, as it will teleport 10 blocks above relative to player, and if you have a trigger block in a 3x3x3 location, the player could activate it from a corridor, and they will be teleported somewhere into the wall or void.

Collidable

Collidable toggle allows to toggle trigger block's bounding box, meaning you can make trigger block behave like a barrier block.

Clone this wiki locally