Share saved variables between multiple mobs

Issue #92 open
mezzodrinker created an issue

So far, saved variables are saved for one mob only, which means that when using the same script entry on a different mob, you will get a completely blank state. While this has its benefits, it would make more sense to share saved variables across mobs that use the same script entry.

The current save model saves a new NBT tag on the mob that's interacted with, but you could save the NBT tag on the mob talker item instead, making it possible to access the same data across multiple mobs. This would, however, make it impossible to access other players' saved variables in multiplayer!

Also, if possible, this save behaviour should be made configurable, so as to not break existing scripts.

The attached script pack should allow to determine if this issue was implemented correctly or not.

Originally reported here.

Comments (3)

  1. mezzodrinker reporter

    One way to implement the new functionality but keep the old one of accessing other player's variables in multiplayer would be to split the saved variables:

    • savedVariables would be stored as NBT tags for the mob
    • savedVariablesPerPlayer would be stored as NBT tags for the mob talker item

    This way, the savedVariables would still be accessible cross-player (which they used to be before) and the savedVariablesPerPlayer would now be accessible cross-mob.

  2. Log in to comment