armor unequip bug

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

ViperX

Member
Jul 26, 2022
26
0
1
24
Ok so when I dropping the item from my armor the armor unequip is not called so all the stats on the player are getting doubled
here is the code of armor equip/unequip
Code:
on armor equip:
    #set {_dl} to line 1 of lore of event-item
    set {lore::*} to event-item's lore split at "||"
    set {_dl} to {lore::1}
    set {_sl} to {lore::2}
    set {_fl} to {lore::3}
    if {lore::3} contains "Ferocity":
        replace all "&7Ferocity: &c+" in {_fl} with ""
    else if {lore::3} contains "Speed":
        replace all "&7Speed: &a+" in {_fl} with ""
    else:
        replace all "&7Health: &a+" in {_fl} with ""
    replace all "&7Defence: &a+" in {_dl} with ""
    replace all "&7Strength: &c+" in {_sl} with ""
    replace all "&7Ferocity: &c+" in {_fl} with ""
    set {_d} to "%{_dl}%" parsed as an integer
    set {_s} to "%{_sl}%" parsed as an integer
    set {_f} to "%{_fl}%" parsed as an integer
    set {def::%event-player%} to {def::%event-player%} + {_d}
    if name of event-item is not "&6Warden Helmet":
        set {st::%event-player%} to {st::%event-player%} + {_s}
    if {lore::3} contains "Ferocity":
        set {fer::%event-player%} to {fer::%event-player%} + {_f}
    else if {lore::3} contains "Speed":
        set {speed::%event-player%} to {speed::%event-player%} + {_f}
    else:
        set {hp::%event-player%} to {hp::%event-player%} + {_f}

on armor unequip:
    set {lore::*} to event-item's lore split at "||"
    set {_dl} to {lore::1}
    set {_sl} to {lore::2}
    set {_fl} to {lore::3}
    if {lore::3} contains "Ferocity":
        replace all "&7Ferocity: &c+" in {_fl} with ""
    else if {lore::3} contains "Speed":
        replace all "&7Speed: &a+" in {_fl} with ""
    else:
        replace all "&7Health: &a+" in {_fl} with ""
    replace all "&7Defence: &a+" in {_dl} with ""
    replace all "&7Strength: &c+" in {_sl} with ""
    set {_d} to "%{_dl}%" parsed as an integer
    set {_s} to "%{_sl}%" parsed as an integer
    set {_f} to "%{_fl}%" parsed as an integer
    set {def::%event-player%} to {def::%event-player%} - {_d}
    if name of event-item is not "&6Warden Helmet":
        set {st::%event-player%} to {st::%event-player%} - {_s}
    if {lore::3} contains "Ferocity":
        set {fer::%event-player%} to {fer::%event-player%} - {_f}
    else if {lore::3} contains "Speed":
        set {speed::%event-player%} to {speed::%event-player%} - {_f}
    else:
        set {hp::%event-player%} to {hp::%event-player%} - {_f}
also there is another dupe bug that if I dropping the "Warden Helmet" from my armor and before I putting armor that gives me speed the item is dropping to the ground and duping to my helmet armor slot too here is the code of this:
Code:
every 1 tick:
    loop all players:
        set loop-player's max health to {hp::%loop-player%} / 10
        set loop-player's health to {hp::%loop-player%} / 10
        if name of loop-player's helmet is "&6Warden Helmet":
            set loop-player's walking speed to {speed::%loop-player%} / 1000
            set loop-player's flying speed to {speed::%loop-player%} / 1000
            set {_h} to loop-player's helmet
            set {_st} to ({speed::%loop-player%} / 10) * 150
            set {lore::*} to {_h}'s lore split at "||"
            set {lore::2} to "&7Strength: &c+%{_st}%"
            set line 2 of lore of {_h} to "&7Strength: &c+%{_st}%"
            set {lore::*} to {_h}'s lore split at "||"
            set {_l} to {lore::2}
            replace all "&7Strength: &c+" in {_l} with ""
            set {st::%loop-player%::warden} to {_l} parsed as an integer
        else:
            set {st::%loop-player%::warden} to 0
            set loop-player's walking speed to {speed::%loop-player%} / 500
            set loop-player's flying speed to {speed::%loop-player%} / 500
 
Status
Not open for further replies.