Cancel damage from dragon's breath

  • 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.
Apr 4, 2017
16
0
0
I've just started working with Skript yesterday. I've written a simple script that should prevent a player from taking damage from dragon's breath.

Skript Version: v2.2-dev25
Skript Author:
Minecraft Version:
1.11.2
---
Full Code:

code_language.skript:
on damage of player:
    damage was caused by dragon's breath
    cancel event

Loading the script returns no error, but the script does not prevent the player from taking damage from dragon's breath.

On the other hand, replacing dragon's breath by attack does prevent the player from taking damage.

(Before I learned about the dragon's breath damage cause, I was using this workaround: [edit: improved workaround script]
Code:
    ...
    victim is in "world_the_end"
    damage was caused by attack
    attacker is not a living entity
    attacker is not a player
    ...
It's not very robust, though.)

How can I fix this?

For what it's worth the dragon's breath damage cause is apparently new: It doesn't appear in the SkUnity documentation yet, but it is documented at http://bensku.github.io/Skript/classes.html , which is written for a slightly older version (v2.2-dev23) than the one I'm using (v2.2-dev25).

Troubleshooting:

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it?
 
Last edited:
i dont sure if it will work by try this or put just dragon not ender dragon or just search addon
code_language.skript:
on damage of player:
    damage was caused by ender dragon
    cancel event
 
i dont sure if it will work by try this or put just dragon not ender dragon or just search addon
code_language.skript:
on damage of player:
    damage was caused by ender dragon
    cancel event

Thank your for the comment. I don't want to cancel melee damage caused by the dragon, I want to cancel only damage caused by dragon's breath.
 
You can just work around it.
code_language.skript:
on damage of player:
    if damage was caused by ender dragon:
        loop all entities in radius 5 of victim:
            if loop-entity isn't ender dragon:
                cancel the event
 
You can just work around it.
code_language.skript:
on damage of player:
    if damage was caused by ender dragon:
        loop all entities in radius 5 of victim:
            if loop-entity isn't ender dragon:
                cancel the event

YoshYz, thanks for the reply. With this code, wouldn't a player be immune to all dragon damage (melee and breath) if they just dropped an item nearby?
 
No , just on the breath.

Hm, I don't see why. If I understand the code correctly, then if there's a item on the ground within 5 blocks of the player, then when loop-entity is set to that item, it will see that item isn't a dragon and will cancel the original damage event. Or am I missing something?
 
Actually, it cancels the whole damage event if there is a stone on the ground within the 5 block radius.
 
Have you tried to use the damage cause or last damage cause expression with the comparison conditions instead?

Thanks for the suggestions. I tried both
Code:
on damage of player:
    damage cause is dragon's breath
    ...
and
Code:
on damage of player:
    last damage cause of victim is dragon's breath
    ...

but neither of these work. Replacing dragon's breath some other damage causes, e.g., fall, in the first script above does produce the correct behavior, so it seems plausible that there's an issue with the implementation of the dragon's breath damage cause.
 
Thanks for the suggestions. I tried both
Code:
on damage of player:
    damage cause is dragon's breath
    ...
and
Code:
on damage of player:
    last damage cause of victim is dragon's breath
    ...

but neither of these work. Replacing dragon's breath some other damage causes, e.g., fall, in the first script above does produce the correct behavior, so it seems plausible that there's an issue with the implementation of the dragon's breath damage cause.
It's definitely a bug, you might want to do a report in the issue tracker of the Skript's repository
 
Status
Not open for further replies.