Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   here is a follow code (https://forums.graalonline.com/forums/showthread.php?t=8218)

LiquidIce00 07-27-2001 09:08 AM

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];
}
}


Brady2 07-27-2001 09:25 AM

Jadis:

Ok why don't you use the very good one Stefan made?

LiquidIce00 07-27-2001 09:36 AM

Quote:

Originally posted by Brady2
Jadis:

Ok why don't you use the very good one Stefan made?

Because people were asking and I think that his had some npc server only stuff in it.

ownerofbabylon 07-27-2001 09:55 AM

Wow man thank you sooo much. I have been working over 4 hours trying to make just that and I cannot do it =\ This is vital to the script im making and I couldnt do it without it. Thanks again :D

BTW, does the one Stefan made work on free servers??

ownerofbabylon 07-27-2001 09:56 AM

hmm where in that script would I add in the code so if the player faces left it shows left.png and right is right.png and so on???

LiquidIce00 07-27-2001 11:06 AM

Quote:

Originally posted by ownerofbabylon
hmm where in that script would I add in the code so if the player faces left it shows left.png and right is right.png and so on???
showimg part.
but if you are doing it with ganis then you will not do showimg. You will change x=orbx[1] and y=orby[1]
but it doesnt have onwall and also it has a few bugs. I just make it quick like I said ;)

ownerofbabylon 07-27-2001 12:03 PM

yea im doing setimgpart but i meant where would i put it in that script???

LiquidIce00 07-27-2001 02:34 PM

Quote:

Originally posted by ownerofbabylon
yea im doing setimgpart but i meant where would i put it in that script???
in that function..

LiquidIce00 07-27-2001 02:46 PM

Btw, I might actually turn this into something, and since I am a nice person and I always like to post code I'll post that.

entravial 07-27-2001 02:54 PM

the onwall and non-p2p canwarp equivalent will be the hardest part

LiquidIce00 07-27-2001 03:00 PM

Quote:

Originally posted by entravial
the onwall and non-p2p canwarp equivalent will be the hardest part

nonp2p warp doesnt really work. it will just be a player weapon that keeps showing img . it will be easy tho because all I have to do is do like a weapon fired when playerenters.

onwall is complicated yeah. I like making birdies cuz then no onwall =)

entravial 07-27-2001 03:15 PM

why would stefan put followplayer online and not offline?

entravial 07-27-2001 03:16 PM

i mean offline not online hehe

LiquidIce00 07-28-2001 01:41 AM

maybe he was going to make an online version but never did..

Poogle 07-28-2001 12:46 PM

You always want to make worthless threds dont you?

LiquidIce00 07-28-2001 01:44 PM

Quote:

Originally posted by Poogle
You always want to make worthless threds dont you?
okay dont talk
you havent said 1 smart thing yet ... and it was so worthless it actually helped someone..

Tyhm 07-28-2001 01:46 PM

I heard because A) It's tricky in multiplayer (which player does it follow? Only the leader? What happens to the second guy, is he SOL?) and B) Lamp of Salvation

LiquidIce00 07-28-2001 01:48 PM

Quote:

Originally posted by Tyhm
I heard because A) It's tricky in multiplayer (which player does it follow? Only the leader? What happens to the second guy, is he SOL?) and B) Lamp of Salvation
well i just gave a buggy base.. just to get started x.x but i would make it follow by account name .. and B?!?!?!?!


All times are GMT +2. The time now is 11:24 AM.

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