Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rocky_Johan on Sun 29/08/2021 18:00:14

Title: Turning walkable areas on and off depending on objects.
Post by: Rocky_Johan on Sun 29/08/2021 18:00:14
Hey!
Total newbie here so sorry for asking this.
Been reading trough the manual but i still can't figure out the correct coding for this and i have been stuck for weeks so  i'm finally buckling down and asking the forum.

I have my main character walking into the library where he picks up some books. He has to show a library card to the librarian in order to be able to leave.
Otherwise the librarian stops him. Classic Point & click stuff.

I have the room edge as a separate walkable area that is turned of as soon as you pick up any of the books and is then turned on as soon as you give the card to the librarian but i can't get it to work correctly.

Can someone go trough the coding for this as thoroughly as possible?
Please explain it to me like i was a complete idiot :)

Thanks!
Title: Re: Turning walkable areas on and off depending on objects.
Post by: Khris on Mon 30/08/2021 11:55:31
You can make this work using walkable areas and room edges but this is a perfect use case for a Region.
Draw a region near the exit, then use the region's "player walks onto" event.

Now, depending on what is easier, either
a) check the "is able to leave" condition in the event's function and make the player walk back if they aren't allowed to leave

or
b) disable/enable the region based on what the player does and always stop them when they step on it