PDA

View Full Version : FollowPlayer


ownerofbabylon
07-26-2001, 08:35 AM
How do you stop the command Followplayer? No one seems to know LOL

Lionel-Jonson
07-26-2001, 08:49 AM
LOL!

Silver Knight
07-26-2001, 09:07 AM
READ COMMANDS.RTF FOR ONCE!

It says something like: followplayer makes the npc follow player untill an x,y is specified.

richard
07-26-2001, 10:06 AM
<Shaun>

until the npc is thrown

</Shaun>

CyanideSR71
07-26-2001, 10:33 AM
set it's x and y coordinates

ownerofbabylon
07-26-2001, 08:32 PM
Alright, well how would I detect what x any y it is at now and then make it so it stays there and changes back to the idle.gif?? Here is what i tried:

if(created){
setimg zen1kuros1.gif; //the idle gif
}
if(playerchats&&strequals(#c,come)){
followplayer;
set following;
}
while (following) {
if(playerdir==0){
setimg zen1kuros6.gif;
}
if(playerdir==1){
setimg zen1kuros7.gif;
}
if(playerdir==2){
setimg zen1kuros5.gif;
}
if(playerdir==3){
setimg zen1kuros8.gif;
}
if (playersays(stop)) {
this.x=x;
this.y=y;
setimg zen1kuros1.gif,x,y;
}
sleep 0.05;
}

How can I change this so that It knows its X and Y and stays there which would cause it to change back to the idle image and to stop following player??

CyanideSR71
07-26-2001, 08:56 PM
Okay, first I believe that followplayer only works offline...

x=x;
y=y;
May work...
That or x+=0.05 or something like that.

ownerofbabylon
07-26-2001, 11:03 PM
what!?!?! Followplayer only works offline? :(

Would it be hard to script it so that a NPC follows and does all the stuff in the script about accept it looks like followplayer accept scripted??

ownerofbabylon
07-26-2001, 11:04 PM
BTW, Thanks Cyanide

konidias
07-26-2001, 11:52 PM
*cough* bomy pets follow player and are online *cough*

But thats coded out, it isn't just "followplayer" I have made scripted following npcs before.. I could give it a try and make an example if you want me to.

Komieko
07-27-2001, 12:14 AM
Konidias he means the actual command follow player cannot be used online.Bomy pet's use wa more complicated then followplayer -_-

IceHawk
07-27-2001, 12:32 AM
Merlin:
what if you do like
while (flag) {followplayer;}

while (!flag) { }

kyle0654
07-27-2001, 12:54 AM
Followplayer won't work online, and I believe it might be taken out soon. It's nothing more than a seeking script though. If you can make 'heat-seeking' missiles (or arrows) in graal then you can make a followplayer script.

There's a few ways you can do it: one just moves x/y using a a set speed toward the correct position depending on if the x/y is greater or smaller than the current x/y. Another way is to use trig and find the exact angle to move at...though harder, it's usually more accurate and can have a nice effect. The third way is to just make an array of positions the object being followed has been in, and put the following object in those positions.

Bomies use the third method. It's pretty easy to pick out which method is being used. If you use arrays the path will go where you've been. If you use trig it will go straight toward where you are (see: boomerang). The first method will look kinda blocky...and either x or y will level out first and the NPC will walk in a straight line. You can usually tell how much effort is put into a following script by observing how it follows ;)

There's a fourth method of course...a more advanced version of the trig one...that uses pathfinding to go around objects instead of going through them...but that's a hard one to get down...I've only seen a couple people come close to doing it effectively...

konidias
07-27-2001, 01:16 AM
Originally posted by Komieko
Konidias he means the actual command follow player cannot be used online.Bomy pet's use wa more complicated then followplayer -_-

Uhh Komieko.. thats what I said -_-;

LiquidIce00
07-27-2001, 06:08 AM
I believe there is a npc tutorial on the G2k1 site about making baddies. They have a few player following scripts.

ownerofbabylon
07-27-2001, 06:43 AM
Originally posted by kyle0654
Followplayer won't work online, and I believe it might be taken out soon. It's nothing more than a seeking script though. If you can make 'heat-seeking' missiles (or arrows) in graal then you can make a followplayer script.

There's a few ways you can do it: one just moves x/y using a a set speed toward the correct position depending on if the x/y is greater or smaller than the current x/y. Another way is to use trig and find the exact angle to move at...though harder, it's usually more accurate and can have a nice effect. The third way is to just make an array of positions the object being followed has been in, and put the following object in those positions.

Bomies use the third method. It's pretty easy to pick out which method is being used. If you use arrays the path will go where you've been. If you use trig it will go straight toward where you are (see: boomerang). The first method will look kinda blocky...and either x or y will level out first and the NPC will walk in a straight line. You can usually tell how much effort is put into a following script by observing how it follows ;)

There's a fourth method of course...a more advanced version of the trig one...that uses pathfinding to go around objects instead of going through them...but that's a hard one to get down...I've only seen a couple people come close to doing it effectively...

Holy ****! I wish I was smart enough to know all that =\ Oh well. If you could give it a try konindias I would appreciate it. A lot of people have tried and cant. =\ If you can I would like to know how. I hate asking for scripts but i dont consider this a script seeing as how I posted the script I made and I just need it fixed. Thanks again Kyle and Konindias for the help.

CyanideSR71
07-27-2001, 09:53 AM
Holy crap!
I understand what Kyle is talking about... That's scary.

ownerofbabylon
07-27-2001, 09:57 AM
Not really cuz ur a good scripter too

kyle0654
07-27-2001, 10:22 AM
there's also the move-method...I think you could do it using the move command...I dunno, that might be worse than doing some of the others though...

grim_squeaker_x
07-27-2001, 05:56 PM
Originally posted by kyle0654
there's also the move-method...I think you could do it using the move command...I dunno, that might be worse than doing some of the others though... I think the move command would be better on the NPC Server when it comes to making the following movement look more normal, at least with the movement command you can make it look like the NPC walks two times 0.5 instead of 1 at the same time while walking the same distance (Due to the timeouts of 0.1 seconds the NPC Server uses)

Oh and probably move playerx,playery,time,type; would work, it's just that the NPC would ignore walls :rolleyes: