Legacy GM MP Grid Path Finding - get stuck at corners

W

WorshipTheKing

Guest
Hello GM Community,
I have a problem with mp grid path finding. My grid size is 8 by 8 and I even placed my walls according to this grid, but often the ai gets stuck at corners or in walls if the path is too near to a corner or the destination too close to a wall.
I already decreased the size of the mask but it did not help.
Can you help me solve this problem?

Thank you in advance!
Have a nice day :)
 
if the path is too near to a corner or the destination too close to a wall.
Sounds like your best bet is to only have the AI pathfind to the center of tiles. If getting EXACTLY to where the destination is located is really important, then have the AI pathfind to the center of the nearest tile, then use a secondary routine to move from there to the exact destination.
 
R

Robert

Guest
Probably the easiest thing would be to add collisions to the enemies with the walls, and then in the collision event you can just say move_contact_solid(point_direction(x,y,other.x,other.y),1); to get them apart. Depending on which object you add the collision code to you might need to swap the point_direction arguments to other.x,other.y,x,y, but basically thats all you need to do. In short your just saying whenever the enemy collides with the wall to move them outside of the wall.
 
I

icuurd12b42

Guest
set the sprite index to -1 before calculating the path. this way the size of the object should not matter. this assuming you are getting stuck because mp_grid_path returns false and not stuck from you movement system
 
Top