E
Emberex
Guest
I have an enemy that follows a grid to a "target" unless the aggro is up enough, then it will chase the player. I made a weapon to hit the enemy and I want it to stop them from moving. This is what I tried:
But that isn't stopping them, they completely ignore it. What is the reason? here is the code to chase the targets/player:
GML:
zNear = instance_nearest(x,y,oZombie);
if(place_meeting(x,y,oZombie)){
with(zNear){
speed = 0;
}
instance_destroy();
}
Code:
if(zAggro <= 50){
if(instance_exists(oTarget)){
if(mp_grid_path(global.grid, path, x,y, pPosX,pPosY,1)){
path_start(path, zSpeed, path_action_stop,false);
}
}
///Checking for player if target does not exist
} else if (zAggro > 50){
if (instance_exists(oPlayer)){
if(mp_grid_path(global.grid, path, x,y, oPlayer.x,oPlayer.y,1)){
path_start(path, zSpeed, path_action_stop,false);
}
}
}