Container opening for multiple Players?
DJ_WoW
Member Posts: 51
Gooday all,
Given: Container to be looted.
At least two Players trying to access the same container.
Player 1 accesses/opens a container and generates random stuff to be looted. Before Player1 has looted or closed the container, Player 2 accesses/opens the same container.
How would make it so that Player1 still has the loot he has generated in the container and Player2 generates his own an only sees the items that he has generated. Thus not being able to see or access the other players generated items.
Thank you for you time,
DJ-WoW
Given: Container to be looted.
At least two Players trying to access the same container.
Player 1 accesses/opens a container and generates random stuff to be looted. Before Player1 has looted or closed the container, Player 2 accesses/opens the same container.
How would make it so that Player1 still has the loot he has generated in the container and Player2 generates his own an only sees the items that he has generated. Thus not being able to see or access the other players generated items.
Thank you for you time,
DJ-WoW
0
Comments
The best you could do is force player 1 to put the items back if they grab them.
It's probably more work than it's worth to implement that.
I have not tested it, because I would need someone to help, but OnOpen shouldn't fire in the case you mentioned.
Player 2 would have to wait until player 1 leaves, then close and reopen the container to get OnOpen to fire. That is assuming the that you use OnOpen to generate the treasure. You could use OnUsed, but then, it would play out exactly as you described.
DJ-WoW
There is a Banking script on the vault that creates a new container with the "vault" of the associated CD key when the player uses an object or triggers it through a conversation. It would spawn an invisible container that would open for the triggering player.
You could have a usable chest object that triggers this script, creating a container with loot for the individual players that use it. The issue you might encounter, and the reason I never used the banking script, is that other players could see and use the created containers.
If they match, delete the player's object ID from the item. If they don't match, run a TakeItem to grab the item back. Optionally also run a SpeakString on either the chest or the player who took the item, stating that it's not theirs. If there's no player object ID on the item, then treat it as though it's a match no matter who took the item. You could do that by checking that the player referred to by the retrieved object ID is a valid object (GetIsObjectValid).
If you want to allow the taking of left-over objects by other players, have a heartbeat script which counts down before erasing all player IDs from all items still in the chest. Not perfect, but better than nothing.
If you want to get a bit more complicated, you could have the chest maintain a list of player object IDs on the chest and on each heartbeat it could loop through them and check whether or not the player is still present (within 10 metres, for example) and if not, erase that player ID from any objects left for them in the chest so anyone can take the leftover items.
Thank you for your insightful ideas. I haven't been able to keep up on my posts. Sorry it took so much time to respond to these new suggestions.
I was thinking along the lines of variable PC Id. Thanks for letting me see that this is how another person would tackle this puzzle.
Again, thank you for your time and effort.
DJ-WoW
https://neverwintervault.org/