Here's a more sophisticated version...in addition to the variables you can use to set where it goes, you can also tell it to move to up to 3 references on it's opening sequence, at different speeds. Works best if you disable the references so the player doesn't see them of course.
Scriptname TrapdoorControlScript extends ObjectReference bool property Closed = True Auto ; tells us whether it's "open" or "Closed" - Starts closed by default.ObjectReference Property FirstStage Auto ; Objectreferences can be used instead of absolute coordinates. Disable the objectreferences being used so they don't show up and make them not HavokSettle.ObjectReference Property SecondStage AutoObjectReference Property ThirdStage AutoFloat property OpenSpeed1 AutoFloat property OpenSpeed2 AutoFloat property OpenSpeed3 Auto ; The speeds for the various stages of opening.Float property OpenRot1 AutoFloat property OpenRot2 AutoFloat property OpenRot3 Auto ; Rotation caps for the various stages of opening.Int OpenStage ; Used to control the various translations when using references to open.Bool Moving = FalseFloat Property AngleXOpen Auto ; The Rotation on the X Axis when opened.Float Property AngleYOpen Auto ; The Rotation on the Y Axis when opened.Float Property AngleZOpen Auto ; The Rotation on the Z Axis when opened.Float Property XOffset Auto ; The offset on the X Axis when opened.Float Property YOffset Auto ; The offset on the Y Axis when opened.Float Property ZOffset Auto ; The offset on the Z Axis when opened. ; Set these in the properties tab. The others are computed. These are only used if there are no references being used.Float Property XOpen Auto ; The offset on the X Axis when opened.Float Property YOpen Auto ; The offset on the Y Axis when opened.Float Property ZOpen Auto ; The offset on the Z Axis when opened.Float Property XClosed Auto ; The offset on the X Axis when Closed.Float Property YClosed Auto ; The offset on the Y Axis when Closed.Float Property ZClosed Auto ; The offset on the Z Axis when Closed. ;Float Property AngleXClosed Auto ; The Rotation on the X Axis when Closed.Float Property AngleYClosed Auto ; The Rotation on the Y Axis when Closed.Float Property AngleZClosed Auto ; The Rotation on the Z Axis when Closed.event OnCellLoad() ; Store the start position. The other position should be set in the Properties window, either by explicit numbers, or with hidden reference objects. if Closed XClosed = X YClosed = Y ZClosed = Z XOpen = X+XOffset YOpen = Y+YOffset ZOpen = Z+ZOffset AngleXClosed = GetAngleX() AngleYClosed = GetAngleY() AngleZClosed = GetAngleZ() endifEndEventEvent OnActivate(Objectreference PullChain) if !Moving ; Once it's in motion, it won't respond to the activator until it finishes opening or closing. Moving = True if Closed if !FirstStage TranslateTo(XOpen,YOpen,ZOpen,AngleXOpen,AngleYOpen,AngleZOpen,OpenSpeed1,OpenRot1) else TranslateToRef(FirstStage,OpenSpeed1,OpenRot1) OpenStage = 1 endif else if !FirstStage || !SecondStage ; If there's only one stage of opening/closing, or using explicit coordinates Moving = True TranslateTo(XClosed,YClosed,ZClosed,AngleXClosed,AngleYClosed,AngleZClosed,OpenSpeed1,OpenRot1) OpenStage = 0 elseif ThirdStage TranslateToRef(SecondStage,OpenSpeed3,OpenRot3) OpenStage = 2 elseif SecondStage TranslateToRef(FirstStage,OpenSpeed2,OpenRot2) OpenStage = 1 endif endif endifEndEventEvent OnTranslationComplete() if Closed ; we are opening If ThirdStage ; If there is a third stage reference if OpenStage == 3 Closed = False Moving = False elseif OpenStage == 2 ; we have reached the second stage on the Opening sequence TranslateToRef(ThirdStage,OpenSpeed3,OpenRot3) OpenStage = 3 else ; OpenStage == 1 - OpenStage 0 doesn't happen when opening. TranslateToRef(SecondStage,OpenSpeed2,OpenRot2) OpenStage = 2 endif elseif SecondStage ; There is a stage 2 but no stage 3 If OpenStage == 2 Closed = False Moving = False else TranslateToRef(SecondStage,OpenSpeed2,OpenRot2) endif else ; Only one stage, or using explicit movement. Closed = False Moving = False endif else ; We are Closing If ThirdStage ; If there is a third stage reference if OpenStage == 0 Closed = True Moving = False elseif OpenStage == 2 ; we have reached the second stage on the Closing sequence TranslateToRef(FirstStage,OpenSpeed2,OpenRot2) OpenStage = 1 else ; OpenStage == 1 - OpenStage 3 doesn't happen when Closing. TranslateTo(XClosed,YClosed,ZClosed,AngleXClosed,AngleYClosed,AngleZClosed,OpenSpeed1,OpenRot1) OpenStage = 0 endif elseif SecondStage ; There is a stage 2 but no stage 3 If OpenStage == 0 Closed = True Moving = False else ; OpenStage == 1 TranslateToRef(FirstStage,OpenSpeed2,OpenRot2) OpenStage = 0 endif else ; Only one stage, or using explicit movement. Closed = True Moving = False endif endifEndEvent