player's held item variable

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

DarklordX89

Active Member
Nov 2, 2019
57
0
6
Hello, I'm making a pickaxe enchantment skript and was wondering if I could set {explosive.%player%.%player's held tool%} to instead of being item based because currently if they had 100 explosive on 1 pickaxe and got another diamond pickaxe and put explosive on that pickaxe instead of giving them explosive 1 it would give them explosive 101. Any fixes?
 
I'm not going to use Tuske on a 1.16.5 server and using a list variable did not work with first pickaxe with laser 1 and when enchanting the second pickaxe with laser it goes straight to laser 2
 
I'm not going to use Tuske on a 1.16.5 server and using a list variable did not work with first pickaxe with laser 1 and when enchanting the second pickaxe with laser it goes straight to laser 2
Why, I'm using TuSKe too on a 1.16.5 paper spigot server without any issues. And you maybe made an error using it, because there is no reason why it wouldn't work. Using a variable would be inefficient in this case, just use the lore.
 
I really don't want to use the lore because that would require a full recode of what I already have!
[doublepost=1622994470,1622994380][/doublepost]here is part of it
Code:
add 1 to {explosive.%player's uuid%::%player's tool%}
                loop 10 times:
                    if line loop-value of lore of player's tool contains "&aExplosive":
                        set line loop-value of lore of player's tool to "&aExplosive %{explosive.%player's uuid%::%player's tool%}%"
                        stop loop
                    else:
                        if line loop-value of lore of player's tool is not set:
                            set line loop-value of lore of player's tool to "&aExplosive %{explosive.%player's uuid%::%player's tool%}%"
                            stop loop
^^ formatting is weird because I didn't take out tabs but it should work!
and when I enchant a pickaxe with nothing on it, with the first pickaxe at explosive 10 the second pickaxe goes straight to 11 instead of 1
 
Get the current level out of the lore, don't use a variable. Set a local variable to the lore and then replace / split anything else you don't need. When the number is left parse it as an integer.
[doublepost=1622994692,1622994586][/doublepost]e. g. if this lore line would be "&cExplosion: &41"
Code:
set {_lore} to line 1 of lore of player's tool
replace all "&cExplosion: &4" with "" in {_lore}
set {_level} to {_lore} parsed as a integer
 
Status
Not open for further replies.