How to destroy design time placed actors at runtime, upon re-opening the level?

Hello,

The situation: I have a game much like Heroes of Might & Magic or Disciples. This means I have World maps and small battle maps. Upon encountering an enemies, the battle maps are open through [OpenLevel]. The battle is won or lost, so far so good, returning to the world level with [OpenLevel] and here, the problem begins:

The encounters in the world map are placed at design time, not spawned, and I would like to keep it that way if possible.

I can’t seem to find a way of destroying encounters which were fought, so that upon re-opening the world map they don’t show up anymore.

What I’ve tried so far:

  • Tried sending dummy refs of the encounter actors to the GI to be added to an array which would find them and destroy them. This obviously doesn’t work since the dummy ref is to an actor which isn’t the same actor spawned in the previous instance of the world map, so it never gets found in the array after the new instance of the map is loaded, thus never gets destroyed.
  • Sending characteristic vars to the Gi on level load (every encounter reports it’s data to the GI) won’t work either since I have encounters which also generate procedural data (number of enemies, army strength etc) which means they will roll the numbers again on their next spawn etc.
  • Other shenanigans that don’t work at all - for obvious reasons otherwise.

TLDR: How do i destroy design-time placed actors at runtime, upon re-opening the level?

Please help? :slight_smile:
Thanks, and sorry for the long post.

That’s a good idea since it’s - yes, basically saving the state of the map which is an actual savegame :slight_smile:
Thanks, I’ll mark this question as answered by you.
Meanwhile, I ised GUIDs in the construction script (which updates at desin time, this way you get unique identifiers for each object at design time - thanks to Matthew Waldstein, who came up with the idea). They get registered and checked in gameinstance after encounter spawn. If contained in the “EncountersToDestroy” array of GUIDS, they get destroyed. I guess both methods work in this case, but since I’ll have to implemment savegame anyway, I’ll probably use your method later, and throw in an “autosave” after each battle, make it look like “a feature” :stuck_out_tongue:

Thank you!

Save game object is the answer.

When the character reaches an encounter, you add a reference to the encounter in the save game.

Next time the world map loads, on begin play, it reads the list of deleted encounters from the save game and removes them from the map.

EDIT: What is the encounter? A BP in the map, or…? If you give me a bit more info, I can be more specific.

You’re welcome :slight_smile: