Making characters follow you.

Started by Swordwielder, Mon 16/02/2009 21:17:42

Previous topic - Next topic

Swordwielder

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?

Trent R

From the manual:
Character.FollowCharacter(Character* chartofollow, optional int dist, optional int eagerness)

Code: ags

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Swordwielder

I typed in exactly what you said to type.
{
cElizabeth.FollowCharacter(cDavy, 10, 0);
}
Then this happened:
Error(line 437): Unexpected '{'.
Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Pumaman

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.

Dualnames

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.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk