Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 01/05/2004 20:48:33

Title: Problem with walkable area and door.
Post by: on Sat 01/05/2004 20:48:33
Howdy. I'm very new to AGS and I'm having a slight problem. I have a door object that swings open revealing a hallway when interacted with. The hallway is a walkable area, but my character can walk through the door even when it's closed. I'm just wondering how I could make the area behind the door not walkable until the door is open. Thanks in advance.
Title: Re:Problem with walkable area and door.
Post by: Farsight on Sat 01/05/2004 20:57:24
What you have to do is have one walkable area in front of the door that is turned on and behind the door is another walkable area which is turned off. When you open the door put some code or an interaction in to turn on the back walkable area and you are fine. Then you just turn on and off the walkable areas to get your effect. Hope it helps!
Title: Re:Problem with walkable area and door.
Post by: on Sat 01/05/2004 22:00:52
Hey. Thanks. I understand everything you're saying, but I have no idea how to do it. My scripting skills are very low.  :-\

Okay I made it so that when I interact with the door it runs a scipt and in the script i put:

RestoreWalkableArea(2); //2 being the number of the walkable area.

But my problem is I don't know how to start the game with the walkable area turned off.
Title: Re:Problem with walkable area and door.
Post by: Ishmael on Sat 01/05/2004 22:13:14
Player enters screen -> run script -> DisableWalkableArea

do check if the door is open, so you don't disable the wa when it is...
Title: Re:Problem with walkable area and door.
Post by: on Sat 01/05/2004 22:26:45
Quote from: TK on Sat 01/05/2004 22:13:14
Player enters screen -> run script -> DisableWalkableArea

do check if the door is open, so you don't disable the wa when it is...

I can't find anything that says "player enters screen". And what script would I put that in? The door object script? and Would I put it under "interact object"?

Nevermind. I got it. Sorry for being an idiot and thanks!
Title: Re:Problem with walkable area and door.
Post by: Ashen on Sat 01/05/2004 22:37:46
The command is RemoveWalkableArea(), not Disable, and the 'player enters screen' script is in the room script ('Settings' window, button with a red 'i').

You'll also need to put it in the object interaction, if you can close the door again.
Title: Re:Problem with walkable area and door.
Post by: Ishmael on Sat 01/05/2004 22:45:26
Player enter screen can be found in the room interactions, the I button in the room editor, I think. The Player enters screen (you can chooose either one, befofe fadein or after fadein, as it doesn't matter in this case) script would be:

if (isdooropen == 0) {
Ã, Ã, RemoveWalkableArea(1); // replace 1 with the correct wa number
}

and the object interaction code would be:

if (isdooropen == 0) {
Ã, Ã, // door opening animation/whatever code here
Ã, Ã, RestoreWalkableArea(1);
Ã, Ã, isdooropne = 1;
} else {
Ã, Ã, // door closing code here
Ã, Ã, RemoveWalkableArea(1);
Ã, Ã, isdooropen = 0;
}

and add to the start of the room script (the "{}" button in room editor):

int isdooropen;

that should work... hope I didn't miss anything.

----- EDIT -----

fixed it a bit, thanks Ashen.