Announcement

Collapse
No announcement yet.

AI Controlled Pawns not activiating Trigger Box

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AI Controlled Pawns not activiating Trigger Box

    Hi,

    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.
    Attached Files

    #2
    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.
    Last edited by Pepeeee; 01-31-2017, 06:51 AM.
    Twitter | Multiplayer TopDown Survival Kit | Fog of War | Game Stats Kit

    Comment


      #3
      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.
      Last edited by Erasio; 01-31-2017, 06:35 AM.

      Comment

      Working...
      X