Can you store a copy of a scene in an array?

Godot Version



I’m trying to design a Creature Collector RPG. I have creatures inheriting from a class of export variables. Trying to practice, I have the creature as its own scene, and I have it placed into the world, and when the player touches it, It disappears, and is stored in an array called party. What I want to do is almost working. The issue is when I free the object. Currently I have…

func Capture_Creature():

If I don’t have queue_free, the storing of the scene works, but when I queue_free, the party array prints as “Freed object”, which makes sense, but how can I get the scene to be copied into the party before freeing the original? Or is there a better way to do this?

It will only store nodes as a reference so queue_free will delete the creature. Maybe you can remove the creature from the scene tree by un-parenting it.

queue_free() essentially deletes the object.
It seems that you don’t actually want to delete it, you want to remove it from the game field.
I would just change the visibility of the creature and shut off processing:

func Capture_Creature():
    visible = false
    set_process(false)  # or set_physics_process(false) or other input et al

If the creature does not need to be recalled then you can just store the name of it and queue_free() as you had it.