#Heal using the Scripting Api

1 messages · Page 1 of 1 (latest)

proper gale
#

Is it possible to use the scripting api to heal an entity a certain amount (number). So far I have tried to apply negative damage and I have thought to use the instant health effect though I don't know a formula or equation to apply the exact level of instant health needed to heal the correct amount of hearts.

midnight barn
midnight barn
fair ginkgo
# faint olive use .setHealth

idk what that is but I know you can use this

let hp = Entity.getComponent('minecraft:health')
hp.setCurrentValue( hp.currentValue + Healammount)
faint olive
faint olive
fair ginkgo
#

Lol I figured but I wasn't sure if there was a new way

midnight barn
midnight barn
proper gale
#

Thanks

fair ginkgo
midnight barn
#

messed around with your script, this does work too

fair ginkgo
#

Yea i took it from one of my scripts

midnight barn
#

thank you, you helped me too, I was wondering how to heal through script.

fair ginkgo
midnight barn
#

oh I know, I was actually messing with that before I stumbled upon this post

fair ginkgo
#

Also if you want to calc how much to heal it is better

#

you like based on current