#Attacker wont receive damage
1 messages · Page 1 of 1 (latest)
the latest
Did you hit the victim more than 1 time
Its your variable change it to a local variable
wdym?
Well it's how you set it up
Remove the if {d} is not set
cause what it's doing is if the victim is at max health 10-10
{d} would be 0
this should also be a local variable
what’s that 🙃
when a variable name starts with _
it makes it so the variable is only accessible in that code block and gets removed after
here, you create the variable and use it only there
but it could cause issues with multiple players and whatever
so you could have it be {_d}
bad idea xD
you need to use it when it's only ever used in a specific code block and never again after
Wait so
{_name} is anywhere in the file or anywhere in the code block?
And what does {name_} mean
nothing
having _ restricts the variable to this instance of this code block
say you have a on death: event
a variable named {_idk} in that event would only be accessible for that specific event
if someone else dies, they have their own variable
Oh yes I need that
you also cant access that variable inside another event/command/function
it's only for that specific code block, for that specific triggered event
So if I did an in damage event with the function {_d} then it would be specific for dif players
wdym the function {_d}
wdym by function here
srry i just dk the name of what its called
local variable?
yeah
that's better, cus, after the event, the variable will be deleted (since you dont need it no more)
plus, if someone else triggers this event at the same time, it won't have to share the variable; local variable will exist separately on both instances of the event
in your case, since the code you execute is instant, it shouldnt matter too much... but it's a good thing to learn how to use for when you need it
im going to sleep now, gn