Hello,
I have the following schema where there’s a collection “monsters” for monsters owned by every user and the key being each monster’s uuid.
nk.storageWrite([{
userId: ctx.userId,
collection: "monsters",
key: uuid,
permissionRead: 1,
permissionWrite: 0,
value: monster,
}])
Is there any way to bulk update the HP on all monsters owned by a user without fetching them? It seems that key
is required, so I’m not sure.
Any alternate ways to design the schema would be appreciated too, thanks.
Hi @MinatoTW
Would you be able to provide a little more detail on your game design? From what you’ve shared so far I understand the following:
- Players collect monsters in the game world.
- At certain points HP becomes adjusted based on actions by the players.
- The HP increase is applied to all monsters owned by the player at once.
Is this right?
Hello @novabyte, thanks for replying.
Yes, the “monster” is a JSON with stats like hp, max hp etc. After a battle the hp is reduced and we need to set it back to max hp when healed.
I think I might need to use SQL and store these directly, because using nakama means I’ll need to always query the monster and parse the JSON to find the max hp right? Let me know if there’s any other way, I really like Nakama and would like to use it as much as possible.