AI Controlled Pawns not activiating Trigger Box


I have a group of AI’s that are supposed to activate a TriggerBox. When they are spawned within the box, the BP (see attached) works fine, however when they are spawned elsewhere and they overlap the Trigger nothing happens.

Are you sure this works? I guess PrintString is called maximum once. And I would expect Accessed None trying to … errors.

At first please don’t ever use GetDisplayName for anything like this. Better would be GetObjectName because that is guaranteed to return the same in editor and in packaged builds but that wouldn’t be a good solution aswell. If you’d ever decide to change the name of your class you would notice very strange bugs. So for example better use GetClass and test if that’s == TypeA_Camper class.

In addition you should increment IntA (I assume it’s default value is 0) after accessing the respective array element. Each array starts with an element at index 0, not 1.

Btw is there a reason why you don’t just test if OtherActor’s class == TypeA_Camper class? What you’re doing seems overly complicated for me. You’re kind of relying that GetOverlappingActors returns an array in the same order your pawns are entering the box, I don’t think that’s guaranteed.

I can’t quite see what you compare the display name with. But your branch at the end can at most succeed once.
DisplayName is the unique name of objects.

Let’s say you have an AI class that’s called “AI”.
The displayname of the first one spawned will be “AI”.
The second one will be called “AI2”. The third one “AI3”, etc.

Display name is unique to be able to absolutely differentiate between actors.

You are already filtering by that one single class.

So I would suggest using a “IsValid” node instead of your branch. This will check if the overlapping thing is of the type you filter or not (which is what I assume you’re trying to do with the display name comparison).

Or if you need the name. Use “GetClass” -> “GetDisplayName”. The class will always be the same for all actors of that class and so will the display name. Different to the actor instance which will have increasing numbers attached to that name.

Edit: Good reply by Pepeeee too.

Comparing “Other Actor” with the class you want directly should be the proper way to do what you’re trying to do here.