Announcement

Collapse
No announcement yet.

How to make one enemy alert other enemies.

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

    How to make one enemy alert other enemies.

    So. This is defeating me.

    When I get within a certain distance of Enemy Type A, I want him to alert all of the enemy type B's within a distance (of say 2500). Upon receiving the alert they would change into combat mode and seek the enemy out.

    I've got a bool on Enemy Type A that sets to true whenever I get within the distance.

    Is there a way to do an object trace within a certain distance but in every direction? If I could do that, I could put it on Enemy Type B, and just check if Enemy Type A is the result of the trace, if so, check if that particular enemy's alert bool is true, and then change the behavior tree.

    If you have a better way of doing this, I'm all ears. Just trying to figure it out.

    #2
    I would try to get Every Actor of Class Enemy B and then check the distance between them and my Enemy A.

    If you have too many enemies B in your level that might be bad to do it that way so you could just add a sphere collision around your enemy A and store whatever enemies B come inside. All these enemies should be warned when wanted.

    You can also perform an action to check currently overlapped actor I believe.
    [Released] Multiplayer Combat Editor
    A-RPG Sacred Swords
    Auto-Chess Live Development
    Youtube Tutorials

    Comment


      #3
      Hello,
      This may help you : Get actors in range by Mhousse1247

      https://forums.unrealengine.com/show...l=1#post274398

      Comment


        #4
        Add a collision sphere to Enemy Type A and then whenever you get inside the distance simply get all the overlapping actors and loop trough them and set them to chase the player.

        Comment


          #5
          ^this sounds the simplest and lowest cost. Any chance you could flesh this out a little more? Do I create an array from OnEventBeginOverlap? Sorry I'm pretty new at this still.

          Comment


            #6
            The way I would do it is when type a starts chasing the player character loop through an array of type b's and if they are in range use the move to actor to make them chase the player character or move to the type a which ever you wanted.

            Comment

            Working...
            X