View Single Post
  #19  
Old 09-01-2001, 04:38 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
here i didnt actually test this i just put on graal and clicked style and test to debug it but its just a base of what I was saying (prolly buggy) and i didnt do it using showcharacter either..
NPC Code:

// NPC by LiquidIce

this.maxstep = 5; //step length

if (playerenters&&isleader) {
init();
timeout=.1;
}

function init() {
setarray stepx,this.maxstep+1;
setarray stepy,this.maxstep+1;
for (this.i=0;this.i<this.maxstep;this.i++) {
stepx[this.i]=x;
stepy[this.i]=y;
}
}

if (timeout) {
if (stepx[0]=0||stepy[0]=0) {
randomstep();
}
else {
move();
movearray();
}
timeout=.1;
}

function move() {
x=stepx[0];
y=stepy[0];
}

function movearray() {
for (this.i=this.maxlength;this.i>=0;this.i=this.i-1) {
stepx[this.i]=stepx[this.i-1];
stepy[this.i]=stepy[this.i-1];
}
}

function randomstep() {
this.angle=random(0,6.28);
this.effect=random(-.2,.2);
for (this.i=0;this.i<this.maxstep;this.i++) {
this.x=sin(this.angle);
this.y=cos(this.angle);
if (this.i=0) { this.x+=x-.5;this.y+=y-.5; }
else {
this.x+=stepx[this.i-1]-.5;
this.y+=stepy[this.i-1]-.5;
}
if (onwall(this.x,this.y)) {
break;
}
stepx[this.i]=this.x;
stepy[this.i]=this.y;
this.angle+=this.effect;
}
}

__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 09-01-2001 at 10:03 AM..
Reply With Quote