Solved Possible to set a damage cause?

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

pepper82

Member
Jan 26, 2017
272
1
18
41
I use "damage player by X" in several scripts. The damage cause is always "UNKNOWN" of course. SO I wonder if there is a way to set the damage cause?

Example:
damage player by 5
set damage cause to "MyCustomDamageCause"

on damage:
if damage cause is "MyCustomDamageCause" ....
 
I don't think you can change it. What you could do though is set a variable beforehand. Just remember to not use any waits or you could have problems.

code_language.skript:
        ...
        set metadata value "damagesource" of player to "A Trap"
        damage player by 5
       
on damage:
    set {_source} to metadata value "damagesource" of attacked
    delete metadata value "damagesource" of attacked
    if {_source} is "A Trap":
        apply wither 1 to the attacked for 5 seconds
 
  • Like
Reactions: pepper82
Status
Not open for further replies.