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 out 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.

hello can you help me on a script

Discussion in 'Skript' started by mynameisjosep, May 6, 2020.

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

    mynameisjosep Member

    Joined:
    Apr 25, 2020
    Messages:
    29
    Likes Received:
    0
    i recorded a video this video explains my problem

    So guys i breaking coal with level 1 pickaxe and if i break coal with another level 1 pickaxe it shows last pickaxe breaked coal amount
    so i dont want this
    code is
    Code (Text):
    1. on break of coal ore:
    2.     if tool's name is "&alevel 1":
    3.         add 1 to {coal::%player%}
    4.         set lore of player's tool to "&7breaked coal &2%{coal::%player%}%"
     
  2. TheMisterWolf

    Supporter +

    Joined:
    Jan 25, 2020
    Messages:
    15
    Likes Received:
    0
    Here's what happens with your current code:
    1. You break coal with pickaxe 1
    2. The variable {coal::%player%} has 1 added to it (now equal to 1)
    3. The lore of your tool displays the variable {coal::%player%} (equal to 1)
    4. You switch tools and break another piece of coal with pickaxe 2
    5. The variable {coal::%player%} has 1 added to it (now equal to 2)
    6. The lore of your tool displays the variable {coal::%player%} (equal to 2)
    What you want is to display the amount of coal broken with a particular pickaxe not the total amount of coal the player has broken.

    To do this you could either use nbt or get the value out of the lore.

    NBT (Requires skBee):
    Code (Text):
    1. on break of coal ore:
    2.   if tool's name is "&alevel 1":
    3.     set {_coalBroken} to "coal.broken" tag of nbt of tool
    4.     add "{coal.broken:%{_coalBroken} + 1%}" to nbt of tool
    5.     set lore of player's tool to "&7breaked coal &2%{_coalBroken} +1%"
    Lore (not recommended):
    Code (Text):
    1. on break of coal ore:
    2.   if tool's name is "&alevel 1":
    3.     set {_coalBroken} to uncoloured line 1 of lore of player's tool
    4.     replace all "breaked coal " with "" in {_coalBroken}
    5.     set lore of player's tool to "&7breaked coal &2%({_coalBroken} parsed as number) + 1%"
     
    • Agree Agree x 2
  3. mynameisjosep

    mynameisjosep Member

    Joined:
    Apr 25, 2020
    Messages:
    29
    Likes Received:
    0
    sir its working but i need upgrade this pickaxe example
    Code (Text):
    1. on break of coal ore:
    2.     if tool's name is "&6Level 1":
    3.         set {_coalBroken} to uncoloured line 1 of lore of player's tool
    4.         replace all "breaked coal " with "" in {_coalBroken}
    5.         set lore of player's tool to "&7breaked coal &2%({_coalBroken} parsed as number) + 1%"
    6.         set {_item} to player's tool
    7.         if {_coalBroken} is greater than or equal to 5:
    8.             remove {_item} from player
    9.             give a diamond pickaxe of efficiency 2 named "&6Level 2" with lore "" to player
    10.  
    i did this but not working i tried to use nbt but not working even i download skBee its giving problem cuz i using craftbukkit
     
  4. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    This should fix your problem of upgrading
    Code (Text):
    1. on break of coal ore:
    2.     if tool's name is "&6Level 1":
    3.         set {_coalBroken} to uncoloured line 1 of lore of player's tool
    4.         replace all "breaked coal " with "" in {_coalBroken}
    5.         set {_coalBroken} to ({_coalBroken} parsed as number) + 1
    6.         set lore of player's tool to "&7breaked coal &2%{_coalBroken}%"
    7.         set {_item} to player's tool
    8.         if {_coalBroken} is greater than or equal to 5:
    9.             remove {_item} from player
    10.             give a diamond pickaxe of efficiency 2 named "&6Level 2" with lore "" to player
    11.  
     
  5. mynameisjosep

    mynameisjosep Member

    Joined:
    Apr 25, 2020
    Messages:
    29
    Likes Received:
    0
    i will try now
    --- Double Post Merged, May 26, 2020, Original Post Date: May 26, 2020 ---
    can you explain me this code i trying to edit but not working
    --- Double Post Merged, May 26, 2020 ---
    when i try to edit it not working
     
  6. WeeHee

    WeeHee Active Member

    Joined:
    Mar 4, 2017
    Messages:
    108
    Likes Received:
    21
    What are you trying to change?
     
  7. mynameisjosep

    mynameisjosep Member

    Joined:
    Apr 25, 2020
    Messages:
    29
    Likes Received:
    0
    i trying to change the letters when i changing the script is broking
     
Thread Status:
Not open for further replies.

Share This Page

Loading...