Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: fiaschetta on Fri 05/05/2006 04:24:52

Title: NewRoom from...
Post by: fiaschetta on Fri 05/05/2006 04:24:52
I have 3 rooms 
One of them is connected with the others two (for example, room2) 
If i enter in room2 from room 1, the character says "Hi"   
if i enter in room 2 from room 3, the character says "Friend".. but the room3 have two possibility for enter in room 2 (for example, door1 and door2)..
Then, if i enter in room2 from room3 by door1 the char. says "friend one", but if i enter in room2 from room3 by door2 the char. says "freind two"...
How i do?
Title: Re: NewRoom from...
Post by: Scummbuddy on Fri 05/05/2006 04:49:43
You'll need to check out this property from the help file (since I don't know which version you're using):
-----------------
PreviousRoom property
(Formerly known as character[].prevroom, which is now obsolete)

read only int Character.PreviousRoom

Gets the room number that the character was previously in. If the character is still in the room that they started in, this will be -1. Otherwise, it will be the room number of the room that they were last in.
This is a read-only property. It is set automatically by ChangeRoom.

Example:

Display("EGO's previous room was %d.", character[EGO].PreviousRoom);

will display the EGO character's previous room.

-----------------
And now incorporate this into a "Before fade in" If statement. Check which room they came from, and allow for different spoken dialog.
Title: Re: NewRoom from...
Post by: Khris on Fri 05/05/2006 06:45:25
Shouldn't this go into the "after fadein"-statement?
Otherwise the game would appear to hang at a black screen until the player clicks the mouse.

I swear I'll scream if I have to read "How i do?" one more time... ;)
It's "How do I do that?".
Title: Re: NewRoom from...
Post by: fiaschetta on Fri 05/05/2006 19:49:05
Ok, but for enter in room2 from room3 i have two possibility (two doors);
If i enter in room2 from door1 the char. says "HELLO" but if i enter from door2 the char. says "Friend".

For now, my scrypt is:

if (character[TEQ].PreviousRoom == 18){
DisplaySpeech (TEQ,"Ciao");
}

Then don't exist the destinction between door1 and door2..
How do I do that? ( for Khris)
Title: Re: NewRoom from...
Post by: Ashen on Sat 06/05/2006 12:37:13
In that case, you can use the character's position in the room to distinguish between door1 and door2, e.g.:

if (player.PreviousRoom == 4) {
  if (player.x == 20 && player.y == 145) Display("Door 1"); // Or whatver coords they arrive at
  else Display ("Door 2");
}
Title: Re: NewRoom from...
Post by: fiaschetta on Sat 06/05/2006 17:31:40
Ok. gooooooo
Title: Re: NewRoom from...
Post by: Ashen on Sat 06/05/2006 18:24:33
Does that mean it works now, or is there something else?