Upgrading System

  • 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 community!

    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.

WiebeHero

Active Member
Aug 23, 2017
135
5
0
SO i decided to make it much simpler that you would need just 1 specific item but tell me why doesnt this work?
Code:
on inventory click:
    cursor slot of player is magma cream
    name of cursor slot of player is "&7Common Upgrade"
    lore of clicked item contains "&7Upgrade Progress: "
    cancel event
    set {_I::*} to lore of clicked item split at "||"
    loop {_I::*}:
        if "%loop-value%" contains "&7Upgrade Progress: ":
            set {_t} to loop-index parsed as integer
            stop loop
    set {_I} to "%uncolored {_I::%{_t}%}%"
    replace every "Upgrade Progress: " with "" in {_I}
    replace every " " with "" in {_I}
    set {_B::*} to {_I} split at "/"
    set {_O} to {_B::1} parsed as number
    set {_P} to {_B::2} parsed as number
    {_o} is 0
    {_p} is 2
    set cursor of player to air
    add 1 to {_o}
    if {_o} is equal to {_p}:
        send "&aYou have just &eUpgraded &aYoure Weapon! "
        remove clicked item from player's inventory
        if {_p} is 2:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10.0,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.6,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 2]" with lore "&7Confusion II||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.4||&7---------------------||&7Upgrade Progress: 0 / 4||&7Rarity: Common"
        else if {_p} is 4:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:8.5,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 3]" with lore "&7Confusion III||&7---------------------||&7Attack Damage: 8.5||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 10||&7Rarity: Common"
        else if {_p} is 10:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 4]" with lore "&7Confusion IV||&7Blast I||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 20||&7Rarity: Common"
        else if {_p} is 20:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:12,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 5]" with lore "&7Confusion IV||&7Blast II||&7---------------------||&7Attack Damage: 12||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 50||&7Rarity: Common"
        else if {_p} is 50:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:9,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.2,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 6]" with lore "&7Confusion IV||&7Blast III||&7---------------------||&7Attack Damage: 9||&7Attack Speed: 0.8||&7---------------------||&7Upgrade Progress: 0 / 100||&7Rarity: Common"
        else if {_p} is 100:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:12,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.2,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 7]" with lore "&7Confusion IV||&7Blast IV||&7---------------------||&7Attack Damage: 12||&7Attack Speed: 0.8||&7---------------------||&7Upgrade Progress: MAX||&7Rarity: Common"
    else:
        set the {_t}th line of lore of clicked item to "&7Upgrade Progress: %{_o}% / %{_p}%"
[doublepost=1508772053,1508771974][/doublepost]Nevermind i was in creative mode XD
[doublepost=1508772118][/doublepost]And its back open because i cant get it to 2 / 2 any ideas?
 
Status
Not open for further replies.