View Single Post
  #1  
Old 07-27-2001, 09:08 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 is a follow code

Not the best, but something I just made quickly for the people who have been asking how to make an online follow player.

I still like the way that bomies follow (always stay behind the player)
this one just moves up/down/left/right according to the player.

Also , why is it that when I set array it doesnt work ? Am I doing something wrong or is Graal array just weird?
NPC Code:

// NPC made by LiquidIce - Buzy liek always
//Following Orb

//this sets how fast the timeout goes
this.speed=.15;

if (playertouchsme) {
toweapons Pet Orb;
}

if (weaponfired) {
//setarray orbx,7;
//setarray orby,7;
this.a=0;
while (this.a<7) {
this.a++;
orbx[this.a]=playerx+1.5-(vecx(playerdir)*2);
orby[this.a]=playery+2-(vecy(playerdir)*2);
}
timeout=this.speed;
}

if (timeout) {
follow();
movearray();
setarray();

timeout=this.speed;
}

function setarray() {
if (playerx>orbx[6]&&playerx-orbx[6]>2) {
orbx[7]=orbx[6]+.5;
}
if (playerx<orbx[6]&&orbx[6]-playerx>2) {
orbx[7]=orbx[6]-.5;
}
if (playery<orby[6]&&orby[6]-playery>2) {
orby[7]=orby[6]-.5;
}
if (playery>orby[6]&&playery-orby[6]>2) {
orby[7]=orby[6]+.5;
}
}

function follow() {
showimg 100,shadoworb.gif,orbx[1],orby[1];
}

function movearray() {
this.i=0;
while (this.i<6) {
this.i++;
this.test=this.i+1;
orbx[this.i]=orbx[this.test];
orby[this.i]=orby[this.test];
}
}

__________________
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