Jump to content

auto self close door script


ifhopesdie

Recommended Posts

have tried something like this but with the mod ''lakeview extented'' the probleme its when i try to load up the script to see what he look like i receice a warning

 

''error Cannot open store for class ''LakeviewGate'' missing file!''

 

then i click yes to all then error pop and say

 

''error accontered wile attempting to reload the script''

 

so i cant see it

Edited by ifhopesdie
Link to comment
Share on other sites

This script should work. You will want to add a property for your door and set the value for RegisterForSingleUpdate in seconds but it's fairly straight forward.

Event OnOpen(ObjectReference akActionRef)
	int openState = YourDoor.GetOpenState()
	If openState != 3 && openState != 4
		RegisterForSingleUpdate(10.0)
	endIf
endEvent

Event OnUpdate()	
	YourDoor.SetOpen(false)
EndEvent
Edited by djjohnjarvis
Link to comment
Share on other sites

thanks but im having a probleme i probably miss something somewhere

 

1st new script i add your line (do i need to change something in this? like the ''yourdoor'')

i change it to the name of my gate to try but same error during adding the property

 

i receive this error no viable alternative at input 'RegisterForSingleUpdate'

 

im a bit new with the CK so sry

 

and btw witch property i need

Edited by ifhopesdie
Link to comment
Share on other sites

Ok this is how the full script should look. I have got rid of any need for any properties and I am now just using Self to run the functions directly on the object the script is attached to. So make sure this script is added to the specific object reference you want it triggered on by loading up the cell in the render window and double clicking on the door/gate you want to add it to. Go into the scripts tab for this object reference (you will need to use the arrows to the right of the tabs and scroll along to get to it) and add the script there. Obviously change the script to your liking though.

Scriptname DoorAutoCloseScript extends ObjectReference

Event OnOpen(ObjectReference akActionRef)
	int openState = Self.GetOpenState()
	If openState != 3 && openState != 4
		RegisterForSingleUpdate(10.0)
	endIf
endEvent

Event OnUpdate()	
	Self.SetOpen(false)
EndEvent
  • Thanks 1
Link to comment
Share on other sites

thanks a lot for your help i really apreciate its work perfectly i whach many tutorial to try to find something for my probleme but nothing

 

at least all these tutorial will help me for other thing

 

ty again

 

by any chance you know how i can make my gate to be allways lock i made a key for it but the probleme is after i use the key on my gate 1 time she dont need the key anymore i want to the gate need a key everytime :blush:

Edited by ifhopesdie
Link to comment
Share on other sites

  • Recently Browsing   0 members

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