Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mats Berglinn on Thu 17/02/2005 21:08:15

Title: Make characters stop following the main character
Post by: Mats Berglinn on Thu 17/02/2005 21:08:15
I have looked in the manual for AGS but I can't find a way to stop the characters from following the main-character. The manual says "Pass CHARTOFOLLOW as -1 to stop the character following." but I can't find that anywhere, nor can I find a code to make the characters stop follow.

Can anyone, please, help me?
Title: Re: Make characters stop following the main character
Post by: strazer on Thu 17/02/2005 21:21:54
If you did
  FollowCharacter(MAN, EGO);
just do
  FollowCharacter(MAN, -1);
Title: Re: Make characters stop following the main character
Post by: Mats Berglinn on Thu 17/02/2005 21:29:36
Thanks!
Title: Re: Make characters stop following the main character
Post by: strazer on Thu 17/02/2005 21:36:01
You're welcome. :)
Title: Re: Make characters stop following the main character
Post by: WHAM on Tue 22/05/2007 19:04:34
Sorry to wake up this old hag here, but it was the only thread I could come up with my searches that seemed appropriate.

I used the script given above to stop the following, but it has one minor setback. For some reason the NPC who was supposed to stop following the main character, appears to every room the main character is in, only late, and as his view is set to lying down in a pool of blood, hes there, at the door, lying in a pool of blood... Ideas?


if (player.x < cAi3.x) {
cEgo.Animate(8, 5, eOnce, eNoBlock);
cAi3.Animate(8, 5, eOnce, eBlock);
SetGlobalInt(22, 1);
cAi3.FollowCharacter(player, -1);
}
Title: Re: Make characters stop following the main character
Post by: strazer on Tue 22/05/2007 19:15:09
The script language has changed since my last answer.
The function is no longer stand-alone, no longer requiring you to specify both characters as parameter.
Instead, the function is now part of one character and needs you to specify the character to follow (or not).

So instead of
  FollowCharacter(AI3, EGO);
do
  cAi3.FollowCharacter(null); // tell cAi3 to follow noone

The function has other, optional parameters which is why you didn't get a compile error with the -1.

Please check the manual first on how to use the new functions to avoid these kinds of problems in the future.
Title: Re: Make characters stop following the main character
Post by: WHAM on Tue 22/05/2007 19:25:07
Thanks! This'll be a big help in the future too.
Title: Re: Make characters stop following the main character
Post by: Ashen on Tue 22/05/2007 20:02:56
Quote from: strazer on Tue 22/05/2007 19:15:09
Please check the manual first on how to use the new functions to avoid these kinds of problems in the future.

Indeed. For future reference, this IS mentioned in the Manual Entry (http://www.adventuregamestudio.co.uk/manual/Character.FollowCharacter.htm).