I think you're gonna have to programme it individually for each room.
And set a global bool variable for when the event is going.
Global Variable: MonsterFollowing = false;
Code: ags
Code: ags
Then remember to reset MonsterFollow = false when the whole thing is over.
There may be a more elegant way, but that's how I'd do it with my current AGS knowledge.
And set a global bool variable for when the event is going.
Global Variable: MonsterFollowing = false;
function pickup_object()
{
player.addinventory(iItem);
monster.visible = true; /// or however you plan for the monster to appear
monster.followcharacter(cEgo);
MonsterFollowing = true;
}
function leaves_right()
{
player.changeroom(2, x, y);
if (MonsterFollow == true)monster.changeroom(2, x, y);
}
/// in Room 2
function enters_room()
{
if (MonsterFollow == true)monster.followcharacter(cEgo);
}
Then remember to reset MonsterFollow = false when the whole thing is over.
There may be a more elegant way, but that's how I'd do it with my current AGS knowledge.