Locking A Room!

Started by Simon_Hill_2006, Tue 03/07/2007 15:10:44

Previous topic - Next topic

Simon_Hill_2006

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

Lt. Smash

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:
Code: ags

// script for Room: Repeatedly execute

if (player.InventoryQuantity[InventoryItem1Name]==1 && player.InventoryQuantity[InventoryItem2Name]==1 && ...)
 {
  hDoor.Enabled=true;
 }

Akatosh

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  ;))

Code: ags

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.

Lt. Smash

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.

Simon_Hill_2006

#4
hey could you tell me how i use these codes I'm new to this

thanks

Ashen

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.
I know what you're thinking ... Don't think that.


SMF spam blocked by CleanTalk