How to avoid fatal damage?

Started by NanaSnowy on Mon, 11/14/2022 - 05:25

Topic category: Help with modding (Java Edition)

Last seen on 14:31, 14. Nov 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to avoid fatal damage?
Mon, 11/14/2022 - 05:28 (edited)

How can I make a procedure or a actually coding that can avoid the player die in any circumstances? Instead of dying they stop at half heart 

My objective is to make a mod where the player get a effect potion when reaching half heart and get immortal while a custom potion effect still running for 20 seconds, the player get blinded, glowed slowed and weaked, if the player use a specific item he regains his hp 

It's designed to be a simples knock-out mod 

Sadly I don't know how to recognize when the player get half heart and how to make him immortal while with the effect, also, no one knows if Minecraft or another mod gonna have a giga damage and just hit kill the player, I want to make the player stay alive with exactly half heart, avoiding any type of hit kill dmg

 

Also how I can make a procedure to "when player reach this number of hp"

 

First post btw, sorry if anything got wrong here.

Edited by NanaSnowy on Mon, 11/14/2022 - 05:28
Last seen on 23:27, 14. Jan 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
When on half a heart give…
Mon, 11/14/2022 - 13:14

When on half a heart give the player resistance 5 or hight makes the player invincable