Author Topic: How to prevent items respawning when backtracking to a previous scene?  (Read 233 times)


  • Playmaker Newbie
  • *
  • Posts: 6
Hi there! I'm working on a survival horror game where you explore a large environment in order to pick key items and solve puzzles. The game takes place in an abandoned city and you have to backtrack to previous locations (scenes) in order to unlock doors you could not open before because you lacked the required key item.

The inventory is handled by a global array (ItemList) which keeps track of which items the player has picked up. I use a Playmaker action called Array Contains on my Key Items which checks if the item in question is already part of the ItemList array. If it is, then the key item is destroyed and removed from the scene, but if it isn't it remains on the scene.

This system works with my key items because they are unique, there's only one instance of them in the entire game; however, I don't know how to prevent common items, for instance, a healing elixir, from respawning. Let's say that the player finds a healing elixir on the scene Palace Gardens and then enters the Altar Room scene. There's nothing to do in this scene for the moment so the player returns to the Palace Gardens. Since the scene was reloaded, the same healing elixir that the player has already picked respawns in the exact same location as before.

Common items are not unique, you can find numerous healing elixirs in multiple scenes in the game. If I were to use the same logic as with my key items, picking one healing elixir would add it to my ItemList array and then remove every single instance of the healing elixir from the game, regardless of whether the player has picked them or not.

How can I make sure that the game remembers which specific instances of common items the player has already picked so they aren't respawned when the players returns to previous scenes?
« Last Edit: July 22, 2021, 01:22:21 PM by Migsterium »


  • Administrator
  • Hero Member
  • *****
  • Posts: 6607
    • jinxtergames
You Could have A Separate array per scene.

but i would use a object with a 'don't destroy' on load and a singleton (Ecosystem)

and have the arrays there or use Array maker (Ecosystem)
and hash tables.

hash table uses key reference instead of index.

so you could have a hashtable (bools) and look for the key Palace Gardens Elixer / Altar Room Elixer etc
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :

Join the PlayMaker Discord Channel!