Permanent within the Scene

ozz

  • *
  • Posts: 575
So, I’m looking to place Treasure within an area the Player will be able to revisit many times, but said Treasure should only be able to be acquired once.  For example, some Gems lightly hidden in the environment that the Player can grab at any time, but do not respawn after being picked up. 

Is there any way to do this using only scene code or does it require Game Attributes?

Justin

  • *
  • Posts: 4706
You need to use game attributes for this.

If you don't want to set up individual game attributes for something like this, you might want to consider automating it by using a Map game attribute, and coming up with some way to uniquely identify each actor that you want to track. Then you can set the unique key to true/false depending on whether the treasure has been collected.

For example, you could use scene name + actor x position + actor y position as they keys for your map. Then, as long as you don't rename the scene or move your actor, the key won't change, and when you load your game next time, the treasure will still be removed from the scene. And you can place that code in a single behavior that will work for all actors its attached to.

That's just an example. Perhaps there's a better solution for you, but it depends on how your game works.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

ozz

  • *
  • Posts: 575
Thanks, just implemented a map.  It works great and feels organized.