Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Simon_Hill_2006 on Tue 03/07/2007 15:10:44

Title: Locking A Room!
Post by: Simon_Hill_2006 on Tue 03/07/2007 15:10:44
I was just wondering if there is any way to lock a room until a certain item or centian items are found please help !!

Thanks Simon
Title: Re: Locking A Room!
Post by: Lt. Smash on Tue 03/07/2007 15:56:24
I don't think that you can lock a room but you could check if the player has these items and then enable the hotspot (or whatever you use for changing the room).

It would look like this:

// script for Room: Repeatedly execute

if (player.InventoryQuantity[InventoryItem1Name]==1 && player.InventoryQuantity[InventoryItem2Name]==1 && ...)
{
  hDoor.Enabled=true;
}
Title: Re: Locking A Room!
Post by: Akatosh on Tue 03/07/2007 16:14:07
Or rather, put this script in where you want the room change to be triggered (e.g. "Any click on hotspot", although I wouldn't recommand that  ;))


if (GetGlobalInt(1)==1) //your conditions
  player.ChangeRoom(2,5,17); //Put the room change here

else
  player.Say("I can't go there right now!"); //what you want to happen if the conditions are not met


As easy as pie. Easy pie.
Title: Re: Locking A Room!
Post by: Lt. Smash on Tue 03/07/2007 19:05:13
You are right, Akatosh. It's better to use the click feature for hotspots, cause then the door is also clickable, when you haven't the items you need.
Title: Re: Locking A Room!
Post by: Simon_Hill_2006 on Tue 03/07/2007 20:05:25
hey could you tell me how i use these codes I'm new to this

thanks
Title: Re: Locking A Room!
Post by: Ashen on Wed 04/07/2007 00:06:39
They pretty much HAVE told you how & where to use them...

Quote from: Lt. Smash
// script for Room: Repeatedly execute
Quote from: Akatosh
put this script in where you want the room change to be triggered (e.g. "Any click on hotspot"

You need to add a 'Run script' interaction in the Interaction Editor. After that, you can insert the code as Lt. Smash and Akatosh suggest.

Let us know if you have ay specific problems after that.
Title: Re: Locking A Room!
Post by: Simon_Hill_2006 on Wed 04/07/2007 13:33:00
thanks