Instant Damage has no delay

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

Wavemelon

Member
Apr 27, 2024
1
0
1
15
Kentucky
So I've been making this plugin for an SMP and there's a problem with the effects that it gives. Basically, (like arrows) you can tip swords with potion effects, and there's a problem with the Instant Damage II effect where if you spam your sword, it can kill another player very quickly (which is unintended). 2 other issues are that you can, essentially, hit players through their shields because it affects them even if their shield is up, and if the attacker takes pearl damage whilst wielding the tipped sword, they'll get affected. It's a mess that I hope to clean up mostly by myself, but I mainly need help with fixing the spam-clicking glitch. Here's the Skript I used.

Code:
on damage:
    victim is a living entity
    set {_victimX} to x-coordinate of victim
    set {_victimY} to y-coordinate of victim
    set {_victimZ} to z-coordinate of victim
    if "%lore of attacker's tool%" contains "Instant Damage":
        apply instant damage 1 to the victim for 0.1 seconds
        execute command "execute at @e[x=%{_victimX}%,y=%{_victimY}%,z=%{_victimZ}%,distance=..1] run particle dust 0.67 0.18 0.18 1 ~ ~1 ~ 0.3 0.5 0.3 10 30 force"
        play sound "block.block.suspicious_gravel.break.break" to attacker
on damage:
    victim is a living entity
    set {_victimX} to x-coordinate of victim
    set {_victimY} to y-coordinate of victim
    set {_victimZ} to z-coordinate of victim
    if "%lore of attacker's tool%" contains "Instant Damage II":
        apply instant damage 2 to the victim for 0.1 seconds
        execute command "execute at @e[x=%{_victimX}%,y=%{_victimY}%,z=%{_victimZ}%,distance=..1] run particle dust 0.67 0.18 0.18 1 ~ ~1 ~ 0.3 0.5 0.3 10 60 force"
        play sound "block.suspicious_gravel.break" to attacker

If anyone can give me advice on how to fix the spam-clicking issue, that would be appreciated!
 
shrimply add an item cooldown using the skript 2.8+ item cooldown so that when the item cooldown is enabled the effect doesn't apply.

Also you can do particles using normal skript or skbee instead of console commands.

The pearl problem shouldn't happen because you check the lore of the attacker's tool. Fall damage can't hold a tool.
 
  • Like
Reactions: Luke_Sky_Walker