Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ScriptName _DA_Skyship_Ladder_Switch_v1 extends ObjectReference
- Import Utility
- Import Game
- _DA_Skyship_v1 Property rSkyShip Auto
- float fDepthCheck
- float fXPOS
- float fYPOS
- float fXPOSDest
- float fYPOSDest
- float fZPOSDest
- float fZPosOffSet
- Actor Property ZOffset Auto Hidden
- Event OnActivate(ObjectReference akActionRef)
- If(rSkyship.rSkyship_Ladder_1.Is3DLoaded())
- GetPlayer().MoveTo(rSkyship.rSkyship_Ladder_Marker)
- Wait(0.5)
- Actor FollowerActor = (DialogueFollower.getAlias(0) as ReferenceAlias).getReference() as Actor
- If (FollowerActor != "NONE")
- SummonToPlayer(FollowerActor)
- Endif
- Wait(0.25)
- If (FollowerActor != "NONE")
- SummonToPlayer(FollowerActor)
- Endif
- Elseif(!rSkyship.rSkyship_Ladder_1.Is3DLoaded())
- Debug.Notification("Calculating Elevation...")
- ResetDepthCheck()
- Wait (4.0)
- If(rSkyship.iDA_Armed == 1)
- fDepthcheck = rSkyship.rSkyShip_Stopped.GetPositionZ() - ZOffset.GetPositionZ()
- Elseif(rSkyship.iDA_Armed == 0)
- fDepthcheck = rSkyship.rSkyShip_Havok.GetPositionZ() - ZOffset.GetPositionZ()
- Endif
- If(fDepthCheck > 1870)
- Debug.Notification("Altitude Exceeds Safe Debarkation Distance.")
- Debug.Notification("Distance: Exceeds 1870")
- Elseif(fDepthCheck < 1870)
- Debug.Notification("Distance: " + fDepthCheck + " / 1870")
- Debug.Notification("Elevation is within limits: Deploying Ladder.")
- If(fDepthCheck < 200)
- Debug.Notification("Depth Check system error, please try again.")
- Else
- If fXPOS - fXPOSDest < 25 && fXPOS - fXPOSDest > -25 || fYPOS - fYPOSDest < 25 && fYPOS - fYPOSDest > -25
- rSkyship.rSkyship_Ladder_Marker.MoveTo(ZOffset)
- rSkyship.rSkyship_Ladder_Marker.SetAngle(ZOffset.GetAngleX(), ZOffset.GetAngleY(), 0)
- If fXPOS - fXPOSDest > 0 && fXPOS - fXPOSDest > fYPOS - fYPOSDest
- fZPOSOffSet = fXPOS - fXPOSDest
- Elseif fYPOS - fYPOSDest > 0 && fYPOS - fYPOSDest > fXPOS - fXPOSDest
- fZPOSOffSet = fYPOS - fYPOSDest
- Elseif fXPOS - fXPOSDest < 0 && fXPOS - fXPOSDest < fYPOS - fYPOSDest
- fZPOSOffSet = (fXPOS - fXPOSDest) * -1
- Elseif fYPOS - fYPOSDest < 0 && fYPOS - fYPOSDest < fXPOS - fXPOSDest
- fZPOSOffSet = (fYPOS - fYPOSDest) * -1
- Endif
- If fZPOSOffSet > 400
- Debug.Notification("Terrain too unstable for deployment")
- Return
- Endif
- Else
- ZOffset.SetPosition(fXPOS, fYPOS, fZPOSDest + fZPOSOffSet)
- rSkyship.rSkyship_Ladder_Marker.MoveTo(ZOffset)
- rSkyship.rSkyship_Ladder_Marker.SetAngle(ZOffset.GetAngleX(), ZOffset.GetAngleY(), 0)
- Endif
- Debug.Notification("Elevation is within limits: Deploying Ladder.")
- If fDepthCheck > 200
- rSkyship.rSkyship_Ladder_1.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_1.Enable()
- Endif
- If fDepthCheck > 383
- rSkyship.rSkyship_Ladder_2.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_2.Enable()
- Endif
- If fDepthCheck > 421
- rSkyship.rSkyship_Ladder_3.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_3.MoveTo(rSkyship.rSkyship_Ladder_2, 0, 0, -38)
- rSkyship.rSkyship_Ladder_3.Enable()
- Endif
- If fDepthCheck > 459
- rSkyship.rSkyship_Ladder_4.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_4.MoveTo(rSkyship.rSkyship_Ladder_3, 0, 0, -38)
- rSkyship.rSkyship_Ladder_4.Enable()
- Endif
- If fDepthCheck > 497
- rSkyship.rSkyship_Ladder_5.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_5.MoveTo(rSkyship.rSkyship_Ladder_4, 0, 0, -38)
- rSkyship.rSkyship_Ladder_5.Enable()
- Endif
- If fDepthCheck > 535
- rSkyship.rSkyship_Ladder_6.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_6.MoveTo(rSkyship.rSkyship_Ladder_5, 0, 0, -38)
- rSkyship.rSkyship_Ladder_6.Enable()
- Endif
- If fDepthCheck > 573
- rSkyship.rSkyship_Ladder_7.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_7.MoveTo(rSkyship.rSkyship_Ladder_6, 0, 0, -38)
- rSkyship.rSkyship_Ladder_7.Enable()
- Endif
- If fDepthCheck > 611
- rSkyship.rSkyship_Ladder_8.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_8.MoveTo(rSkyship.rSkyship_Ladder_7, 0, 0, -38)
- rSkyship.rSkyship_Ladder_8.Enable()
- Endif
- If fDepthCheck > 649
- rSkyship.rSkyship_Ladder_9.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_9.MoveTo(rSkyship.rSkyship_Ladder_8, 0, 0, -38)
- rSkyship.rSkyship_Ladder_9.Enable()
- Endif
- If fDepthCheck > 687
- rSkyship.rSkyship_Ladder_10.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_10.MoveTo(rSkyship.rSkyship_Ladder_9, 0, 0, -38)
- rSkyship.rSkyship_Ladder_10.Enable()
- Endif
- If fDepthCheck > 725
- rSkyship.rSkyship_Ladder_11.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_11.MoveTo(rSkyship.rSkyship_Ladder_10, 0, 0, -38)
- rSkyship.rSkyship_Ladder_11.Enable()
- Endif
- If fDepthCheck > 763
- rSkyship.rSkyship_Ladder_12.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_12.MoveTo(rSkyship.rSkyship_Ladder_11, 0, 0, -38)
- rSkyship.rSkyship_Ladder_12.Enable()
- Endif
- If fDepthCheck > 801
- rSkyship.rSkyship_Ladder_13.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_13.MoveTo(rSkyship.rSkyship_Ladder_12, 0, 0, -38)
- rSkyship.rSkyship_Ladder_13.Enable()
- Endif
- If fDepthCheck > 839
- rSkyship.rSkyship_Ladder_14.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_14.MoveTo(rSkyship.rSkyship_Ladder_13, 0, 0, -38)
- rSkyship.rSkyship_Ladder_14.Enable()
- Endif
- If fDepthCheck > 877
- rSkyship.rSkyship_Ladder_15.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_15.MoveTo(rSkyship.rSkyship_Ladder_14, 0, 0, -38)
- rSkyship.rSkyship_Ladder_15.Enable()
- Endif
- If fDepthCheck > 915
- rSkyship.rSkyship_Ladder_16.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_16.MoveTo(rSkyship.rSkyship_Ladder_15, 0, 0, -38)
- rSkyship.rSkyship_Ladder_16.Enable()
- Endif
- If fDepthCheck > 953
- rSkyship.rSkyship_Ladder_17.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_17.MoveTo(rSkyship.rSkyship_Ladder_16, 0, 0, -38)
- rSkyship.rSkyship_Ladder_17.Enable()
- Endif
- If fDepthCheck > 991
- rSkyship.rSkyship_Ladder_18.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_18.MoveTo(rSkyship.rSkyship_Ladder_17, 0, 0, -38)
- rSkyship.rSkyship_Ladder_18.Enable()
- Endif
- If fDepthCheck > 1029
- rSkyship.rSkyship_Ladder_19.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_19.MoveTo(rSkyship.rSkyship_Ladder_18, 0, 0, -38)
- rSkyship.rSkyship_Ladder_19.Enable()
- Endif
- If fDepthCheck > 1067
- rSkyship.rSkyship_Ladder_20.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_20.MoveTo(rSkyship.rSkyship_Ladder_19, 0, 0, -38)
- rSkyship.rSkyship_Ladder_20.Enable()
- Endif
- If fDepthCheck > 1105
- rSkyship.rSkyship_Ladder_21.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_21.MoveTo(rSkyship.rSkyship_Ladder_20, 0, 0, -38)
- rSkyship.rSkyship_Ladder_21.Enable()
- Endif
- If fDepthCheck > 1143
- rSkyship.rSkyship_Ladder_22.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_22.MoveTo(rSkyship.rSkyship_Ladder_21, 0, 0, -38)
- rSkyship.rSkyship_Ladder_22.Enable()
- Endif
- If fDepthCheck > 1181
- rSkyship.rSkyship_Ladder_23.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_23.MoveTo(rSkyship.rSkyship_Ladder_22, 0, 0, -38)
- rSkyship.rSkyship_Ladder_23.Enable()
- Endif
- If fDepthCheck > 1219
- rSkyship.rSkyship_Ladder_24.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_24.MoveTo(rSkyship.rSkyship_Ladder_23, 0, 0, -38)
- rSkyship.rSkyship_Ladder_24.Enable()
- Endif
- If fDepthCheck > 1257
- rSkyship.rSkyship_Ladder_25.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_25.MoveTo(rSkyship.rSkyship_Ladder_24, 0, 0, -38)
- rSkyship.rSkyship_Ladder_25.Enable()
- Endif
- If fDepthCheck > 1295
- rSkyship.rSkyship_Ladder_26.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_26.MoveTo(rSkyship.rSkyship_Ladder_25, 0, 0, -38)
- rSkyship.rSkyship_Ladder_26.Enable()
- Endif
- If fDepthCheck > 1333
- rSkyship.rSkyship_Ladder_27.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_27.MoveTo(rSkyship.rSkyship_Ladder_26, 0, 0, -38)
- rSkyship.rSkyship_Ladder_27.Enable()
- Endif
- If fDepthCheck > 1371
- rSkyship.rSkyship_Ladder_28.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_28.MoveTo(rSkyship.rSkyship_Ladder_27, 0, 0, -38)
- rSkyship.rSkyship_Ladder_28.Enable()
- Endif
- If fDepthCheck > 1409
- rSkyship.rSkyship_Ladder_29.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_29.MoveTo(rSkyship.rSkyship_Ladder_28, 0, 0, -38)
- rSkyship.rSkyship_Ladder_29.Enable()
- Endif
- If fDepthCheck > 1447
- rSkyship.rSkyship_Ladder_30.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_30.MoveTo(rSkyship.rSkyship_Ladder_29, 0, 0, -38)
- rSkyship.rSkyship_Ladder_30.Enable()
- Endif
- If fDepthCheck > 1485
- rSkyship.rSkyship_Ladder_31.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_31.MoveTo(rSkyship.rSkyship_Ladder_30, 0, 0, -38)
- rSkyship.rSkyship_Ladder_31.Enable()
- Endif
- If fDepthCheck > 1523
- rSkyship.rSkyship_Ladder_32.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_32.MoveTo(rSkyship.rSkyship_Ladder_31, 0, 0, -38)
- rSkyship.rSkyship_Ladder_32.Enable()
- Endif
- If fDepthCheck > 1561
- rSkyship.rSkyship_Ladder_33.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_33.MoveTo(rSkyship.rSkyship_Ladder_32, 0, 0, -38)
- rSkyship.rSkyship_Ladder_33.Enable()
- Endif
- If fDepthCheck > 1599
- rSkyship.rSkyship_Ladder_34.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_34.MoveTo(rSkyship.rSkyship_Ladder_33, 0, 0, -38)
- rSkyship.rSkyship_Ladder_34.Enable()
- Endif
- If fDepthCheck > 1637
- rSkyship.rSkyship_Ladder_35.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_35.MoveTo(rSkyship.rSkyship_Ladder_34, 0, 0, -38)
- rSkyship.rSkyship_Ladder_35.Enable()
- Endif
- If fDepthCheck > 1675
- rSkyship.rSkyship_Ladder_36.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_36.MoveTo(rSkyship.rSkyship_Ladder_35, 0, 0, -38)
- rSkyship.rSkyship_Ladder_36.Enable()
- Endif
- If fDepthCheck > 1713
- rSkyship.rSkyship_Ladder_37.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_37.MoveTo(rSkyship.rSkyship_Ladder_36, 0, 0, -38)
- rSkyship.rSkyship_Ladder_37.Enable()
- Endif
- If fDepthCheck > 1751
- rSkyship.rSkyship_Ladder_38.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_38.MoveTo(rSkyship.rSkyship_Ladder_37, 0, 0, -38)
- rSkyship.rSkyship_Ladder_38.Enable()
- Endif
- If fDepthCheck > 1789
- rSkyship.rSkyship_Ladder_39.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_39.MoveTo(rSkyship.rSkyship_Ladder_38, 0, 0, -38)
- rSkyship.rSkyship_Ladder_39.Enable()
- Endif
- If fDepthCheck > 1827
- rSkyship.rSkyship_Ladder_40.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_40.MoveTo(rSkyship.rSkyship_Ladder_39, 0, 0, -38)
- rSkyship.rSkyship_Ladder_40.Enable()
- Endif
- If fDepthCheck > 1860
- rSkyship.rSkyship_Ladder_41.MoveTo(rSkyship.rSkyship)
- rSkyship.rSkyship_Ladder_41.MoveTo(rSkyship.rSkyship_Ladder_40, 0, 0, -38)
- rSkyship.rSkyship_Ladder_41.Enable()
- Endif
- Endif
- ZOffset.Disable()
- ZOffset.Delete()
- Endif
- Endif
- Endevent
- Function ResetDepthCheck()
- If(rSkyship.iDA_Armed == 1)
- ZOffset = GetPlayer().PlaceActorAtMe(rSkyship.aZCheckFox, 1)
- ZOffset.SetAlpha(0)
- ZOffset.MoveToNode(rSkyship.rSkyship_Stopped, "DepthStart")
- Elseif(rSkyship.iDA_Armed == 0)
- ZOffset = GetPlayer().PlaceActorAtMe(rSkyship.aZCheckFox, 1)
- ZOffset.SetAlpha(0)
- ZOffset.MoveToNode(rSkyship.rSkyship_Havok, "DepthStart")
- Endif
- Endfunction
- Function SummonToPlayer (Actor Act)
- If (Act.GetActorValue("WaitingForPlayer") == 0)
- Act.MoveTo(Game.GetPlayer())
- Endif
- Endfunction
- Quest Property DialogueFollower Auto
Add Comment
Please, Sign In to add comment