Yes it does change things. You should really not be checking and creating paths like that all the time. All that does is generate a new path from the CURRENT x/y position and force the instance to start it.So the instance starts the path, moves a few pixels, and then the next step it does it again, meaning that every step it moves a few pixels along a new path, which (of course) will not be a straightline as every step the path is being calculated form a point that is NOT aligned to the mp_grid.
You should really only do it every few steps or so, or when the previous path has been completed. Also you need to make sure that your instance with the code and that is going to follow the path, starts on the path start and ends on the path end. IE: If the end point of the path is NOT perfectly aligned with the mp_grid, a diagonal will be needed to get to it. This can be easily fixed by shifting the path after it has been defined by mp_grid_path.
@C_Pike: No! You have the wrong idea, I'm afraid. Look, you create an instance and assign it a path. That path is EMPTY and has no points on it yet. So, you then decide that you want the instance in (for example) an alarm event to go get the player. You would then have this (pseudo) code :
var xx, yy;
xx = obj_player.x;
yy = obj_player.y;
if mp_grid_path(grid, path, x, y, xx, yy) {start the path etc...} else alarm = 30;The thing is that even though the path WAS empty, and even though the if may return false, a path WAS GENERATED and placed in the path that was created in the create event. Basically, everytime you run the mp_grid_path function it generates a new path (it will even wipe any previous paths first) and assigns that path to the one you specify in the code. It doesn't matter if the solution (x,y to xg,yg) has been found or not, a path is still generated and assigned!
Does that clear this up for you?