Trying to format this better...

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

msconfig32

Member
Nov 10, 2018
33
0
6
20
I have this...
code_language.skript:
on damage:
    if lore of victim's leggings contains "&7Dodge Chance: 1":
        chance of 1%:
            cancel event
    if lore of victim's leggings contains "&7Dodge Chance: 2":
        chance of 2%:
            cancel event
    if lore of victim's leggings contains "&7Dodge Chance: 3":
        chance of 3%:
            cancel event
But I want it to go to dodge chance up to 100 without having to copy and paste and edit the "dodge chance: x" and the "change of x%" every time.
How could I do this?
 
set a variable to 1
loop 100 times
then use that variable in place of the number

How would I use "chance of" with a variable? Also how do I loop a variable 100 times?
[doublepost=1541825864,1541825063][/doublepost]
set a variable to 1
loop 100 times
then use that variable in place of the number
I tried this, but it seems to work 100% of the time even though the lore is %10?
code_language.skript:
on damage:
    set {chance} to 1
    loop 100 times:
        add 1 to {chance}
        if lore of victim's leggings contains "&7Dodge Chance: %{chance}%":
            chance of {chance}:
                cancel event
                send "You dodged the attack from %attacker%." to victim
                send "%victim% dodged your attack." to attacker
                set {chance} to 1
 
code_language.skript:
on damage:
    set {_l::*} to split lore of victim's leggings at "||"
    loop {_l::*}:
        delete {_t::*}
        set {_t::*} to uncolored loop-value parsed as "Dodge Chance: %integer%"
        {_t::*} is set
        chance of {_t::1}%:
            cancel event
        stop
 
Status
Not open for further replies.