Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Kyougi on Fri 20/03/2009 22:40:19

Title: Change Visibility of Objects in other rooms
Post by: Kyougi on Fri 20/03/2009 22:40:19
Well, I'm working on a game to help practice using AGS and have ended up a point where I'm not sure what to do.

The player has a map screen that is displayed whenever the player leaves a location, and it asks them where they wish to go next. It's just a room with objects on it that represent the locations the player can travel to. What I'm trying to do is, when the player asks another character something in a dialouge, he'll get directions to a new location and have this reveal the object on the map screen that represents the place he just got directions to. I looked in the manual and decided to try and use Global Variables to control it. So, I created a Global Variable. It's type was set to Int and the starting value was 0. So then at the end of the dialouge option I put in

set-globalint 1 1

After that I went to the map screen room and, under "Before room fade in", put in

if (BossHouseOn == 1){
  BossHouse.Visible = true;}


But it doesn't work. Would anybody be able to tell me what am I doing wrong?
Title: Re: Change Visibility of Objects in other rooms
Post by: RickJ on Fri 20/03/2009 23:20:34
The room script should probably look something like the following.   

// *** Room Script ***
if (GetGlobalInt(1) == 1) {
      oBossHouse.Visible = true;
}
else {
      oBossHouse.Visible = false;
}
Title: Re: Change Visibility of Objects in other rooms
Post by: Pumaman on Fri 20/03/2009 23:27:47
set-globalint is obsolete, used by old versions of AGS. What you should have in your dialog script is:

  BossHouseOn = 1;

(remember to indent the line with a space so that AGS knows it's a scripting command).

Then, the script you put in the room should work correctly.
Title: Re: Change Visibility of Objects in other rooms
Post by: Kyougi on Fri 20/03/2009 23:30:06
Thanks, guys, for your help. The scripts work perfectly now.