1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved damage cause not working

Discussion in 'Skript' started by UntitledGaming, Apr 10, 2021.

Thread Status:
Not open for further replies.
  1. UntitledGaming

    Joined:
    Mar 18, 2021
    Messages:
    16
    Likes Received:
    0
    im trying to make a person imune to explosions

    Code (Text):
    1.  
    2. on damage:
    3.     if damage cause is explosion:
    4.         victim is a player:
    5.             cancel event
     
  2. Dogloverblue17

    Joined:
    Sep 2, 2020
    Messages:
    28
    Likes Received:
    1
    yea, i have alot of issues with damage cause, luckily you can just do this
    Code (Text):
    1. on damage:
    2.     if "%damage cause%" is "explosion":
    3.         victim is a player:
    4.             cancel event
     
  3. UntitledGaming

    Joined:
    Mar 18, 2021
    Messages:
    16
    Likes Received:
    0
  4. Xgod2205

    Xgod2205 Member

    Joined:
    Feb 25, 2021
    Messages:
    17
    Likes Received:
    0
    Please mark this solved
     
  5. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    No don't do that. Explosion isn't a valid damage cause type, please always see the docs first:
    https://skriptlang.github.io/Skript/classes.html#damagecause
     
  6. Daniel Greer

    Daniel Greer Member

    Joined:
    Dec 11, 2020
    Messages:
    18
    Likes Received:
    1
    PatoFrango is right, (since they won't give the code straight up) it should be:

    Code (Text):
    1. on damage:
    2.     if "%damage cause%" is "entity explosion":
    3.         victim is a player:
    4.             cancel event
     
  7. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Not quite right. What I meant was:
    Code (Text):
    1. if damage cause is block explosion:
     
  8. Daniel Greer

    Daniel Greer Member

    Joined:
    Dec 11, 2020
    Messages:
    18
    Likes Received:
    1
    No, I was right. What does Block Explosion check for? I tested Entity explosion with creepers, ghasts and tnt, and it returned true. Block explosion returned absolutely nothing.
     
  9. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Im not talking about which type you end up using. I dont know if it’s “block” or “entity” explosion, the problem with your answer was you stringified the values unnecessarily (by doing “%damage cause%” and “insert correct explosion type here” instead of removing the quotes and percent signs)
     
  10. Daniel Greer

    Daniel Greer Member

    Joined:
    Dec 11, 2020
    Messages:
    18
    Likes Received:
    1
    Oh, okay. I have a bad habit of doing that because of some skripts I've worked on giving errors when using "is" as a check instead of "="
     
  11. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Hmm that’s weird, it’s more common and more true to the true purpose of Skript to use English words rather than symbols
     
  12. Daniel Greer

    Daniel Greer Member

    Joined:
    Dec 11, 2020
    Messages:
    18
    Likes Received:
    1
    Well I code in Java and Lua and multiple other programming languages. When I use a programming language of any type, I tend to stick to my roots.
     
  13. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    That's totally valid and understandable :emoji_slight_smile:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...