Assigning a key to the locked door.

Post » Sun Nov 18, 2012 8:12 am

Hi,

I have a door which starts closed, but not locked at the beginning of the quest - opening the door triggers a scene which progresses the quest further. At some point I need to have this door locked - I can do that with MyDoor.Lock() and MyDoor.SetLockLevel(50). I need to be able to get this door both lockpicked and unlocked with a key, but how do I assign the correct key?
User avatar
Dagan Wilkin
 
Posts: 3352
Joined: Fri Apr 27, 2007 4:20 am

Post » Sun Nov 18, 2012 2:34 pm

You have to edit the door which is already placed in the game world.
Assuming you have done this, you can double click on MyDoor in the render window or right click/edit MyDoor from the cell view. Either way brings up a Reference box.

Click on the tab marked lock.

You will see two drop down boxes, named
LEVEL - allows you set the lock level
KEY - allows you to assign a key to unlock the door.
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Sun Nov 18, 2012 6:40 am

Yes, I know that. The trick is, that in order to assign the key this way I have to check the 'locked' flag, and I don't want this door to be initially locked. Unless I'm missing something?
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

Post » Sun Nov 18, 2012 8:50 am

Well how about setting it up so it is initially locked with the key assigned. Then use DoorRef.Lock(false) to unlock the door but do it in a way that it gets unlocked before the player gets to it. You could do that with a triggerbox placed strategically away from the door with something like the following script:

Event OnTriggerEnter(ObjectReference akActionRef)   If (akActionRef == Game.GetPlayer()) && (MyQuest.GetStage() == 10) && (DoorRef.IsLocked() == true)      DoorRef.Lock(false)   EndIfEndEvent

- Hypno
User avatar
des lynam
 
Posts: 3444
Joined: Thu Jul 19, 2007 4:07 pm

Post » Sun Nov 18, 2012 8:20 am

Awesome idea, thank you for that. Since the door can be locked during stage 0, but must be unlocked during stage 10, I can script the door to unlock automagically when the quest progresses from stage 0 to 10. As an additional bonus, this should prevent the player from hanging around in places they shouldn't be seeing before the quest starts. Thanks a lot once again.
User avatar
vicki kitterman
 
Posts: 3494
Joined: Mon Aug 07, 2006 11:58 am

Post » Sun Nov 18, 2012 11:39 am

No probs mate. You probably would've come to the same conclusion in the end, I just gave ya a gentle nudge in the righ direction :P

- Hypno
User avatar
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm


Return to V - Skyrim