Checking if a player dies as a result of damage inflicted

Started by WafflesQueen on

Topic category: Help with Minecraft modding (Java Edition)

Active 1 year ago
Joined Feb 2024
Points:
116

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 0
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. 

Active 58 minutes ago
Joined May 2022
Points:
1266

User statistics:

  • Modifications: 15
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1142
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.