NPC leaves shack, door closes & locks - How?

Post » Sun Jan 26, 2014 12:07 pm

I've done this before but for the life of me don't know how I did it - has been a year though.

So have a shack type building inside a mine, kind of office if you like. It has a door and I'd like that when NPC MrBoss leaves his shack the door closes and locks behind him. While he is in there the door can remain open (he has an open door policy). I already have the script for closing the door when he leaves his office, simple triggerbox that uses OnLeave but I am unsure how to also lock it. Please pimp my script.

import Debugimport UtilityObjectReference Property door01 Auto;ObjectReference Property TriggerRef AutoActor Property Actor01 Autodefault2StateActivator door01Scriptevent OnLoad()	door01Script = door01 as default2StateActivatorendEventevent onTriggerLeave(objectreference TriggerRef);	Notification("Enter Trigger")	if (TriggerRef == Actor01)		int openState = door01.GetOpenState()		if (openState == 1 || openState == 2)			door01.Activate(self)		endif;		if (door01script.isOpen);			Notification("Door");			door01script.SetOpen(false);		endif	endifendEvent
User avatar
Yvonne
 
Posts: 3577
Joined: Sat Sep 23, 2006 3:05 am

Post » Sun Jan 26, 2014 8:18 am

From script if that's what you want: http://www.creationkit.com/Lock_-_ObjectReference

I didn't used it but packages have some LockDoor procedure http://www.creationkit.com/Locking_and_Unlocking_Doors

User avatar
John N
 
Posts: 3458
Joined: Sun Aug 26, 2007 5:11 pm


Return to V - Skyrim