Random Effect Applying for a Victim

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

senge1337

Member
Sep 21, 2019
37
0
6
22
Hi!
I'm doing a skript so when you use mage sword a random effect applies to a player you're attacking. This is my code.
Code:
on damage:
    if attacker is player:
        if victim is player:
            if attacker's tool is a wooden sword of sharpness 1 named "&ki &c&l&nMage Sword&r &ki" with lore "&cThis magic sword will", "&cattack your opponents" and "&cusing effects.":
                set {_randomf.%attacker%} to a random integer between 1 and 7
                if {_randomf.%attacker%} is 1:
                    apply poison to victim for 10 seconds
                if {_randomf.%attacker%} is 2:
                    apply blindness to victim
                if {_randomf.%attacker%} is 3:
                    apply invisibility to victim for 2 seconds
                if {_randomf.%attacker%} is 4:
                    apply weakness to victim for 3 seconds
                if {_randomf.%attacker%} is 5:
                    apply slowness to victim
                if {_randomf.%attacker%} is 6:
                    apply slow falling to victim
                if {_randomf.%attacker%} is 7:
                    apply nausea to victim
For some reason, it doesn't work and it only applies poison. How to fix it?
 
Code:
on damage:
    if attacker is player:
        if victim is player:
            if attacker's tool is a wooden sword of sharpness 1 named "&ki &c&l&nMage Sword&r &ki" with lore "&cThis magic sword will", "&cattack your opponents" and "&cusing effects.":
                add 1, 2, 3, 4, 5, 6, 7 to {random.%attacker%::*}
                set {_random.%attacker%} to random integer of {random.%attacker%::*}
                if {_random.%attacker%} is 1:
                    apply poison to victim for 10 seconds
                if {_random.%attacker%} is 2:
                    apply blindness to victim
                if {_random.%attacker%} is 3:
                    apply invisibility to victim for 2 seconds
                if {_random.%attacker%} is 4:
                    apply weakness to victim for 3 seconds
                if {_random.%attacker%} is 4:
                    apply slowness to victim
                if {_random.%attacker%} is 5:
                    apply slow falling to victim
                if {_random.%attacker%} is 7:
                    apply nausea to victim
                clear {random.%attacker%::*}
 
Last edited:
Status
Not open for further replies.