Store Entity in Player Persistent Variable

Started by MamaLuigi on

Topic category: Help with modding (Java Edition)

Last seen on 20:16, 7. Jun 2024
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Store Entity in Player Persistent Variable

I have an entity variable, and I want to set a player persistent, string/number variable, (whichever is better), to it, but I can't figure out how to.

 

Is it even possible? If so, how do I do it? If not, what can I do instead?

 

Any help would be greatly appreciated!

Last seen on 18:01, 13. Jun 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfourtunately, I haven't…
Thu, 01/18/2024 - 22:20

Unfourtunately, I haven't been able to find a good way of saving entity data as global variables. (Though it's presumably possible, as I'm pretty sure this is how taming works.) What specifically are you trying to do? There might be a simpler workaround.

Last seen on 20:16, 7. Jun 2024
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I figured out that bit, and…
Fri, 01/19/2024 - 00:21

I figured out that bit, and i have stored the entity as a global string variable, but how can i set a local entity variable to a string variable?

Last seen on 18:01, 13. Jun 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's the trouble, I'm…
Sat, 01/20/2024 - 15:56

That's the trouble, I'm pretty sure MCreator doesn't allow saving entities as global variables, only local ones. 

One thing you could try is getting the registry name of the entity, and saving it as a string variable. (Though this, of course, wouldn't save NBT data or unique properties.) But you would then at least be able to use it in commands, (by using text functions to insert the entity's registry into the code for a summon command, data command, etc.) Otherwise I'm not 100% sure.