Thread: Shorten
View Single Post
  #24  
Old 01-31-2002, 07:39 AM
Gohan43331 Gohan43331 is offline
Registered User
Join Date: Jan 2002
Posts: 87
Gohan43331 is on a distinguished road
Send a message via AIM to Gohan43331
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...
Reply With Quote