Delayed Teleport Towards Saved Location
This should give you basic understanding on how to utilize variables for good combinations
Last updated
This should give you basic understanding on how to utilize variables for good combinations
Last updated
Ok for starters, we will create an item that once right clicked, it will teleport as back to that very location.
This is important as usual. Because how would you make the item without the item itself?
For this part, we will set the variable name's to "x" to make things simple
We will be dealing with the value later.
Ok so here's the explanation. First, we will create a variable update which will save our coordinates. Further explanation ahead.
You see, the default value for this is "var" and we are editing a variable under the name of "x". Back then in pre 5.0, we get to just click the icon to scroll through the list of variables under this item but now, we have to manually type it.
In the string update option, the placeholders in it is parsed before it gets displayed or used somewhere else.
You might be curious, why the heck did we create another right click activator? Because the first activator's task is to save our coordinates via variable update.
You might say, "Can't we just do everything in one activator?" Nope. Commands run first then the variables. Try doing it in one activator and it will not produce the wanted results.
Ok. Here's the explanation.
DELAY 30
will delay the command for 30 seconds. When it comes to variables, the activator order matters A LOT. Reversing the order of the 2 activators will break the item.
As said in the placeholders page, placeholders from the plugin will be parsed immediately meaning that any changes that are bound to happen will not affect the values. With the variable update in step 16, %var_x% will transform into the xyz coordinates of where you used the item so after 30 seconds, you will be teleported back to the exact location properly (unless you changed worlds but that's not the goal here.)
After typing the commands, of course press the exit button.
Save the item and try it out!