Armor lore not updating

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

WiebeHero

Active Member
Aug 23, 2017
135
5
0
23
Hello everyone, i have kind of got an issue with my code not working properly, so i would hope you lads got help me out with this. The thing here is it is supposed to update the lore of "Upgrade progress" but it isnt quite doing it so.

When an entity attacks the player with the helmet it is supposed to add 250 to {_o} wich needs to make the upgrade progress line to "Upgrade progress: 250 / 500" but it isnt doing that.

However if you put how many {_o}'s the armor piece recieves above the max (So above 500) it does upgrade it to its next level. Wich is wierd. Anyways here is the code for it:
Hope you can help me with this!
Code:
on damage:
    victim is a player
    victim's helmet is gold helmet
    name of victim's helmet contains "&7Divine Helmet "
    lore of victim's helmet contains "&7Rarity: Common"
    lore of victim's helmet contains "&7Upgrade Progress: "
    set {_I::*} to lore of victim's helmet 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 {_A::*} to {_I} split at "/"
    set {_O} to {_A::1} parsed as number
    set {_P} to {_A::2} parsed as number
    if damage is more than 1:
        add 250 to {_o}
    if {_o} is more than or equal to {_p}:
        send "&aYoure weapon just &eEvolved!"
        set {_PIECE} to "head"
        set {_UUIDLEAST} to 1
        set {_UUIDMOST} to 1
        set {_Name} to "Divine Helmet"
        if {_p} is 500:
            set name of victim's helmet to "&7%{_Name}% &a[&6Lv 2&a]"
            set the 2nd line of lore of victim's helmet to "&7Armour Defense: &60.26"
            set the 4th line of lore of victim's helmet to "&7Upgrade Progress: 0 / 1000"
            enchant victim's helmet with protection 1
            set {_DF} to 2
            add "{AttributeModifiers:[{AttributeName:""generic.armor"",Name:""armor"",Amount:%{_DF}%,Operation:0,Slot:""%{_PIECE}%"",UUIDLeast:%{_UUIDLEAST}%,UUIDMost:%{_UUIDMOST}%}]}" to nbt of victim's helmet
 
You forgot to set the lore to something with the {_o} variable in it after you set the {_o} variable.
 
Status
Not open for further replies.