Multiple Keys for a door

Post » Wed Jul 27, 2011 4:18 pm

I am pretty new to modding and scripting, so I wanted to see if this would be possible, and if anyone may have some guidance.

I want to create a door that will only open if the player has three specific items in his inventory. Now these can either be keys, rings, misc items, not sure if it matters.

Anyway, if the player doesn't have all three, I would like a message to be displayed, stating what is missing.

If the player has all three, then a message is displayed stating what is happening (you insert the items into the door kind of thing), the door is unlocked and opened, and the three items are removed from the inventory.

Any thoughts or guidance is greatly appreciated. Thank you.
User avatar
Reanan-Marie Olsen
 
Posts: 3386
Joined: Thu Mar 01, 2007 6:12 am

Post » Wed Jul 27, 2011 10:30 am

Make a new door or copy an existing one but assign a new EditorID and attach the below script to it...
ScriptName YourDoorObjectSCPTBegin OnActivate Player	If (Player.GetItemCount Item01 && Player.GetItemCount Item02 && Player.GetItemCount Item03)		Unlock;               PlaySound ZeldaSecretSOUN                Player.RemoveItem Item01 1                Player.RemoveItem Item02 1                Player.RemoveItem Item03 1		Activate Player	ElseIf (Player.GetItemCount Item01 && Player.GetItemCount Item02)		MessageBox "You still need Item03 to open this door."	ElseIf  (Player.GetItemCount Item01 && Player.GetItemCount Item03)		MessageBox "You still need Item02 to open this door."	ElseIf  (Player.GetItemCount Item02 && Player.GetItemCount Item03)		MessageBox "You still need Item01 to open this door."	ElseIf  Player.GetItemCount Item01		MessageBox "You need Item02 and Item03 to open this door."	ElseIf  Player.GetItemCount Item02		MessageBox "You need Item01 and Item03 to open this door."	ElseIf  Player.GetItemCount Item03		MessageBox "You need Item01 and Item02 to open this door."	EndIfEnd
...and it won't open unless you've all three of the items, displaying the message variations as described.
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Wed Jul 27, 2011 11:35 pm

Wow, that is great. The script works perfectly. I appreciate the help. Thanks!
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Wed Jul 27, 2011 10:15 am

Right on! :) It could probably be optimized, but it's not too important as it will only run when activating the door.
User avatar
Melissa De Thomasis
 
Posts: 3412
Joined: Tue Feb 27, 2007 6:52 pm


Return to IV - Oblivion