Jump to content

[LE] [Script]Someone help me with this door activating script


anb2004

Recommended Posts

Basically opening/closing a door will lead another door to open/close. I'm using a modified script which is originally intended for light script.

 

So after i activate the first door for the first time, the second door should animate as well but somehow it won't, i had to activate it again and since there are two door, i need to make them properly in sync/same state or they will clipping on each.

 

 

 

Scriptname _GhostWorkstation extends ObjectReference  

ObjectReference Property RealFurn auto			; Marker that hold real furnitures with no visual object.
ObjectReference Property GhostFurn auto		        ; Animated object that pop in/out.

Event OnOpen(ObjectReference akActionRef)
		GoToState("OnOpen") 
EndEvent

Event OnClose(ObjectReference akActionRef)
		GoToState("OnClose") 
EndEvent

State OnClose
	Event OnBeginState()
		RealFurn.Disable()
	EndEvent
	
	Event OnActivate(ObjectReference akActionRef)
		GoToState("OnClose")
		Utility.wait(1.5)	
		GhostFurn.Activate(Game.GetPlayer(), False)
	EndEvent
EndState

State OnOpen
	Event OnBeginState()
		RealFurn.Enable()
	EndEvent
	
	Event OnActivate(ObjectReference akActionRef)
		GoToState("OnOpen")
		GhostFurn.Activate(Game.GetPlayer(), False)
	EndEvent
EndState 

result in game : https://live.staticflickr.com/video/49780063991/6dc922f585/720p.mp4?s=eyJpIjo0OTc4MDA2Mzk5MSwiZSI6MTU4NzAzMDEyMywicyI6ImI0NDAxY2E1MzNiZTEzZTU4YjgzOGE1ZmZiNTg1ZGU4YzllYmMxZmQiLCJ2IjoxfQ

 

 

Anyone got a clue to fix that.

 

Thanks

Link to comment
Share on other sites

States were never my strong suit when it came to papyrus. Yet, I can tell what is causing the problem.

 

You have an OnOpen event in the empty state. This will run first. It sends the script to the state called OnOpen. That state is waiting for the door to be opened or closed. Thus you have to do it two or more times to achieve what you want.

 

I believe that there is an Auto State feature which will allow the script to start inside a specific state rather than in the empty state. You could use that to start in the state called OnOpen and then send the script to the state that is waiting for the door to be closed.

 

I would also recommend not giving the states the same names as an event or function. Papyrus can be fickle about names at times and get confused.

 

EDIT: Scratch that one part. I mis-read the code.

Edited by IsharaMeradin
Link to comment
Share on other sites

I believe that there is an Auto State feature which will allow the script to start inside a specific state rather than in the empty state. You could use that to start in the state called OnOpen and then send the script to the state that is waiting for the door to be closed.

It worked ! thank you, thank you...

 

 

Scriptname _GhostWorkstation extends ObjectReference 

ObjectReference Property RealFurn auto            ; Marker that hold real furnitures with no visual object.
ObjectReference Property GhostFurn auto           ; Animated object that pop in/out.

Auto State Close

	Event OnBeginState()
		RealFurn.Disable()
	EndEvent

	Event OnActivate(ObjectReference akActionRef)
		GoToState("Close")
		GhostFurn.Activate(Game.GetPlayer(), False)
	EndEvent
EndState

State Open

	Event OnBeginState()
		RealFurn.Enable()
	EndEvent

	Event OnActivate(ObjectReference akActionRef)
		GoToState("Open")
		Utility.wait(1.5)
		GhostFurn.Activate(Game.GetPlayer(), False)
	EndEvent
EndState 

 

 

But somehow it won't recognize the utility.wait anymore which is weird, both door activated at the same time. Do i need another wait function to work with auto state script? really need to delay that second door on opening state for few seconds to avoid clipping.

 

Edit : Just realized the RealFurn.Disable()/enable() didn't work either...

Edited by anb2004
Link to comment
Share on other sites

  • Recently Browsing   0 members

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