#Cancel damage

1 messages · Page 1 of 1 (latest)

vernal nimbus
#

I'd like to cancel fall damage only if specific criteria are met, but I don't know of any way to cancel damage in ScriptAPI
I believe there is a way to do so using the player.json, but it's not dynamically controlled by the SciptAPI
What would be the best way to sync up the two? Is there another way to cancel damage? Like make the player invulnerable for a tick?

leaden river
vernal nimbus
leaden river
#

What about applyKnockback()? That works

vernal nimbus
leaden river
#

teleport the player to where the player already is

#

That resets the fall timer, if the documentation is correct

vernal nimbus
#

oh thanks

gritty hedge
# vernal nimbus I'd like to cancel fall damage only if specific criteria are met, but I don't kn...

I would recommend you to just use player.fallDistance, is the property that keeps track of how many blocks an entity (players included) has falled and how much damage it will take once ir touches ground, constantly setting it to 1 if your criteria is met should be enough.

You could just constantly set the fall distance to 1 or 0, the teleport does the same, reset the fall distance, but if you wanna be more specific, just do what our other friend suggested but instead of the teleport just do

player.fallDistance = 1```
And that should be enough
junior mist
lavish lodge
gritty hedge
#

Well, then forget what I said xd

#

When they have enough speed the effect doesn't shows them down but still cancels fall damage

#

I'm not sure if it resets the fall distance, I think it does, but you can't apply that constant

#

.
Or third option, just use player.json , do so the fall damage is negated when the player has a tag, and control that that through scripting using player.addTag() player.removeTag() and player.hasTag()

#

@vernal nimbus

#

If you prefer that

#

You could still use player.fallDamage to know when the player is going to hurt themselves for the fall to avoid constant teleports or slow falling when they give down a 1 block tall fall if you want xd

#

.
Or Sprint jumping

vernal nimbus
vernal nimbus
#

@leaden rivere teleportaion trick worked, thanks

leaden river
terse jewel
#

It works for u but it’s not 100% sure it does for others players as they could lag

vernal nimbus
terse jewel
#

Might not always execute the code in time