Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Stranga on Sat 04/02/2017 13:25:16

Title: Check which Walkable Area ID the players on [SOLVED]
Post by: Stranga on Sat 04/02/2017 13:25:16
Hello everyone.

I'm not sure if there is such a way to do this, but is there a way to check which walkable area ID the player is on or is active? I'm trying to create a mechanic that will deactivate certain hotspots when the player is on one of the walkable area IDs. If there is no way of checking, can this still be achieved in some way?
Title: Re: Check which Walkable Area ID the players on
Post by: Kumpel on Sat 04/02/2017 13:36:54
If you just want something to happen on some area, thats what regions are for. If you also need to deactivate some paths (so the player can't walk there), you could create identical regions and walkable areas and code in that specific regions function, that if the player is standing on this region, some walkable area is removed or restored with RemoveWalkableArea(ID)/RestoreWalkableArea(ID).
Title: Re: Check which Walkable Area ID the players on
Post by: Stranga on Sat 04/02/2017 13:43:12
Thank you Kumpel. I will research more into regions and see if I can come up with something.
Title: Re: Check which Walkable Area ID the players on [SOLVED]
Post by: Crimson Wizard on Sat 04/02/2017 14:15:53
To answer the question directly, if you still need that, function to get walkable area at certain point is: GetWalkableAreaAt(int x, int y)
I am not sure if there is a way to know if it's enabled or not. But with regions solution that Kumpel suggested, you may use combination of walkable area and region checks to achieve what you want.

EDIT: by the way, it may be possible that GetWalkableAreaAt does not find area if it was disabled. I do not remember how that works tbh.