-
Notifications
You must be signed in to change notification settings - Fork 10
Region block
Region is a Mappet block which allows to add triggers to when a player enters or exits the region, configured by the block. It also can be used to disallow players from entering the region. Region blocks can be used for variety of things:
- Start the arena when player steps into the middle of the arena
- Complete a quest upon entering the region
- Delayed death traps
- Activating a Blockbuster scene upon entering the region
- Region locks
You can acquire a region block in Mappet's creative item tab.
Since region blocks are non solid invisible blocks, it might be hard to find them when creating a map. However, you can see the locations of region blocks (purple blocks) when F3 debug screen is enabled. Additionally, in F3 the volume of the region is displayed as well.
This works only in creative mode.
To configure a region block, place it down somewhere, and right click it. You'll see following screen:
When disabled, this option allows you to make it so player can't enter the region. It will throw back the player in the direction, from which it entered into the region, with equal acceleration it entered into the region. Enabled expression allows to control whether players can pass or not (any expression that evaluates to 0
will disable teleportation).
Also when disabled, on enter and on exit triggers, and trigger delay won't be used.
Enabled expression allows you to provide an expression that will enable execution of triggers if the evaluated value is a non-zero value, or if it's empty.
Trigger delay allows to delay the execution of on player enter trigger by provided amount of ticks (there are 20
ticks in a second). It won't affect the on player exit trigger, it will get executed immediately after player exited the region.
This option doesn't work when passable option is disabled.
Update frequency option allows you to fine tune how often (in ticks) a region block will check for players. 1
will check all players in the world for whether they are in or out of the region block every tick, and 20
every second. The more players you have in the world (or server) the more calculations will be made, so if you have a lot of region blocks in the same area, you want to keep the number bigger (like 10
or 20
).
However, if you need the accuracy of calculations, so the trigger will act immediately the tick entered the region, then input 1
.
These triggers allow you to configure what to do when player enters or exits the region.
Additionally, x
, y
and z
variables are provided to trigger's context, which are XYZ block position of the region block in the world (but not of the current shape that was entered or exited from). For example, you can use this to teleport player out of the region:
/tp ${subject} ${x - 6} ${y} ${z - 8}
Write state toggles an automatization of writing a state (instead of manually adding a state through on enter/on exit triggers) to the entered player or to server.
State key field allows to input the key of the state that will be used to write to a state. The button under state key allows to pick where will the state be written to, Global makes region to write to ~
server global states and Subject is to player whom entered/exited the region.
And Additive allows to control the behavior of how it will write a state:
-
When enabled, every time player enters the state it will add
1
to the global's/subject's state by key -
When disabled, every time player enters the state it will set the global's/subject's state by key to
1
, and when the player will exit, it will fully remove that state
In essence, the whole component is a simplification of /mp state
command.
Shapes component allows you to manage multiple shapes of the region. By introducing multiple shapes, you can create more sophisticated regions with a single block without interrupting the tracking of players in and out (that wouldn't be possible with multiple region blocks as they will retrigger enter and exit triggers when passing from one region to another).
To add a new shape, simply click on the ➕ icon right to the Shapes label. To remove a shape, simply right click somewhere in the center of shape configuration fields (but not the shape switching button), and it should let you pick Remove this shape.
Once you have a shape (there is a box shape by default), you can switch the shape by left or right clicking on the top button of the shape editor. At the moment, region block supports following shapes: Box, Sphere, and Cylinder.
Each of these are self explanatory, and they have pretty similar properties. The property they have in common is XYZ offset, which allows you to shift the region by specific amount of blocks. This should allow you to hide region blocks within walls or underground, while having region itself where you want it to be.
Box's half size allows you to specify the size of the region's box on X, Y and Z axes. Keep in mind that the full size of the box is twice as what you'll input into the field.
Cylinder's radius and height allows you to change the horizontal radius of the cylinder and its height, respectively. As with box's half size, both radius and height are calculated relative to the offset point so they are half of the size.
Sphere's ellipsoid radius allows you to change the horizontal radius of the sphere and its vertical radius, respectively. As with box's half size, both radii are calculated relative to the offset point so they are half of the size.
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).