How do I remove a node from the scene, delete the scene, add the scene again, and then still have that node removed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By exuin

I asked this question before but my wording wasn’t clear enough so I didn’t get the answer I was looking for. Since it already has an answer, it’ll probably be skipped over, so I’ll just ask the question again.

I want the player to be able to pick up an item and put it in their inventory. Then when the player leaves the scene and returns to it, the item should still be gone. How do I do this? Do I have to save the data to a file each time? Should I make a new file for each scene that has removable objects? Do I just not close the scene, ever?

:bust_in_silhouette: Reply From: klaas

you could give every item that can be picked up a uniq name or id.
Then give every item a script “” in there on _ready you ask the player if it is in his inventory. If it is, it turns itself invisible.

When your player can drop items anywhere it has to be more soffisticated. Then i would create one master script as singlton. There you could save the position and state off any object.

Thanks, it worked.

exuin | 2020-09-14 01:42