No hit delay for all mobs except player (SkQuery, Skellet)

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

cysterna

Member
Dec 21, 2023
3
0
1
24
Im trying to make a RPG server for me and my friends and i want to make all the mobs except players recieve no delay between hits.
Code:
on damage:
    set {delay} to 0 tick
    loop all entities:
        set maximum damage delay of loop-entities to {delay}

this doesent seem to work
 
you want a script for mob damage delay, if i am not wrong, this can help you:

Code:
options:
    time: 3 seconds

on damage:
    if {damageCooldown::%attacker%} is not set:
        set {damageCooldown::%attacker%} to true
        wait {@time}
        set {damageCooldown::%attacker%} to false

    else if {damageCooldown::%attacker%} is true:
        cancel event
        send "&c&l(!) &r&cwait {@time} before attack!" to attacker
        play sound "block.note_block.bass" at pitch 0.5 to attacker
        damage attacker by 1 heart
 
this will add cooldown for players too. If you don't want this use:
Code:
options:
    time: 3 seconds

on damage:
    if victim is not a player:
        if {damageCooldown::%attacker%} is not set:
            set {damageCooldown::%attacker%} to true
            wait {@time}
            set {damageCooldown::%attacker%} to false

        else if {damageCooldown::%attacker%} is true:
            cancel event
            send "&c&l(!) &r&cwait {@time} before attack!" to attacker
            play sound "block.note_block.bass" at pitch 0.5 to attacker
            damage attacker by 1 heart

"if victim is not a player:" checking if damaged entity is not a player
 
  • Like
Reactions: cysterna