RemoveWalkableArea not working in function room_Load

Started by FormosaFalanster, Wed 14/10/2020 11:54:09

Previous topic - Next topic

FormosaFalanster

hello, I have put a RemoveWalkableArea in the room_Load function yet the walkable area is still walkable. Note that the walkable area in question is located beyond the screen and character has to walk and scroll to reach it. It goes like this:
Code: ags

function room_Load()
{
  RemoveWalkableArea (2);
}


The Walkable Area ID is correct so I am not sure why the Area is still active when the game starts.

PS in fact I added a player.Say in the room_Load function just to see if it would work and it doesn't, it seems the room_Load doesn't work at all.

FormosaFalanster

Well that was fast, some awesome person helped me in the discord channel, so for anyone who finds this topic in the search function with the same problem, the solution is to use the Enters Room event in the properties of the room, which in code gives this:
Code: ags

function room_AfterFadeIn()
{
  RemoveWalkableArea (2);
}

Slasher

Lots of newbees do that so don't worry..

Always use the events panel if applicable...

Khris

That command should work perfectly fine in room_Load, the important thing is linking the function to the room events. Just creating the function won't work, AGS has to know to call it.

FormosaFalanster

Thanks for valuable advices guys. This game only has one room so it should be fine but I will keep this in mind for future projects.

SMF spam blocked by CleanTalk