One Time Loop
There are many things that can be done using this, if you are on need of it, this is the correct place to know how it works.
In this case we are going to make an item that will add a value on scoreboard if in hand and will remove it when deselect it
A first idea would be working with SELECT_THE_EI and DESELECT_THE_EI but it has problems related to what we want to do, because the player can move the item instead of deselecting it.
Let's create the item + method
First let's create the item with /ei create <id>
Set the material, name, and everything
Now, let's take a look at the method, it will consist on 2 loop activators, one in mainhand and the another one in all slots except mainhand, and, variables, that will disable the loop once it works one time + a PLAYER_DROP_THE_EI to also reduce the scoreboard value when the player drops the item, so it would look like this:
With this explanation should be enough, anyways, if you don't understand, we will make everything step by step
Long explanation
Create the variable
Variable name: scoreboard
Type: STRING
String value: "no"
Then save and let's go to the next step
First Activator
detailedSlots only mainhand
Variable update
And this will only work if the variable is "no", so let's create a placeholder condition
And the last thing the command to add a scoreboard value to the player, in this case I will only add a command "say ADDED" as a debug command.
Second activator
Its the same idea, so this will be faster than the previous one.
Working on every slot except mainhand
Variable update
Placeholder condition:
The second placeholder, that is a playerCondition (and the condition is on the 2nd page)
In this case the name of my item is asd
Then save and delete the error message, it is annoying
And the command
Drop activator
Add another activator
Placeholder condition to make it only work if the value is already added
The command
And the variable update
And that's it, save everything and test
Testing the item
Last updated