Solved damage

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

EricDasBrot

Member
Jun 1, 2017
26
0
0
28
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
 
Last edited:
code_language.skript:
on damage:
    victim world is "World"
    damage cause is fall
    cancel event

I don't understand why are you cechking too attacker? if attacker is <none>... so doesn't work... try this above code.

People, please use if conditions with indentation. Not including it makes the code really unprofessional to read.
code_language.skript:
on damage:
    if victim is in world "KnockIt1":
        if damage cause is fall:
            cancel event
 
People, please use if conditions with indentation. Not including it makes the code really unprofessional to read.
code_language.skript:
on damage:
    if victim is in world "KnockIt1":
        if damage cause is fall:
            cancel event
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.
[doublepost=1497115270,1497115226][/doublepost]
code_language.skript:
on damage:
    victim world is "World"
    damage cause is fall
    cancel event

I don't understand why are you cechking too attacker? if attacker is <none>... so doesn't work... try this above code.
This was the better one^
 
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.
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.
 
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.
Fair enough.
 
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.
[doublepost=1497115270,1497115226][/doublepost]
This was the better one^
God no, any performance gain or hinderence would be so slim it doesn't matter and the readability is more important
 
You wouldn't be saying this if you actually programmed in a computer language.
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.
 
Status
Not open for further replies.