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

Discussion in 'Skript' started by EricDasBrot, Jun 10, 2017.

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

    EricDasBrot Member

    Joined:
    Jun 1, 2017
    Messages:
    26
    Likes Received:
    0
    I have made a script where you can not get any case damage. There were also no mistakes, but I still got damage.


    on damage:
    if attacker and victim are in world "KnockIt1":
    damage cause is fall:
    set damage to 0

    I hope you can help me

     
    #1 EricDasBrot, Jun 10, 2017
    Last edited: Jun 10, 2017
  2. Best Answer:
    Post #5 by ShaneBee, Jun 10, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Use cancel event instead of set damage to 0.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    It didn't work
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Code (Skript):
    1. on damage:
    2.     victim world is "World"
    3.     damage cause is fall
    4.     cancel event
    5.  
    I don't understand why are you cechking too attacker? if attacker is <none>... so doesn't work... try this above code.
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    People, please use if conditions with indentation. Not including it makes the code really unprofessional to read.
    Code (Skript):
    1. on damage:
    2.     if victim is in world "KnockIt1":
    3.         if damage cause is fall:
    4.             cancel event
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    It was a boolean condition meaning it had to be correct, it wasn't an incorrect indentation. It is actually more efficient / better to use the one before as it doesn't check for an elif or else after the last if.
    --- Double Post Merged, Jun 10, 2017, Original Post Date: Jun 10, 2017 ---
    This was the better one^
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    It can be used either way, but using indentation is more preferable, especially in larger code. Using if conditions allows you to have access to more conditions, which in this case would be else if and else. But, since OP is probably only using the condition once, I still recommend using if condition if OP wants to expand it in the future.
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Fair enough.
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    God no, any performance gain or hinderence would be so slim it doesn't matter and the readability is more important
     
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Don't need readability if no one else is going to see it but him...
     
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    if you want to torture yourself
     
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    How is it torture? Have you ever read any pther language than skript lol..? Most languages simply don't have many words at all..
     
  15. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    What do you even mean? C++ or C you can write code without tabs/indentation but yet we still do? Why? For readability..
     
  16. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    I wasn't against tabls, I was against useless words or statements that just add lines...
     
  17. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    You wouldn't be saying this if you actually programmed in a computer language. "Useless words or statements" this doesn't make sense. No lines are being wasted from what I'm seeing.
     
  18. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    So Python, C, C++, Java and PHP don't count as "computer languages"? The useless words I was referring to were the if statements added. Not words in programming languages like if, I was talking about the code submitted.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...