Solved How to increase the effects of a custom enchant according to the number as level in the lore

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

Tonipop

Member
Aug 15, 2021
12
0
1
22
Hello
I wanted to ask if it was possible to reduce this code, instead of putting in each condition the level number, like what is shown here.
to put as in a single condition that detects depending on the level in number .
making it increase for example the chance
if level 1 :
the chance was 5%.
in the following levels it would start to increase by 5%.

Code:
on damage:
    attacker is entity
    victim is entity
    if "%lore of victim's tool%" contains "Reflex 1":   
        chance of 5%
        send action bar "&bReflexed" to victim
        push victim backwards at speed 1
        play sound "entity.player.attack.sweep" with volume 1 and pitch 1.5 at victim
        cancel event
    if "%lore of victim's tool%" contains "Reflex 2":   
        chance of 10%
        send action bar "&bReflexed" to victim
        push victim backwards at speed 1
        play sound "entity.player.attack.sweep" with volume 1 and pitch 1.5 at victim
        cancel event
    if "%lore of victim's tool%" contains "Reflex 3":   
        chance of 15%
        send action bar "&bReflexed" to victim
        push victim backwards at speed 1
        play sound "entity.player.attack.sweep" with volume 1 and pitch 1.5 at victim
        cancel event
 
change the times that it loops to change the amount off levels it can handle
Code:
on damage:
    attacker is entity
    victim is entity
    loop 10 times:
        if "%lore of victim's tool%" contains "Reflex %loop-value%":
            chance of (loop-value * 5)%
            send action bar "&bReflexed" to victim
            push victim backwards at speed 1
            play sound "entity.player.attack.sweep" with volume 1 and pitch 1.5 at victim
            cancel event
 
Status
Not open for further replies.