Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: silverwolfpet on Sat 18/09/2010 20:46:28

Title: Need help with error (FollowingCharacter error - FIXED)
Post by: silverwolfpet on Sat 18/09/2010 20:46:28
Hello,

I spent one hour on this forum and looking through the help files and everything... basically, I've got all the information necessary to fix my error, but nobody says where or how should I use it.

Basically... I have a character John and a character Billy. John needs to follow Billy throughout the entire game, since the first room until the end.

I have only one room... I wrote  

cJohn.FollowCharacter(cBilly, 6, 9);

in the RoomScript.

It keeps giving me the error:

Parse error: unexpected 'cJohn'

The characters are named right. They both have walking animations, I just don't get it... why doesn't it work? Where do I have to write this? Or how?
Title: Re: Need help with error
Post by: GarageGothic on Sat 18/09/2010 21:09:27
A wild guess - you didn't actually put the script line inside a function, did you? You need to create a room event by clicking the "Events" icon (lightning bolt) in the room editor, then select the "First time enters room" event and click the "..." icon to open up the script editor. There you can then put your script line inside the newly created  room_FirstLoad() function.
Title: Re: Need help with error
Post by: cianty on Sat 18/09/2010 21:11:14
Hm... where exactly did you put the line?

Is it in the OnLoad function (that's why I would probably put as it is meant to be done as part of the initialization, isn't it)?

Is the line outside of any function? If so, put it in one of the room function and see if that works.

EDIT: Damn you, GarageGothic! ;)
Title: Re: Need help with error
Post by: silverwolfpet on Sat 18/09/2010 21:34:07
I put the line in the "Room Script".

I am using the latest version of AGS, so I can't find the lightning bolt... maybe that was in the old version, as I remember the "events" tab. The new version doesn't have it.

It is not written in any function... that's all there is to it, what I wrote in my previous post is exactly what is in the script. One single line.

What function do I have to use to get it to work? i want the character to follow the player every time he enters this room, not just on first load.
Title: Re: Need help with error
Post by: GarageGothic on Sat 18/09/2010 21:53:03
Quote from: silverwolfpet on Sat 18/09/2010 21:34:07I am using the latest version of AGS, so I can't find the lightning bolt... maybe that was in the old version, as I remember the "events" tab. The new version doesn't have it.

(http://img690.imageshack.us/img690/8339/eventicon.png)
Title: Re: Need help with error
Post by: silverwolfpet on Sat 18/09/2010 22:16:06
Thank you :) works fine now.