How do I Make my AI Stand Still?

0 favourites
  • 2 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • When my AI enemy sees the player or their teammate, I want them to stay in one spot, not move, and shoot at the player. During this shooting period, the AI's state is called "FIRE." But instead of staying still, the AI moves toward the player because it's rapidly switching states instead of staying in the "FIRE" state.

    I suspect the problem lies right here

    Here is also the code for entering the firing mode

    And here is a video of my problem youtu.be/zhahEBQQ1qo

    Any and all help is appreciated!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You might need to add "For each Enemy" as the second condition in event 133. So the event should look like this:

    Enemy current state="Fire"
    For Each Enemy
    Enemy nas NO LOS to BlueTeam
    

    If this doesn't help, add some debug logging to events 133-136 to see if and when they are triggered. Use "Browser Log" action.

    Also, if you want a random integer number between 1 and 3, don't use round() expression, it will return value 2 more often than 1 and 3.

    The correct expression is int(random(1,4)) or choose(1,2,3)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)