Checking if a player dies as a result of damage inflicted

Started by WafflesQueen on

Topic category: Help with modding (Java Edition)

Last seen on 12:59, 28. Feb 2024
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Checking if a player dies as a result of damage inflicted

I am attempting to make a potion that deals damage to a player for 5 seconds, and if they survive, they get an achievement and effect. What would be the best way for going about creating this type of checker. As of right now, I am just checking if the player is dead after 5 seconds, but if they die immediately, and respawn, they can get the achievement. 

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The wait function probably…
Mon, 02/05/2024 - 12:03

The wait function probably isn't the way to go here. I'd make some custom logic variables. Set a logic variable to true when the player gains the effect, false if they remove it prematurely or die, and then if they no longer have the effect but the variable is true, reset the variable and give them the achivement.