Get the specific character that I spawned

So what I am trying to do here is get the specific spawn pawn to stop when his enemy is dead but what is happening is all of my spawn will stop

I have 4 friendly ally and facing 4 enemies

Now when 1 friendly ally defeated its enemy it should stop the movement - now this is successful but the problem occurs here because all of the 3 others will also stop . Is there a specific node that I can use to get the specific spawned pawn?

Hello Ginxx!

Please show me how this part of your code looks like.
Should be easy to solve

BR

Here’s how I spawn

and this is the way I call them

The part where StopAttack And AttackEnemy Functionality is just a simple setactive of charactermovement and a flag (canAttack)

Every time you spawn, that reference points to the player you just spawed.

If you want to keep track of different players, you need different references, an array would do the trick…

An array on the spawn?? can you please elaborate and give an example base on my project . I dont kinda get it

Yes:

Then later you can just get the one you want back out of the array.

Also, if you put an integer in the pawn, you can do this:

So later you can always tell which pawn is which by the ID.

( that size to fit box should be ticked )

I tried this actually but didn’t stop my player from attack even the enemy is dead

and just made an array like this on my spawner

You’re missing it.

How many are you spawning, your array has to be that big. If you’re spawning 20, your array should go from 0 - 19.

Take another look at that code I put up.

just 4 ac

just 4 actually. I don’t get on how can I get that to the another blueprint actually

Ok, but how do you know which one you want to destroy?

Right now so far on what I know I am comparing the get display name if that matches then I am moving that specific pawned pawn

Ok, that’s not a great way to do it, I don’t think that will work in a production build.

You do need to use pawn references. You can just keep them in an array.

Another thing you can do it put ‘tags’ on the actor like this:

Then, later when you wanna find the enemies, you can say:

image_190380.jpg

This is the idea i am looking for thank you very much !!! you are a great help.

But I have a little problem what to put on the for each loop. Should I get class and connect the pin to the get actor of class node??

For me to give you the code, I need to know, which one of the 4 you want to kill.

How do you know?

No because this will already get your pawns, you don’t need to work that part.

But you need to know which pawn you can kill? I think?

So you can give that one the tag ‘killable’, then you can say:


You see, if finds all the pawns with the tag ‘killable’ and destorys them. That’s what you can do with tags, among many other things…