Entity-specific variable that does not reset upon player death or leaving the world

Started by WitherKnight on

Topic category: Help with modding (Java Edition)

Last seen on 18:38, 20. Aug 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity-specific variable that does not reset upon player death or leaving the world

Hello,

I am making an entity that generates particles around it, until a player gets close, and it stops generating them, even if the player goes away. I was able to make it do this behavior through an NBT Tag, but I ran into a problem : when the player dies or leaves/rejoin, the entity starts creating the particles again, while he should still be not generating them. I tried using a global procedure instead to see if it would fix the problem, but it makes all of the entities of the same type stop generating particles, even if those specific ones have not been approached yet.

I would like to know if it is possible to make a variable that would not reset, and only affect specific entities of the same kind (those who have been approached by the player, but not those not approached yet)