hi,
I've got a key as a inventory item and i got a locked door. I only want to open the door when the inventory is used and nothing else. Can somebody please tell me how to do it please?
1. Create key inventory item
- right click inventory in navigation tree
- select Create new inventory item
- change name to iKey
2. Create an object in the room and name it oDoor.
- room edit
- select object from drop list
- right click on room background
3. Create a "use inventory on object" event handler function
- room edit
- click (lighting bolt icon in properties window
- click "use inventory on object"
- clcik "..." button
4. Edit event handler
- Add the following code
if (player.HasInventory(iKey)) {
// Unlock the door animation here
}
Most importantly, check player.ActiveInventory (http://www.adventuregamestudio.co.uk/manual/Character.ActiveInventory.htm).
Thanks Khris, I look everywhere for that and could't find the @$#% %$#!@ thing. :=
By all means use player.ActiveInventory instead of player.HasInventory().
Thanks for that, but it still won't work. The Output window box is saying' Parse error in expr near 'Cchar' when I put in the following code:
function hdoor1_UseInv() {
if (cChar1.ActiveInventory(iKey))
{Shaun.ChangeRoom(0)} ;
Please tell me where I'm going wrong?
if (cChar1.ActiveInventory == iKey)
Thanks alot, it works now.
thanks