Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Mon 29/08/2005 00:55:45

Title: if in room 1, then do this, otherwise do nothing
Post by: on Mon 29/08/2005 00:55:45
I am trying to make an object appear if the player uses an inventory item in room 1.  That works fine.  But if the player uses the inventory item in another room then i get an error because the object is not in the other room.  How would the script look if i wanted the object to appear only in room1 when the inventory item is used.
Title: Re: if in room 1, then do this, otherwise do nothing
Post by: monkey0506 on Mon 29/08/2005 01:33:13
You can use the Character.Room property to test it:

/* if player used inventory item */
if (player.Room == 1) { /* if the player is in room 1 */
  /* turn object on and do stuff */
  }
else {} /* otherwise, do nothing */

If you are using AGS 2.62 or earlier, you would have to replace player with character[GetPlayerCharacter()].  I hope this helps. :=
Title: Re: if in room 1, then do this, otherwise do nothing
Post by: on Mon 29/08/2005 03:28:07
Cool, thanx alot!