When you duplicate a blueprint in your scene, how do can you reference each instance of that blueprint in the blueprint itself?

I have a blueprint containing a mesh (BlueprintA), and I duplicate it several times in my scene. But how can I get references to each individual mesh in BlueprintA?

How are you duplicating it?

If you are Spawning it, then there is a Return Value that you can use. Otherwise, you will probably have to try a Line Trace or a Sphere Overlap.

Basically you need to get the spawned object’s blue Actor reference one way or another.

If a blueprint is in the level then it is already unique. You just need to reference it.

If you are already specifically referencing each bot individually then you probably have a problem calling whatever event or blackboard that triggers/runs the AI.

What Thunderstorm is trying to do is spawn 5 similar blueprints in a scene, each with their own “life”. At the moment, these blueprints are enemy bots, with simple ai logics set up for when the player gets close etc., but the problem at the moment is that all the blueprints in the scene react when the player gets close to one blueprint/enemy. If an enemy is 5000 units away, he will react when the player gets close to a similar blueprint located another place the scene.

Is there an easy way to fix this and make each of the same blueprint unique in the level?

how would I go about using the return value, line trace or sphere overlap to get the actor reference?

I am also not currently spawning the blueprint but dragging several instances of it into my scene. It is not a traditional AI blueprint either, just some simple logic to make an actor follow the player and play animations.

Sorry, return value on a SpawnActor from Class node(which is the actor that was spawned).

For Line Trace you need to “Break Hit” and then pull the actor out of that.

For Sphere Overlap you just pull the actor out of the array that is generated. If the overlap only hits 1 then the index is 0.

What is really happening is that I do a simple line trace between two sockets on the actor’s hand (to find the player). It only traces once when the punch animation is playing. But the problem is that it gets the socket location and animationMontage from all the blueprints in the scene so that it traces every time for each animation, so if I have 3 blueprints in the scene it traces 3 times for each punch of all of the blueprint. In short, they don’t act independently.

So one punch is thrown and it fires the trace on all actors in the scene that can punch?

It sounds like you are going to need to rework your punch/trace so that it is only being called when a specific actor is doing the action. Sounds like it is being called in general or whenever the class does it(which means all actors of that class do it).

So you need a blue actor variable type reference to the specific actor, and that should be driving the action. Get socket of “Blue Actor Variable Here”, fire trace/punch even in “Blue Actor Variable Here”.

You can get this Blue Actor reference to the actor on Spawn, using hit events, etc.

Exactly how do I get the actor reference that I can plug into the get socket location node?

The actor Return Value when you spawn the actor, a trace/overlap, etc.

You can store the reference once you have it in a Blue Actor variable and it plugs into the Target input on the Get Socket Location.

I’m not spawning my actors, just dragging the blueprint into the scene, so I don’t get the return value.

The reason I’m doing this is because when I try to spawn the actor in the level blueprint, it doesn’t function properly (it doesn’t run around)

I managed to fix the problem with some help from my classmate. What I did was to only trace when the attack animation was playing (with a delay), my system for figuring out when to trace was a little overcomplicated, which is what made it trace several times.

Thank you for your help regardless ^^