Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 05/06/2012 11:26:06

Title: Doors_open/close+item
Post by: on Tue 05/06/2012 11:26:06
I open this thread for coding assistance :)

What I cannot figure out by myself inside scripts...

-Player uses item on door/s inside a room (the door can be opened and closed)

I was able to use
Code (AGS) Select
function room_AfterFadeIn()
{
if (cEgo.PreviousRoom == 2) {
  cEgo.Walk (76,  114, eBlock, eWalkableAreas);
}
}


and
Code (AGS) Select
function room_LeaveLeft()
{
cEgo.ChangeRoom(2);
}


to make a room change. But I'd like to create a door that blocks the player and that can be opened and closed with a particular item.
Title: Re: My Coding Stuff
Post by: Arcangel on Tue 05/06/2012 11:42:13
Maybe this help a little.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=8265.msg101275#msg101275

need new walk area

RemoveWalkableArea (int areanum) // the player no pas this place

RestoreWalkableArea (int areanum)// player now have access to this place

with if

if toon have the (key or object) and use in the door they now open the door and RestoreWalkableArea(#) 

I use this in old practice with doors that need key to open and the toon no pass through doors and can't walk on some places...until have some item in inventory.
Title: Re: My Coding Stuff
Post by: NickyNyce on Tue 05/06/2012 11:50:37
Very old videos, but still effective. These two should help.

http://www.youtube.com/watch?v=jdOTF_ErXG0&feature=relmfu

http://www.youtube.com/watch?v=3LCiL1YCaWU&feature=relmfu
Title: Re: My Coding Stuff
Post by: on Tue 05/06/2012 12:37:33
Thanks, that's what I was searching for. I know there are lot of coding tricks that can make the script less heavy but I will be happy if I can do with some more passages :)
Title: Re: Doors_open/close+item
Post by: Khris on Tue 05/06/2012 16:19:19
Please make sure you're using the forum search first.
There must be dozens of threads already about how to create a locked door.

Did you look at Densmings video tutorials on youtube?
While all the verb handling is done in "any click" as opposed to different cursor events, all the other stuff still applies to pretty much any adventure game.
They cover pretty much all the basics extensively.