Is there any way for a non-player character to reap the benefit of the AreaSpecificView setting of a walkable area? I want my NPC to follow the main character and change views as the main character does (i.e. using AreaSpecificView). I suspect I may need to use regions instead?
I've considered trying this myself, but possibly one way to do it would be to update the views based on the characters X or Y coordinates?
if ((cPlayer.x => cNPC.x) && (cNPC.x >= 50) && (cNPC.x <= 100))
{
cNPC.ChangeView(90);
}
//If the NPC is behind the player or next to them, and if the NPC's coordinates are between 50x and 100x, then update the NPC's view to view 90
Stuff like that?
You can get ID of Walkable area using GetWalkableAreaAt. It uses SCREEN coordinates so you must calculate ROOM coordinates using Viewports.
Like that:
if (GetWalkableAreaAt(cChar.x-GetViewportX(), cChar.y-GetViewportY()) == 1)
cChar.ChangeView(12);
Thanks Eastwing. That is a very logical approach and I don't know why I didn't think of that earlier. I had a brain fart!