different character conversations & functions per room

Started by frybread, Wed 28/08/2013 10:19:57

Previous topic - Next topic

frybread

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?

Crimson Wizard

Yes, you can simply switch between two (or more) code branches depending on the room character in:

Example:
Code: ags

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");
}

frybread

Thank you so much!  I'm making this game as a gift, and really appreciate the work you do to make it possible.

SMF spam blocked by CleanTalk