Jump to content

How would I make a re-lockable door?


gunslinger6792

Recommended Posts

I'm getting to the point where I have several house mods that are almost finished and have been brought out of deep storage. I'd like to create a re-lockable door feature since these homes have two entrances one of which leads into a city and I'd like to prevent NPC's from following. I know how to create a lockable door in FNV by rigging an activator to a door and running a script through it. Assuming the process is the same would a new papyrus script and if so could someone provide a simple one?

Link to comment
Share on other sites

Ah... I see. I was under the impression that you didn't want anyone but the player to enter and steal your sweet rolls.

 

 

There are several ways in which you could go about this, but ultimately it will involve using a script "event" that points to an "ObjectReference" of your door or placing a script upon the door itself (that would be my choice). The question is,.. how to set up a situation whereby the game knows if the door is locked already.

 

Well, I'm just gonna assume that you want me to tell you, and just go right ahead:

 

 

Create two multi-choice messages (for Lock and Unlock)

Create a Global Variable

 

Add a new script to your door:

Scriptname MyDoorScript extends ObjectReference  

GlobalVariable Property MyGlobal Auto
Message Property LockMessage Auto
Message Property UnlockMessage Auto

int Button

EVENT onActivate(objectReference akActionRef)

	If MyGlobal.GetValue() == 0
		Button = LockMessage.show()
		if Button == 0 ;Yes lock the door
             self.Lock()
             self.SetLockLevel(255); you need a key to Open it
             Utility.Wait(1)
             MyGlobal.SetValue(1); We increase the value so that the lock message won't show again
           
        elseif Button == 1
			;do nothing
        endif
     EndIf
        
        If MyGlobal.GetValue() == 1  
           Button = UnlockMessage.show()
		if Button == 0 ;Yes unlock the door
             self.Lock(false)
             Utility.Wait(1)
             MyGlobal.SetValue(0); We decrease the value so that the lock message will show again
           
             elseif Button == 1
			;do nothing
		endif
	EndIf

endEVENT
Link to comment
Share on other sites

 

Ah... I see. I was under the impression that you didn't want anyone but the player to enter and steal your sweet rolls.

 

 

There are several ways in which you could go about this, but ultimately it will involve using a script "event" that points to an "ObjectReference" of your door or placing a script upon the door itself (that would be my choice). The question is,.. how to set up a situation whereby the game knows if the door is locked already.

 

Well, I'm just gonna assume that you want me to tell you, and just go right ahead:

 

 

Create two multi-choice messages (for Lock and Unlock)

Create a Global Variable

 

Add a new script to your door:

Scriptname MyDoorScript extends ObjectReference  

GlobalVariable Property MyGlobal Auto
Message Property LockMessage Auto
Message Property UnlockMessage Auto

int Button

EVENT onActivate(objectReference akActionRef)

	If MyGlobal.GetValue() == 0
		Button = LockMessage.show()
		if Button == 0 ;Yes lock the door
             self.Lock()
             self.SetLockLevel(255); you need a key to Open it
             Utility.Wait(1)
             MyGlobal.SetValue(1); We increase the value so that the lock message won't show again
           
        elseif Button == 1
			;do nothing
        endif
     EndIf
        
        If MyGlobal.GetValue() == 1  
           Button = UnlockMessage.show()
		if Button == 0 ;Yes unlock the door
             self.Lock(false)
             Utility.Wait(1)
             MyGlobal.SetValue(0); We decrease the value so that the lock message will show again
           
             elseif Button == 1
			;do nothing
		endif
	EndIf

endEVENT

Thank you and sorry I didn't make that more clear. Sometimes I think my believing that skyrim modding is similar enough to FNV is what causes half my problems.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...