1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Can anyone try to help plz

Discussion in 'Skript' started by Claver01, Mar 22, 2018.

Thread Status:
Not open for further replies.
  1. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
    .
     
    #1 Claver01, Mar 22, 2018
    Last edited: Mar 27, 2018
  2. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,234
    Likes Received:
    172
    Medals:
    1. Don't use the on any move event, it could become harmful to the server's performance at some point and I doubt you need it for this task.
    2. Don't use WildSkript at all, it's a bad addon.
    3. You're better off start using list variables, {this.format} in variables is discouraged because the format: {script-name::category::%object%::property} (would be something like {xp-enchant::%player's uuid%} for you) is way better and here is why:
    • You can clear the variables just by doing:
      Code (Skript):
      1. clear {my-variable::*} # all variables that start with "my-variable" will be deleted.
    • You can loop it.
    • Makes variable sorting (for things like leaderboards) a lot easier.
     
    #2 Snow-Pyon, Mar 22, 2018
    Last edited: Mar 22, 2018
  3. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,234
    Likes Received:
    172
    Medals:
    Well not exactly the same but kind of; storing objects by UUID is just better in-case the user has changed of name, so if I used {xp-enchant::%player%} and the player changed their name, they would lose all the xp they had on the tool.

    Now, regarding your issue, what you could do is applying a kind of UUID to the item (preferably on its NBT but since you can't really use NBT in Skript 1.12+ you may use the lore for it) and reference it that way. Does everyone get this enchant just by picking up/crafting a pickaxe or do you have to apply it somehow? If it's the latter then you would just add the UUID to the lore when they enchant it, but if it's the former then it's a bit more complicated.
     
  4. BrettPlayMC

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    714
    Likes Received:
    53
    They basically told you how to do it. Spoon feeding is frowned upon so here are the docs: https://docs.skunity.com/
     
  5. BrettPlayMC

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    714
    Likes Received:
    53
    Then learn. Here is the link to the docs: https://docs.skunity.com/
     
  6. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
    i still dont undestand it... sorry
    can you please help me :/
    --- Double Post Merged, Mar 22, 2018, Original Post Date: Mar 22, 2018 ---
    can anyone help?
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    what are you setting this variable "{xpenchant.%player%}" as?
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Nothing and a question mark? So you’re putting a variable into your skript and you don’t even know anything about it?
    --- Double Post Merged, Mar 23, 2018, Original Post Date: Mar 23, 2018 ---
    Ok so I'm going to help you out based on the info you gave us

    Code (Skript):
    1. options:
    2.     lore0: Whatever lore you want or have already written
    3.  
    4. on any move:
    5.     if player is holding a pickaxe:
    6.         if lore of player's tool does not contain "&a&lPickaxe":
    7.             set {xpenchant::%uuid of player%} to "nothing?"   #< -- Putting that there, because thats what you said
    8.             set line 3 of lore of player's tool to "&a&lPickaxe"
    9.             set line 4 of lore of player's tool to "&8(&a%{xpenchant::%uuid of player%}% &7/ &750&8)"
    10.             set line 5 of lore of player's tool to "{@lore0}"
    11.             stop
    12.          
    13. on break of ore:
    14.     if player is holding a pickaxe:
    15.         if lore of player's tool contains "&a&lPickaxe":
    16.             add 1 to {xpenchant::%uuid of player%}
    17.             set line 4 of lore of player's tool to "&8(&a%{xpenchant::%uuid of player%}% &7/ &750&8)"
    I personally wouldn't use the "on any move" event, because that will be checking a lot of players A LOT of times. I would use "on break" so the first time they break something with that pick, it'll change the name/lore of the tool

    Also, follow Snow's suggestion using %uuid of player% instead of %player% ... helps with future name changes
     
    #8 ShaneBee, Mar 23, 2018
    Last edited: Mar 23, 2018
    • Agree Agree x 1
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Are you wanting help writing this Skript or are you wanting someone to write it for you?
    Because a few people have helped you here, and each time someone helps you, the idea of your skript changes.
    I would love to help, but I solved your issue, and you respond with "That is not what I want, I wanted {this}" but you never told me what {this} was in the first place.
     
  10. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    The best way to do this is make an event for anything that has to do with a change in the player's inventory. Here are some examples:

    Code (Skript):
    1.  
    2. on pickup:
    3.     if event-item is a pickaxe:
    4.         set {_tag} to tag "value" of nbt of event-item
    5.         if {_tag} is not set:
    6.             add "{value:1}" to nbt of event-item
    7.  
    8. on inventory click:
    9.     if clicked item is a pickaxe:
    10.         set {_tag} to tag "value" of nbt of clicked item
    11.         if {_tag} is not set:
    12.             add "{value:1}" to nbt of clicked item
    13.  
    14. on break:
    15.     player's held item is a pickaxe
    16.     set {_tag} to tag "value" of nbt of player's held item
    17.     if {_tag} is not set:
    18.         add "{value:1}" to nbt of player's held item
    19.     else:
    20.         set {_tag} to {_tag} parsed as integer
    21.         add 1 to {_tag}
    22.         add "{value:%{_tag}%}" to nbt of player's held item
    23.  
     
    • Useful Useful x 1
  11. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
    quick question, how do i add it to my lore as i did
    with the format
    set line 3 of lore of player's tool to "&a&lPickaxe"
    set line 4 of lore of player's tool to "&8(&a%{xpenchant.%player%}% &7/ &750&8)"
    set line 5 of lore of player's tool to "{@lore0}"

    thx for the the rest of the help <3
     
  12. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    Code (Skript):
    1.  
    2. on break:
    3.    player's held item is a pickaxe
    4.    set {_tag} to tag "value" of nbt of player's held item
    5.    if {_tag} is not set:
    6.         add "{value:1}" to nbt of player's held item
    7.         set line 3 of lore of player's held item to "&a&lPickaxe"
    8.         set line 4 of lore of player's held item to "&8(&a1 &7/ &750&8)"
    9.         set line 5 of lore of player's held item to "{@lore0}"
    10.     else:
    11.         set {_tag} to {_tag} parsed as integer
    12.         add 1 to {_tag}
    13.         add "{value:%{_tag}%}" to nbt of player's held item
    14.         set line 4 of lore of player's held item to "&8(&a%{_tag}% &7/ &750&8)"
    15.  
    16. #This is one of the many ways to accomplish what you want.
    17.  
    18.  
     
    #12 AsuDev, Mar 27, 2018
    Last edited: Mar 27, 2018
  13. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
  14. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    I guess you can't have multiple options in a contains statement? I made an alternative method above ^

    There is multiple ways you can do this. The way I sent will check any line of lore on your item. There is a much easier way if the item info will always stay on line 4 of the lore.
     
  15. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
    i am sorry but i am not very good at script can you sendt the full code <3
    thx for the help
     
  16. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    I just updated my post. Take a look at it now.
     
  17. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
  18. Claver01

    Claver01 Active Member

    Joined:
    Mar 22, 2018
    Messages:
    44
    Likes Received:
    0
  19. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    195
    Likes Received:
    18
    Code (Skript):
    1.  
    2.  
    3. on break:
    4.    player's held item is a pickaxe
    5.    set {_tag} to tag "value" of nbt of player's held item
    6.    if {_tag} is not set:
    7.         add "{value:1}" to nbt of player's held item
    8.         set line 3 of lore of player's held item to "&a&lPickaxe"
    9.         set line 4 of lore of player's held item to "&8(&a1 &7/ &750&8)"
    10.         set line 5 of lore of player's held item to "{@lore0}"
    11.     else:
    12.         set {_tag} to {_tag} parsed as integer
    13.         add 1 to {_tag}
    14.         add "{value:%{_tag}%}" to nbt of player's held item
    15.         set line 4 of lore of player's held item to "&8(&a%{_tag}% &7/ &750&8)"
    16.  
    This works. If it doesn't work for you, then there is something wrong with your version. I just tested this on latest bensku, 1.12.2 spigot, and 1.12 SkStuff.
    --- Double Post Merged, Mar 28, 2018, Original Post Date: Mar 27, 2018 ---
    If you are done here, set the post to Solved.
     
Thread Status:
Not open for further replies.
Loading...