[Solved] Stop the enemy when they arrive at their destination (pathfinding)

how can i make enemies stop for 2 seconds after arriving at destination?
I am using this code, initially it seems to work but then when the player is seen by the enemies he stands still and does not restart, it is probably “trigger once” in the actions that only manages the timer once.

I’d try the following, using the new Wait for X seconds action :

1 Like

I did not know this action I tried your advice … it looks good even if the enemies I think wait even more than two seconds, do you think it is correct to apply the Boolean variable on the true and immediately after the movement make it false?

It’s just been introduced to the recent releases of GDevelop.

The wait will be 2 seconds. However, keep in mind you also have the Idle command, which is checked once a second by default. If the idle check happens just before the wait command reaches 2 seconds (most likely), then it may appear to be closer to 3 seconds.

Explanation - the idle check is made and, a fraction of a second later the wait is started. After 1 second, the idle is checked again, and the wait is a fraction from being 1 second. Next idle check is another second later, and wait is a fraction less than 2 seconds. so the it coninues waiting, After the 3rd idle check, the wait is a fraction before 3 seconds, and so the processing continues.

You can fix this by either

  1. by reducing the delay between idle checks (though I suspect this could impact performance).
  2. changing the wait to say 1.5 seconds. Then the delay will be much closer to 2 seconds.

No, the boolean change will happen after 2 seconds. Remember it’s 2 seconds from when the conditions are met.

Setting the boolean variable to false happens after 2 seconds - the wait command pauses just that event, then continues on once the waiting period has elapsed. All other events are unaffected by the wait command.

perfect now it’s clear to me.
thanks mr men