This answer has been divided into 2 parts, because only half-way through writing the second part did I realize the primary issue with your script.
#1
Any variable that starts with an underscore (i.e. _) is called a local variable. It can only be used in the section in which it was declared, hence the name. Section essentially refers to your events, commands, etc. Take for instance the code provided below. As {_x} is a local variable declared in the
command /test section, it will not be visible to other sections. Thus, when we execute the /peek command after executing /test, we will not see an output, as
command /peek cannot access that variable.
AppleScript:
command /test:
trigger:
set {_x} to 5
command /peek:
trigger:
send {_x} to player
#2
You're healing them before they're actually damaged. If you didn't know, you can actually modify the amount of damage that was dealt in the event itself. For instance, if you don't want the victim to be damaged at all, you can
set the damage to 0.
Alternatively, you can just cancel the event in this case, which is what I would do. I suppose you wouldn't want to do this if you still want the damage indicator to go off, which I don't think is the intended effect.
How much damage is done in a entity/vehicle/item damage events. For entity damage events, possibly ignoring armour, criticals and/or enchantments (remember that in Skript '1' is one full heart, not half a heart). For items, it's the amount of durability damage the item will be taking.
skripthub.net