Refering to a spawned Actor

Hello guys, this is my first time here and I’m quite new to unreal as well.
I’m trying to make an age of empires like game, where I have to spawn some npcs to be “the villagers”. each one having their own status like health, lvl and so on. The idea here is to create a system to select and choose an action to the villagers individually or group. The problem is that I really don’t know how to refer to an actor that is not created yet if you guys could help on that I would appreciate it.

Hi Eddy, I’m not sure if I understand your question, but you cannot get a reference without actually spawning the actor. Do you want to give them order once they have spawned? Or are you referring to something like setting their default properties like health or rally location before spawning them?

Hi man ,
If the actor , you want to talk dont already exist,
you have to talk to them using anything that give you theyre reference.

For example,
you can spawn a cube where you want select the units and use the Event collision or overlap.
Those events will give you the reference to who is overlapping him.

There are collision , raycast , and a couple of other things.
You can also , check all the units manually.
For example,
All actor of class, its an array that contain all the reference or the class “Worker”
so you can use ForEachLoop to check every reference(of every worker) is in the radius of selection.

Here is an Example From the documents online of use of All actor of class. to deactivate some Fire effect that may, or not , exist.
it will just search for everyone and deactivate every fire effect.

Actually I want to spawn the actors with individual properties, and after spawning them I want to select whoever I want and give them orders like moving or getting resourcers. I’ve made a bp with all the properties and I’m using it to spawn the actors but I’m not sure if the spawned ones have the properties and I don’t know how select them.
thank you for your attention

I was looking the documents but nothing really solved my problem. I’m aware of the for each loop but it doesn’t work in the case. My problem is more like I said in the comment above.
thank you for the reply

If you want select them and give them command , its like this.
you get all theyre reference in one array, and then you can Call custom event In every worker.
You have a selection of worker in an array and communicate with them trought events or Casting to them to change theyr variables.

If you mean a graphic solution , to select them and giving them order…
you can just spawn a 3d" or draw a 2D frame around each one.
And then , trought on click event (you have to enable that),
if you click the Attack button ,
you say to the blueprint to call Attack event in each.
if you click the Build button ,
you say to the blueprint to call Build event in each.

Hope it helps, if not, try to edit the question and be more clear

that’s exactly what I want, I’ll try this array thing and see if I manage to control them. Thanks a lot