In-world Togglable Button by purplg#1141
This code is over 6 months old. The code may have expired and might no longer function.
Description
This is a button you can place in the world and each player can toggle independently, meaning each player gets their own settings on whether they have toggled the button on or off.
Explanation
Global Variable A contains settings for the button in the form of an array with the following values:
- Position of button (Must change!)
- Radius of button
- Focus distance for button
Player Variable A contains an array with the state of the button for the player
- Whether button is focused or not
- Whether button has been pressed into active state
If you want to change the effects of the button, go to the rule BUTTON: EFFECTS.
This rule has 6 actions. The first 3 are the effects for the Inactive state of the button and the last 3 are the effects for the Active (pressed) state.
- In-world text that says on/off
- Effect of the actual button
- Effect while hovering
Implementation
Copy all the rules except DEBUG: TELEPORT into your gamemode. You are going to have to change every reference of either Global Variable A or Player Variable A to your own respective variables. There is only 1 Global and 1 Player variable used. Make sure not to change the indices!
BUTTON: GLOBAL: INIT
Actions
4 Global
BUTTON: PLAYER: INIT
Actions
5 Player
BUTTON: EFFECTS
Actions
10 Global
8 Player
BUTTON: FOCUS
Conditions
6 Global
1 Player
Actions
1 Player
BUTTON: UNFOCUS
Conditions
6 Global
1 Player
Actions
1 Player
BUTTON: INTERACT
Conditions
1 Player
Actions
1 Global
4 Player
Archival Notice
This post was originally hosted on workshop.elohell.gg, a site which is no longer online. If this was originally your post, you may click the button below to transfer this post to your Workshop.codes account or delete this post entirely.
Archive Actions