problems with set damage equations

  • 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
Can't change the damage anymore after the event has already passed
(weapons.sk, line 102: set damage to damage + damage / 100 * 50')
(weapons.sk, line 114: set damage to damage + damage / 100 * 65')
(weapons.sk, line 126: set damage to damage + damage / 100 * 90')
(weapons.sk, line 142: set damage to damage + damage / 100 * 110')


Idk how to solve this x-x pls help

Code:
on damage:
    if "%lore of attacker's tool%" contains "Critical Strike 1":
        chance of 15%
        set damage to damage + damage / 100 * 25
        send action bar "&7Critical Damage!" to attacker
        play sound "entity.player.attack.crit" with volume 1 and pitch 1.5 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop

    if "%lore of attacker's tool%" contains "Critical Strike 2":
        chance of 20%
        set damage to damage + damage / 100 * 50
        send action bar "&3Wow, Critical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.55 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 3":
        chance of 25%
        set damage to damage + damage / 100 * 65
        send action bar "&aGood &bCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.5 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 4":
        chance of 30%
        set damage to damage + damage / 100 * 90
        send action bar "&eSMASH &bCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.5 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 5":
        chance of 32%
        set damage to damage + damage / 100 * 110
        send action bar "&bSUPER &lCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.4 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.4 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        stop
 
instead of setting it raw. use a variable


Code:
set {_damage} to %final damage%+%final damage%/100*65
damage victim by {_damage} heart

Note: you need to use victim and attacker.

Hope it works!

oh also. when it means the event has already passed. It means the player has hit the entity and you can't do anything else. And you can't set a damage without using what it's being targeted. like how can you set the damage without stated who is being damaged. Add a cancel event if you want the damage by heart to be average
 
Sadly it didn't work...
what Skript detect that part .. I have Skript,Sk-bee,Skquery, Skellett, MorkazSk and Tuske

Can't understand this condition/effect: set {_damage} to %final damage%+%final damage%/100*65 (weapons.sk, line 114: set {_damage} to %final damage%+%final damage%/100*65')
[doublepost=1635518281,1635516429][/doublepost]nevermind ... i solved myself .. hehe :emoji_sweat_smile:
Code:
if "%lore of attacker's tool%" contains "Critical Strike 2":
        chance of 20%
        set {_highchance} to damage / 100 * 25
        damage victim by {_highchance} hearts
        send action bar "&3Wow, Critical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.55 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop
 
Can't change the damage anymore after the event has already passed
(weapons.sk, line 102: set damage to damage + damage / 100 * 50')
(weapons.sk, line 114: set damage to damage + damage / 100 * 65')
(weapons.sk, line 126: set damage to damage + damage / 100 * 90')
(weapons.sk, line 142: set damage to damage + damage / 100 * 110')


Idk how to solve this x-x pls help

Code:
on damage:
    if "%lore of attacker's tool%" contains "Critical Strike 1":
        chance of 15%
        set damage to damage + damage / 100 * 25
        send action bar "&7Critical Damage!" to attacker
        play sound "entity.player.attack.crit" with volume 1 and pitch 1.5 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop

    if "%lore of attacker's tool%" contains "Critical Strike 2":
        chance of 20%
        set damage to damage + damage / 100 * 50
        send action bar "&3Wow, Critical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.55 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 3":
        chance of 25%
        set damage to damage + damage / 100 * 65
        send action bar "&aGood &bCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.5 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 4":
        chance of 30%
        set damage to damage + damage / 100 * 90
        send action bar "&eSMASH &bCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.5 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        stop
    if "%lore of attacker's tool%" contains "Critical Strike 5":
        chance of 32%
        set damage to damage + damage / 100 * 110
        send action bar "&bSUPER &lCritical Damage!" to attacker
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.4 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 0.4 at victim
        play sound "entity.firework_rocket.blast" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        wait 2 tick
        play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
        play sound "entity.firework_rocket.twinkle_far" with volume 1 and pitch 2 at victim
        stop
The error says it all, you can't change the damage after the event has passed. You have a lot of wait 2 ticks there meaning that the event already passed by the point it gets to your damage effect
 
Status
Not open for further replies.