Quote:
Originally posted by lordhelmut
if(timeout){
if (random(1,40)<3) this.fdir=int(random(0,4));
if (this.fdir==0 && !onwall(x+2,y-.1)) y-=this.speed;
if (this.fdir==1 && !onwall(x-.5,y+1.5)) x-=this.speed;
if (this.fdir==2 && !onwall(x+2,y+3.1)) y+=this.speed;
if (this.fdir==3 && !onwall(x+4.1,y+1.5)) x+=this.speed;
|
for this, instead of !onwall(x,y), why not use onwater(x,y) ?
Not sure if this will work, since i havn't tested it... :P
Gohan
*edit*
I didn't see that last part, but you can also add:
NPC Code:
if(!onwater(x,y)) { x=this.startx; y=this.starty; }
or better yet, make it go to the closest place where there is water. Ex: water is to the south:
NPC Code:
for(this.wc=0;!onwater(x+2,y+.1);this.wc++) {y+=this.speed}
Not sure...but just trying...