Change Visibility of Objects in other rooms

Started by Kyougi, Fri 20/03/2009 22:40:19

Previous topic - Next topic

Kyougi

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

Code: ags
set-globalint 1 1


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

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


But it doesn't work. Would anybody be able to tell me what am I doing wrong?

RickJ

The room script should probably look something like the following.   
Code: ags

// *** Room Script ***
if (GetGlobalInt(1) == 1) {
      oBossHouse.Visible = true;
}
else {
      oBossHouse.Visible = false;
}

Pumaman

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.

Kyougi

Thanks, guys, for your help. The scripts work perfectly now.

SMF spam blocked by CleanTalk