Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.