Create Character Array before they are spawned in the world

Hi,

I am creating a Battle System similar to the Final Fantasy Games.

I have created a CharacterMaster blueprint of the Character Class and each of the controllable characters are children of this.

I have also created an Actor BP called BP_BattleManager which will handle the core battle system but at the moment only spawns the actors in the world at each of the spawn points. (This may all be moved to the Level Blueprint in the future)

As it is, this works as I intended but it does not provide a scalable system when more characters are added in the future as I should need to spawn each of the Chars in the world to create references to them and set up the array. What I need to do is create an array of all the playable characters before they are spawned so that I can manipulate the array and spawn specific entries.

There is probably a simple solution to this that I am overlooking but only being a Layman when it comes to blueprints I cannot work it out.

Thanks in advance and any suggestions would be most welcome.

You know it’s kinda funny that I was thinking like you when I created something similar) You just look at the solution but don’t see it, as I was then)

136440-2017-05-02_18-57-00.png

All you need is an array of your classes (characters)! When you create a AActor variable there are more than just a reference type. Set your characters to the array of actor classes!

136451-spawn+actors+from+array.png

PLUS: u can store this array in your gamemode or gamestate, so you can easily acess it from any BP :wink:

@Two-Faced, Thanks Two-Faced, I knew it was something simple :slight_smile: I guess I was spawning the actor from class to create a reference so that I can spawn the actor from class again.

@Tankbuster, thanks for the suggestion too. I have now created the array of the actors on the GameInstance so then I can access it from anywhere and it is not level specific so that I can add them as you meet them in the world then spawn them using the Battle Level.