Swapping between three AI companions, and how to spawn without losing previous information (health, exp, etc)

I am currently working a project that is focused on catching, battling, and raising monsters. The player will be able to equip up to three monsters, but can only use 1 at a time. I am having a hard time setting up a blue print that allows the player to spawn and swap between the 3 equipped monsters. I have been through tutorials, and this is what I came up with:

This was placed in the level BP and allows me to spawn and actor while destroying the others. The problem with this set up is that after destroying for example companion 1 when i go to spawn companion 1 again after swapping companions it spawns as a new actor in game. How would i set this BP up to be able to spawn the companion actor again instead of losing all my health, exp, etc information? Think of something like pokemon, but instead of interchanging through 6 I only have three. Any help would be most appreciated.

Anyone out there that can help? Im racking my brain right now…

If you plan on spawning the actor again, why destroy it? It’d be much easier to either hide or just not render it. Personally, I’d just set up an area under the map or way off to one side and move the actor there until it was needed again. Then you wouldn’t have any delays and no messy code to deal with.

During begin play for your character spawn the actors in a hidden area and as you need then move them into the arean. Being only three actors the memory footprint should be fairly small also.

so how would i set this up to hide instead of destroy? I have tried actor hidden in game but not sure how it really works…also thank you for your response, would you mind directing me with this set up?

If I was in your place, I’d make a small room below the map with the same number of markers in it as companions between both players. I’d spawn the companions for both players in the room when the map loaded or play began., and then move the first companion into the playable map where you need it. As the players select a different companion, I’d move the current companion to the hidden room and move the new companion to the playable map.

I understand but our project will have around 100+ usable comapnions. I want to create a system where I can switch them out within the 3 comapnion slots. Would this change the method stated above?

Not at all. Within your player character, you probably have an array or some method for storing which companions the player is taking into battle or is using at that time. When you start your match, your read your character’s desired companions and create whatever companions that want to use in the hidden area. And move the current active companion to the playable area from the hidden area.

How would I call them between the hidden area and then place them back to the hidden area?

If you don’t want to lose previous information (“health, exp, etc”), you’re gonna have to store that information as variables (which you’re gonna have to do anyway, if you want to save to a save file and continue where you left off).

So, one Float variable for HP, one for XP, MP, and so on. Then, when you switch to a different “monster”, it each has its own HP, MP, preferably displayed on the user interface.

You don’t need a “Branch” node at the front (unless you want to check first if one of your 3 monsters died or something before spawning).

And yeah, you can use a “Toggle Visibility” node instead of spawn/destroy, just like you would toggle a light source. There are several tutorials on Youtube on how to turn on/off a light, and it’s the exact same thing for meshes, same result as if you would uncheck the “Visible” checkbox in the actor’s details.

Constantly spawning/destroying a mesh back and forth is more stressful on the resources than just toggling the visibility of an already spawned mesh.

SetActorLocation to place them in the playable area and a second one to return them there.

One thing I might point out is that you might want to use seperate rooms for each team. Otherwise the two teams of companions might decide to get into a fight inside the hidden room since they are AI controlled.