Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Sun 05/12/2010 18:13:54

Title: SOLVED: Disabling a Room
Post by: barefoot on Sun 05/12/2010 18:13:54
Hi

Im trying to disable a Room once you've been in it (can't go back in)... you don't have inventory so you can't use IfActiveInv or HasInv..etc

if (player.PreviousRoom==X) works when it should.. Then again it all happens from Room 4.

You have 5 rooms to visit so it won't really work.

Would it be best to use Regions on and off as each Room is done or is there an easier way?  if (player.PreviousRoom==X && if player.PreviousRoom==X) does NOT work!!

I'm searching for a solution in Manual and here..

cheers a lot

barefoot

Title: Re: Disabling a Room
Post by: Atelier on Sun 05/12/2010 18:53:20
I think you could do something like this.

if !(player.HasBeenInRoom(5)) player.ChangeRoom(5);


Damn. I could have sworn that function existed D:
Title: Re: Disabling a Room
Post by: barefoot on Sun 05/12/2010 19:12:47
Hi


UPDATE: Yes, this script works!

-----------------------------------------


I used this with ==1 which possibly means 'true'... Im going to run through it a few times with fingers crossed..


function region4_WalksOnto()
{
    if(HasPlayerBeenInRoom(6) ==1) {
    cChris.Say("Iv'e killed that fur critter in there");}

   else {
   Display("I hear something. I must find out what it is!!");
  cChris.ChangeRoom(6, 523, 466);
 }
}


cheers

barefoot
Title: Re: SOLVED: Disabling a Room
Post by: Khris on Mon 06/12/2010 01:03:14
Quote from: barefoot on Sun 05/12/2010 18:13:54Would it be best to use Regions on and off as each Room is done or is there an easier way?  if (player.PreviousRoom==X && if player.PreviousRoom==X) does NOT work!!

Just for reference, the mentioned line will obviously never be true because player.PreviousRoom holds a discreet value, i.e. can't be two different things at once. Using || (logical OR) will work though.
Title: Re: SOLVED: Disabling a Room
Post by: barefoot on Mon 06/12/2010 10:44:25
Hi

thank you Khris... knowledge is not always a deadly thing  :=

cheers

barefoot