Special mention to Orange#0513 for the idea to revamp the method ever since variables were implemented
Requirements+
ExecutableItems Premium
NOTE: CREATE 2 ACTIVATORS FIRST.
First activator
Create a variable
A variable needs to be created so we can have an identifier if the switch is on/off
You click on this icon to open the variables editor
You basically just create a variable
For the id, there's nothing really specific. for this guide, we will label our variable as "x"
It doesn't really matter if it's a number or string
For this tutorial we will use the value of 0
Create your item, and add an activator
In this case it will be a PLAYER_ALL_CLICK
Commands
Type what commands you want to type
Variables Modification
First click this icon in the activator editor
Create a variable modification
Select the variable that we created earlier
Set the type of modification to SET
We will be setting the value other than 0 so the same activator can't run for the 2nd time
Placeholder Condition
This is needed to control what activator is going to run
PLAYER_STRINGis an option too
We will use the placeholder for the variable we created. Use %var_x_int% if you still used PLAYER_STRING
We will use this comparator
We will use 0 value as the "off" option
Add the other item cooldown to the item itself
For example, the id of the ei item is onoff-demo. You would then have to go to this icon then follow the pictures.
For example, the id of the on/off switch is "faker", so select "faker".
Ever since 5.0 dropped, activator ids start from "activator0" instead of "activator1". Anyway, you would want to select the second activator as activators run from top to bottom.
This option is important because if there's no cooldown, it will ram through the the 2nd activator that's supposed to turn off the activator
This is suggested to be set to true if you want the item to be spammable. One tick is enough to prevent the ramming mentioned above.
Second activator
We will use again PLAYER_ALL_CLICK
Commands
Type what commands you want to type
Variables Modification
Placeholder Condition
This is needed to control what activator is going to run
Add the other item cooldown to the item itself
For example, the id of the ei item is onoff-demo. You would then have to go to this icon then follow the pictures.
For example, the id of the on/off switch is "faker", so select "faker".
Ever since 5.0 dropped, activator ids start from "activator0" instead of "activator1". Anyway, you would want to select the second activator as activators run from top to bottom.
This option is important because if there's no cooldown, it will ram through the the 2nd activator that's supposed to turn off the activator
This is suggested to be set to true if you want the item to be spammable. One tick is enough to prevent the ramming mentioned above.
Save the EI Item
It should look like this (We added on commands to say ON (activator1) and OFF (activator2) to show you how it is working :p