forked from ModDamage/ModDamage
-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ: How do I give Entities more health?
ricochet1k edited this page Jan 26, 2012
·
5 revisions
Since Bukkit recently started enforcing a maximum health on all entities, it's now tricky to give them more health. Fortunately ModDamage can simulate this pretty easily, however you have to be careful with {entity}effect.hurt and heal because they won't work the same. Example:
Damage:
# Your damage routines here
# Leave this bit at the very bottom of Damage. It will catch the damage dealt and apply it to their health tag
- 'if target.istagged.health':
- 'tag.target.health.(target_tagvalue_health - event_value)'
- 'set.target_health': 'target_maxhealth' # don't let it die prematurely
- '1' # this can't be zero or the mob wouldn't play its hurt animation
- 'if target_tagvalue_health <= 0':
- 'set.target_health': '1' # kill them with this hit
Spawn:
- 'switch.target.type':
- 'Spider': '1000' # Spiders are hard to kill
# Leave this bit at the very bottom of Spawn. It will catch health values greater than an entity's maximum
# and convert them to a health tag
- 'if event_value > target_maxhealth':
- 'tag.target.health.event_value' # set the health tag to be what the health would normally be set to
- 'target_maxhealth' # set their health to normal