Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Swordwielder on Mon 16/02/2009 21:17:42

Title: Making characters follow you.
Post by: Swordwielder on Mon 16/02/2009 21:17:42
I have a character and he has a girlfriend he talks to her and she says she wants to go to a cave. How do I make her follow him?
Title: Re: Making characters follow you.
Post by: Trent R on Mon 16/02/2009 21:40:13
From the manual:
Character.FollowCharacter(Character* chartofollow, optional int dist, optional int eagerness)


cGirlfriend.FollowCharacter(player, 10, 50)
Will make the girlfriend follow the player, about 10 pixels away, and a little bit before deciding to follow again. Just tweak those two values until you like what you get (read the manual first to see what they each do)


~Trent
Title: Re: Making characters follow you.
Post by: Swordwielder on Mon 16/02/2009 22:10:26
I typed in exactly what you said to type.
{
cElizabeth.FollowCharacter(cDavy, 10, 0);
}
Then this happened:
Error(line 437): Unexpected '{'.
Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Making characters follow you.
Post by: Pumaman on Mon 16/02/2009 22:59:19
Where did you type that code? You need to tell AGS when you want it to run your command, so you need to choose the right event in the editor (eg. the Talk To Character event for the girlfriend) and put the code in there.
Title: Re: Making characters follow you.
Post by: Dualnames on Wed 18/02/2009 08:03:20
Quote from: Pumaman on Mon 16/02/2009 22:59:19
Where did you type that code? You need to tell AGS when you want it to run your command, so you need to choose the right event in the editor (eg. the Talk To Character event for the girlfriend) and put the code in there.


{
cElizabeth.FollowCharacter(cDavy, 10, 0);
}

He typed this..remove the { and } and everything should be fine.