Solved help removing exp

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

ツナー

Member
Dec 20, 2020
16
0
1
23
removing exp not working ;(
Code:
command /test [<text>] [<text>]:
    trigger:
        if arg-1 is "sword":
            if arg-2 is "common":
                if player's held item is sword:
                    player's level is higher or equal to 1395
                    remove 1395 from player's level
                    chance of 25%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Blind 1"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Blind 1"
                                exit loop
                    chance of 20%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Blind 2"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Blind 2"
                                exit loop
                    chance of 15%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Blind 3"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Blind 3"
                                exit loop
                    chance of 20%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Poison 1"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Poison 1"
                                exit loop
                    chance of 15%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Poison 2"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                exit loop
                    chance of 5%:
                        set {_l} to 1
                        if the 1st line of player's tool's lore is not set:
                            set the 1st line of the player's held item's lore to "&7Poison 2"
                            stop
                        while line {_l} of player's tool's lore is set:
                            if line {_l} of player's tool's lore is set:
                                add 1 to {_l}
                            if line {_l} of player's tool's lore is not set:
                                set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                exit loop
 
Last edited:
Hello!
Please try to put the code in a "code tag" (have plus sign framed in a square with a drop-down menu)
And also attaches errors.
Sorry, but i don't understand how your code run, if is a error in line, or a simple expression.
 
Hello!
Please try to put the code in a "code tag" (have plus sign framed in a square with a drop-down menu)
And also attaches errors.
Sorry, but i don't understand how your code run, if is a error in line, or a simple expression.
its just adding an lore by removing some exp
 
Code:
command /testsk [<text>] [<text>]:

    trigger:
        if arg-1 is "sword":
            if arg-2 is "common":
                if player's held item is sword:
                    if player's level is higher or equal to 1395:
                        remove 1395 from player's level
                        chance of 25%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 1"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 1"
                                    exit loop
                        chance of 20%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 2"
                                    exit loop
                        chance of 15%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 3"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 3"
                                    exit loop
                        chance of 20%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 1"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 1"
                                    exit loop
                        chance of 15%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                    exit loop
                        chance of 5%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                    exit loop
                    else:
                        send "Need XP"
            else:
                send "Error 2"
        else:
            send "Error 1"

Try to use tab key (left side on the keyboard), not the spaces.
Make the the whole script in the same mode:
or "if" or simple skript conditions ("player's level is higher or equal to 1395")
"chance of 25%" - I'm not sure, but I don't think it's a safe option.
Why? :
This function says that there is a 25% chance that this condition will be met, but a 75% chance that, if there is that very, very rare moment to go through all these "chance ..." lines and nothing will happen. (attention, it's just a suspicion).

For "if" conditions use "else:" to help you to understan where your script stop, and for what reason.

Example (it's just for example, I haven't tested it) :
Code:
on place:
    if event-block is stone:
        send "&aCongratulations, you have placed a stone block at %location of event block%" to player #or event player
    else:
        send "&7 :'( You just placed %event block%" to player
 
Code:
command /testsk [<text>] [<text>]:

    trigger:
        if arg-1 is "sword":
            if arg-2 is "common":
                if player's held item is sword:
                    if player's level is higher or equal to 1395:
                        remove 1395 from player's level
                        chance of 25%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 1"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 1"
                                    exit loop
                        chance of 20%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 2"
                                    exit loop
                        chance of 15%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Blind 3"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Blind 3"
                                    exit loop
                        chance of 20%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 1"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 1"
                                    exit loop
                        chance of 15%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                    exit loop
                        chance of 5%:
                            set {_l} to 1
                            if the 1st line of player's tool's lore is not set:
                                set the 1st line of the player's held item's lore to "&7Poison 2"
                                stop
                            while line {_l} of player's tool's lore is set:
                                if line {_l} of player's tool's lore is set:
                                    add 1 to {_l}
                                if line {_l} of player's tool's lore is not set:
                                    set the {_l}st line of the player's held item's lore to "&7Poison 2"
                                    exit loop
                    else:
                        send "Need XP"
            else:
                send "Error 2"
        else:
            send "Error 1"

Try to use tab key (left side on the keyboard), not the spaces.
Make the the whole script in the same mode:
or "if" or simple skript conditions ("player's level is higher or equal to 1395")
"chance of 25%" - I'm not sure, but I don't think it's a safe option.
Why? :
This function says that there is a 25% chance that this condition will be met, but a 75% chance that, if there is that very, very rare moment to go through all these "chance ..." lines and nothing will happen. (attention, it's just a suspicion).

For "if" conditions use "else:" to help you to understan where your script stop, and for what reason.

Example (it's just for example, I haven't tested it) :
Code:
on place:
    if event-block is stone:
        send "&aCongratulations, you have placed a stone block at %location of event block%" to player #or event player
    else:
        send "&7 :'( You just placed %event block%" to player
Tysm XD
 
Status
Not open for further replies.