Thread: Follow Player
View Single Post
  #8  
Old 12-30-2001, 04:50 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
NPC Code:

if (playerenters&&!isweapon) { toweapons test; }
if (weaponfired) { timeout=.1; }
if (timeout) {
//here we say if the length of the array
//of stepx is 0 we need to make it an array
if (arraylen(stepsx)=0) { init(); }
if (playerx!=stepsx[0]||playery!=stepsy[0]) {
movearray();
record();
}
show();
timeout=.1;
}
function init() {
//here we set the stepsx array to 5
//remember it only goes up to 4
//since it starts at 0
setarray stepsx,5;
setarray stepsy,arraylen(stepsx);
}
function movearray() {
//here we move the array
//we start at 4 and we go
//to 1 , everytime moving it back one.
//for example if stepsx[3] is 3 and stepsx[2]
//is 4,
//it will set stepsx[4] to 3 and stepsx[3]
//to 4 and so on
for (this.i=arraylen(stepsx)-1;this.i>0;this.i--) {
stepsx[this.i]=stepsx[this.i-1];
stepsy[this.i]=stepsy[this.i-1];
}
}
function record() {
//record current player position to 0
stepsx[0]=playerx;
stepsy[0]=playery;
}

function show() {
showimg 1,shadoworb.gif,stepsx[arraylen(stepsx)-1],stepsy[arraylen(stepsy)-1];
}

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

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote