-
Notifications
You must be signed in to change notification settings - Fork 10
Trigger block
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.
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.
To configure a trigger block, place it down somewhere, and right click it. You'll see following screen:
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.
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 toggle allows to toggle trigger block's bounding box, meaning you can make trigger block behave like a barrier block.
If parts of the wiki don't make sense with Mappet's latest version, or you weren't able to recreate examples (i.e. outdated information), feel free to report the page and section that is out of date on community's Discord server (make sure to mention which Mappet’s version did you use).