how to determine if a character is in the room

Started by Blondbraid, Tue 02/06/2015 19:43:34

Previous topic - Next topic

Blondbraid

How can I use the script to make an interaction play out differently depending on weather a certain npc is in the room?
Long story short, if the player clicks on a door while the character is in the room they will not allow the player to use the door,
but if the character isn't in the room, the player can use the door. I have everything else worked out, except which script command
to use in order to determine whether the npc is in the room.


Snarky

It's one of those things that is mystifying until you see it, and then it's obvious:

Code: ags
if(cCharacter.Room == player.Room)
{
  // Do stuff
}


(Assuming the NPC in question is called cCharacter)

Blondbraid

I tried it, and it worked.
Many thanks for your help!


SMF spam blocked by CleanTalk