Relevant bit:
PHP Code:
temp.h=10;//really it's the distance to the player
for(temp.v=0;v<h;v++){
temp.tx=v*(dx/h);
temp.ty=v*(dy/h);
// showpoly(0,{x+tx-1,y+ty-1,x+tx+1,y+ty-1,x+tx+1,y+ty+1,x+tx-1,y+ty+1});
showimg(0,x+tx-1,y+ty-1,"insomshotgun-icon.png");
//doesn't work on a GMAP:
if(onwall2(x+tx-1,y+ty-1,2,2)){
if(v<1){
temp.startedonwall=true;
//this.chat="Started on wall:";
}else{
this.chat=(this.chat@" and found one at "@(x+tx-1)@","@(y+ty-1)@" ("@((x+tx-1)%64)@", "@((y+ty-1)%64)@")");
if(startedonwall) v=-1;
else v--;
h=0;
}
}else if(v>0) temp.startedonwall=false;
}
if (v<this.r){
setTimer(2);
// message("Idle 2: v<this.r");
}else if (startedonwall){
setTimer(2);
// message("Idle 2: startedonwall");
//hurt the player or:
//glomp the ally happens on acquiretarget
}else{
temp.tt=(v*this.speed*0.5)+(hearts/20);
move tx,ty,tt,24;
setTimer(1+tt);
// message("Move "@1+tt);
}
Works fine on an inside level built with the default tileset, fails on an outside level built with the newtype tiledef.
Also it should be noted the NPC in question has dontblock(); and setshape 0 by 0, just to make sure it won't block itself.