Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: frybread on Wed 28/08/2013 10:19:57

Title: different character conversations & functions per room
Post by: frybread on Wed 28/08/2013 10:19:57
I'm sure this has been answered before, but I've googled & searched with no luck.

I have the same characters (cats!) traveling through different rooms, and I'd like them to meow differently to one another depending on the room.  There are also certain inventory items that should only work on the cats in certain rooms.

I've noticed that all character interactions are in the global script, and I can't get them to work in the room script.  Is there a way to tell the global script to only do something in certain rooms?
Title: Re: different character conversations & functions per room
Post by: Crimson Wizard on Wed 28/08/2013 10:39:33
Yes, you can simply switch between two (or more) code branches depending on the room character in:

Example:
Code (ags) Select

if (cCharacter1.Room == 1)
{
   cCharacter1.Say("I am in the first room");
}
else if (cCharacter1.Room == 2)
{
   cCharacter1.Say("I am in the second room");
}
else
{
   cCharacter1.Say("I am in some completely different room");
}
Title: Re: different character conversations & functions per room
Post by: frybread on Wed 28/08/2013 21:11:21
Thank you so much!  I'm making this game as a gift, and really appreciate the work you do to make it possible.