Guest User

Untitled

a guest
Aug 29th, 2018
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.61 KB | None | 0 0
  1. ;### BETA SCRIPT ###
  2. ;Made By: NoxyGame
  3. ;Last Edited By: Deapri
  4.  
  5. ScriptName _DA_Skyship_v1 Extends ObjectReference
  6.  
  7. Import Utility
  8. Import Debug
  9. Import Game
  10. Import Math
  11. Import Input
  12. Import Sound
  13. Import Form
  14.  
  15. Import _DA_Skyship_MCM_ConfigMenu_v1
  16.  
  17. int Property iDA_Debug = 0 Auto Hidden
  18. int Property iDA_Armed = 0 Auto Hidden
  19. int Property iDA_Cruise = 0 Auto Hidden
  20. int Property iDA_Fly = 0 Auto Hidden
  21. int Property iDA_Anim = 0 Auto Hidden
  22. int Property iDA_Beacon = 0 Auto Hidden
  23.  
  24. int Property iCruise = 0xC7 Auto Hidden
  25. int Property iUp = 0x36 Auto Hidden
  26. int Property iDown = 0x9D Auto Hidden
  27. int Property iLeft = 0xCB Auto Hidden
  28. int Property iRight = 0xCD Auto Hidden
  29. int Property iForward = 0xC8 Auto Hidden
  30. int Property iBackward = 0xD0 Auto Hidden
  31. int Property iStrafeLeft = 0xD3 Auto Hidden
  32. int Property iStrafeRight = 0xD1 Auto Hidden
  33. int Property iStop = 0x52 Auto Hidden
  34. int Property iExit = 0x1C Auto Hidden
  35. int Property iTest = 0xCF Auto Hidden
  36. int Property iFlyMode = 0 Auto Hidden
  37. int Property iDASlideFix = 0 Auto Hidden
  38.  
  39. Bool Property bFastTravel = True Auto Hidden
  40. ;### Get the Mapped Keys not to correct on ###
  41.  
  42. int Property iDAPCJump Auto Hidden
  43. int Property iDAPCForward Auto Hidden
  44. int Property iDAPCBack Auto Hidden
  45. int Property iDAPCLeft Auto Hidden
  46. int Property iDAPCRight Auto Hidden
  47.  
  48. ;### Engine Power affects Acceleration and max. Velocity ###
  49.  
  50. float Property fDefaultUpwardPower = 4500.0 Auto Hidden
  51. float Property fDefaultDownwardPower = 4000.0 Auto Hidden
  52. float Property fDefaultForwardPower = 15000.0 Auto Hidden
  53. float Property fDefaultBackwardPower = 10000.0 Auto Hidden
  54. float Property fDefaultTurnPower = 100000.0 Auto Hidden
  55. float Property fDefaultStrafePower = 2000.0 Auto Hidden
  56.  
  57. float Property fUpwardPower Auto Hidden
  58. float Property fDownwardPower Auto Hidden
  59. float Property fForwardPower Auto Hidden
  60. float Property fBackwardPower Auto Hidden
  61. float Property fTurnPower Auto Hidden
  62. float Property fStrafePower Auto Hidden
  63.  
  64. ;### Mass effects Acceleration ###
  65.  
  66. float Property fDefaultMass = 8000.0 Auto Hidden
  67. float Property fDefaultAngularMass = 60000.0 Auto Hidden
  68.  
  69. float Property fMass Auto Hidden
  70. float Property fAngularMass Auto Hidden
  71.  
  72. float Property fXZPlaneArea = 415.0 Auto Hidden
  73. float Property fXYPlaneArea = 880.0 Auto Hidden
  74. float Property fYZPlaneArea = 805.0 Auto Hidden
  75.  
  76. Sound Property sndShipBell Auto
  77. Sound Property sndShipCreak Auto
  78. Sound Property sndShipWind Auto
  79.  
  80. ;### Location References ###
  81.  
  82. ;Location property DevAvezaLocation Auto
  83.  
  84. ;### Assigns Object References ###
  85.  
  86. ActorBase Property aZCheckFox Auto
  87.  
  88. ObjectReference Property rSkyship_Havok Auto
  89. ObjectReference Property rSkyship_Stopped Auto
  90. ObjectReference Property rSkyship Auto
  91. ObjectReference Property rSkyship_Wheel Auto
  92. ObjectReference Property rSkyship_Marker Auto
  93. ObjectReference Property rSkyship_Hatch Auto
  94. ObjectReference Property rSkyship_CreakSND Auto
  95.  
  96. ObjectReference Property rSkyship_Plank Auto
  97. ObjectReference Property rSkyship_Switch_Plank Auto
  98.  
  99. ObjectReference Property rSkyship_Light_1 Auto
  100. ObjectReference Property rSkyship_Light_2 Auto
  101. ObjectReference Property rSkyship_Light_3 Auto
  102. ObjectReference Property rSkyship_Light_4 Auto
  103. ObjectReference Property rSkyship_Light_5 Auto
  104. ObjectReference Property rSkyship_Light_6 Auto
  105. ObjectReference Property rSkyship_Light_7 Auto
  106.  
  107. ObjectReference Property rSkyship_Switch_Ladder_1 Auto
  108. ObjectReference Property rSkyship_Ladder_Marker Auto
  109. ObjectReference Property rSkyship_Ladder_1 Auto
  110. ObjectReference Property rSkyship_Ladder_2 Auto
  111. ObjectReference Property rSkyship_Ladder_3 Auto
  112. ObjectReference Property rSkyship_Ladder_4 Auto
  113. ObjectReference Property rSkyship_Ladder_5 Auto
  114. ObjectReference Property rSkyship_Ladder_6 Auto
  115. ObjectReference Property rSkyship_Ladder_7 Auto
  116. ObjectReference Property rSkyship_Ladder_8 Auto
  117. ObjectReference Property rSkyship_Ladder_9 Auto
  118. ObjectReference Property rSkyship_Ladder_10 Auto
  119. ObjectReference Property rSkyship_Ladder_11 Auto
  120. ObjectReference Property rSkyship_Ladder_12 Auto
  121. ObjectReference Property rSkyship_Ladder_13 Auto
  122. ObjectReference Property rSkyship_Ladder_14 Auto
  123. ObjectReference Property rSkyship_Ladder_15 Auto
  124. ObjectReference Property rSkyship_Ladder_16 Auto
  125. ObjectReference Property rSkyship_Ladder_17 Auto
  126. ObjectReference Property rSkyship_Ladder_18 Auto
  127. ObjectReference Property rSkyship_Ladder_19 Auto
  128. ObjectReference Property rSkyship_Ladder_20 Auto
  129. ObjectReference Property rSkyship_Ladder_21 Auto
  130. ObjectReference Property rSkyship_Ladder_22 Auto
  131. ObjectReference Property rSkyship_Ladder_23 Auto
  132. ObjectReference Property rSkyship_Ladder_24 Auto
  133. ObjectReference Property rSkyship_Ladder_25 Auto
  134. ObjectReference Property rSkyship_Ladder_26 Auto
  135. ObjectReference Property rSkyship_Ladder_27 Auto
  136. ObjectReference Property rSkyship_Ladder_28 Auto
  137. ObjectReference Property rSkyship_Ladder_29 Auto
  138. ObjectReference Property rSkyship_Ladder_30 Auto
  139. ObjectReference Property rSkyship_Ladder_31 Auto
  140. ObjectReference Property rSkyship_Ladder_32 Auto
  141. ObjectReference Property rSkyship_Ladder_33 Auto
  142. ObjectReference Property rSkyship_Ladder_34 Auto
  143. ObjectReference Property rSkyship_Ladder_35 Auto
  144. ObjectReference Property rSkyship_Ladder_36 Auto
  145. ObjectReference Property rSkyship_Ladder_37 Auto
  146. ObjectReference Property rSkyship_Ladder_38 Auto
  147. ObjectReference Property rSkyship_Ladder_39 Auto
  148. ObjectReference Property rSkyship_Ladder_40 Auto
  149. ObjectReference Property rSkyship_Ladder_41 Auto
  150.  
  151. ObjectReference Property rSkyship_Cannon_R1 Auto
  152. ObjectReference Property rSkyship_Cannon_R2 Auto
  153. ObjectReference Property rSkyship_Cannon_R3 Auto
  154. ObjectReference Property rSkyship_Cannon_R4 Auto
  155. ObjectReference Property rSkyship_Cannon_L1 Auto
  156. ObjectReference Property rSkyship_Cannon_L2 Auto
  157. ObjectReference Property rSkyship_Cannon_L3 Auto
  158. ObjectReference Property rSkyship_Cannon_L4 Auto
  159. ObjectReference Property rSkyship_Cannon_Bore_R1 Auto
  160. ObjectReference Property rSkyship_Cannon_Bore_R2 Auto
  161. ObjectReference Property rSkyship_Cannon_Bore_R3 Auto
  162. ObjectReference Property rSkyship_Cannon_Bore_R4 Auto
  163. ObjectReference Property rSkyship_Cannon_Bore_L1 Auto
  164. ObjectReference Property rSkyship_Cannon_Bore_L2 Auto
  165. ObjectReference Property rSkyship_Cannon_Bore_L3 Auto
  166. ObjectReference Property rSkyship_Cannon_Bore_L4 Auto
  167. ObjectReference Property rSkyship_CannonBall_R1 Auto
  168. ObjectReference Property rSkyship_CannonBall_R2 Auto
  169. ObjectReference Property rSkyship_CannonBall_R3 Auto
  170. ObjectReference Property rSkyship_CannonBall_R4 Auto
  171. ObjectReference Property rSkyship_CannonBall_L1 Auto
  172. ObjectReference Property rSkyship_CannonBall_L2 Auto
  173. ObjectReference Property rSkyship_CannonBall_L3 Auto
  174. ObjectReference Property rSkyship_CannonBall_L4 Auto
  175.  
  176.  
  177.  
  178. ;### Assigns Flight Integers ###
  179.  
  180. int iFlyModeTemp
  181. int iLanding
  182.  
  183. int iCreakID
  184. int iWindID
  185.  
  186. float fZPosAccelerationCruise
  187. float fXYPosAccelerationCruise
  188. float fZAngleAccelerationCruise
  189. float fXYStrafingAccelerationCruise
  190.  
  191. float fXYPosSpeedCruise
  192. float fZPosSpeedCruise
  193. float fXYStrafingSpeedCruise
  194.  
  195. float fUpwardPowerCruise
  196. float fDownwardPowerCruise
  197. float fForwardPowerCruise
  198. float fBackwardPowerCruise
  199. float fTurnPowerCruise
  200. float fStrafePowerCruise
  201.  
  202. float fDeltaT
  203. float fDeltaT2
  204. float fDeltaTAvg
  205. float fPrevTime
  206.  
  207. float fUnitsPerMeter
  208.  
  209. float fXYPosAcceleration
  210. float fZPosAcceleration
  211. float fXYStrafingAcceleration
  212.  
  213. float fXYPosSpeed
  214. float fZPosSpeed
  215. float fXYStrafingSpeed
  216.  
  217. float fXYDAPCPosSpeed
  218. float fZDAPCPosSpeed
  219. float fXYDAPCStrafingSpeed
  220. float fXYDAPCSpeedVar
  221.  
  222. float fXYPosDelta
  223. float fZPosDelta
  224. float fXYStrafingDelta
  225.  
  226. float fXPosDest
  227. float fYPosDest
  228. float fZPosDest
  229.  
  230. float fXDAPCDif
  231. float fYDAPCDif
  232. float fZDAPCDif
  233.  
  234. float fXPosDistance
  235. float fYPosDistance
  236. float fZPosDistance
  237.  
  238. float fXDAPCPosDistance
  239. float fYDAPCPosDistance
  240. float fZDAPCPosDistance
  241.  
  242. float fXYZPosDistance
  243. float fXYZPosSpeed
  244.  
  245. float fXYZDAPCPosDistance
  246. float fXYZDAPCPosSpeed
  247.  
  248. float fZAngleAcceleration
  249. float fZAngleSpeed
  250.  
  251. float fYAngleLocal
  252. float fZAngleLocal
  253.  
  254. float fXAngleDest
  255. float fYAngleDest
  256. float fZAngleDest
  257.  
  258. float fXDAPCAngleDif
  259. float fYDAPCAngleDif
  260. float fZDAPCAngleDif
  261.  
  262. float fDAPCDistance
  263. float Property fDAPCFallMult Auto Hidden
  264.  
  265. float fXAngleDistance
  266. float fYAngleDistance
  267. float fZAngleDistance
  268.  
  269. float fXYZAngleDistance
  270. float fXYZAngleSpeed
  271.  
  272. float sy
  273. float cy
  274. float sz
  275. float cz
  276.  
  277. ;### Initialization on Install Script ###
  278.  
  279. Event OnInit()
  280.  
  281. Notification("Dev Aveza v1.8")
  282.  
  283. fUnitsPerMeter = 70
  284.  
  285. fUpwardPower = fDefaultUpwardPower
  286. fDownwardPower = fDefaultDownwardPower
  287. fForwardPower = fDefaultForwardPower
  288. fBackwardPower = fDefaultBackwardPower
  289. fTurnPower = fDefaultTurnPower
  290. fStrafePower = fDefaultStrafePower
  291.  
  292. fMass = fDefaultMass
  293. fAngularMass = fDefaultAngularMass
  294.  
  295. Endevent
  296.  
  297. ;### Activation of Flight Script (0 = Attached To Ship 1 = Movable On Deck) ###
  298.  
  299. Event OnActivate(ObjectReference akActionRef)
  300.  
  301. iDA_Fly = 1
  302. RegisterForMenu("MapMenu")
  303.  
  304. Gotostate("Flying")
  305. SetGodMode(True)
  306.  
  307. iFlyModeTemp = iFlyMode
  308.  
  309. If(iFlyModeTemp == 0)
  310.  
  311. While(!rSkyship.Is3DLoaded())
  312. rSkyship.Enable()
  313. Endwhile
  314.  
  315. While(!rSkyShip_Havok.Is3DLoaded())
  316. rSkyship.MoveTo(rSkyship_Havok)
  317. rSkyShip_Havok.Enable()
  318. Endwhile
  319.  
  320. GetPlayer().MoveTo(rSkyShip, 0, 0, 100)
  321.  
  322. GetPlayer().SetAlpha(0)
  323. GetPlayer().SetVehicle(rSkyship)
  324.  
  325. If (iDA_Debug == 1)
  326.  
  327. Trace("Dev Aveza Debug Log: Player Moved to Ship via Activation Function 'Attached to Ship'")
  328.  
  329. Endif
  330.  
  331. Elseif(iFlyModeTemp == 1)
  332.  
  333. While(!rSkyShip.Is3DLoaded())
  334. rSkyShip.Enable()
  335. Endwhile
  336.  
  337. While(!rSkyShip_Havok.Is3DLoaded())
  338. rSkyship.MoveTo(rSkyship_Havok)
  339. rSkyShip_Havok.Enable()
  340. Endwhile
  341.  
  342. rSkyship.MoveTo(rSkyship_Havok)
  343.  
  344. GetPlayer().MoveTo(rSkyShip_Havok, 0, 0, 100)
  345.  
  346. GetPlayer().MoveToNode(rSkyShip_Havok, "PlayerNode")
  347. SetGodMode(False)
  348.  
  349. fDAPCFallMult = GetGameSettingFloat("fJumpFallHeightMult")
  350.  
  351. If (iDA_Debug == 1)
  352.  
  353. Trace("Dev Aveza Debug Log: Player Moved to Ship via Activation Function 'Movable on Deck'")
  354.  
  355. Endif
  356.  
  357. Endif
  358.  
  359. While(rSkyShip_Wheel.Is3DLoaded())
  360. rSkyShip_Wheel.Disable()
  361. Endwhile
  362.  
  363. While(rSkyShip_Hatch.Is3DLoaded())
  364. rSkyShip_Hatch.Disable()
  365. Endwhile
  366.  
  367. While(rSkyShip_Plank.Is3DLoaded())
  368. rSkyShip_Plank.Disable()
  369. Endwhile
  370.  
  371. While(rSkyShip_Light_1.Is3DLoaded())
  372. rSkyShip_Light_1.Disable()
  373. Endwhile
  374.  
  375. While(rSkyShip_Ladder_1.Is3DLoaded())
  376. rSkyShip_Ladder_1.Disable()
  377. Endwhile
  378.  
  379. While(rSkyShip_Ladder_2.Is3DLoaded())
  380. rSkyShip_Ladder_2.Disable()
  381. Endwhile
  382.  
  383. While(rSkyShip_Ladder_3.Is3DLoaded())
  384. rSkyShip_Ladder_3.Disable()
  385. Endwhile
  386.  
  387. While(rSkyShip_Ladder_4.Is3DLoaded())
  388. rSkyShip_Ladder_4.Disable()
  389. Endwhile
  390.  
  391. While(rSkyShip_Ladder_5.Is3DLoaded())
  392. rSkyShip_Ladder_5.Disable()
  393. Endwhile
  394.  
  395. While(rSkyShip_Ladder_6.Is3DLoaded())
  396. rSkyShip_Ladder_6.Disable()
  397. Endwhile
  398.  
  399. While(rSkyShip_Ladder_7.Is3DLoaded())
  400. rSkyShip_Ladder_7.Disable()
  401. Endwhile
  402.  
  403. While(rSkyShip_Ladder_8.Is3DLoaded())
  404. rSkyShip_Ladder_8.Disable()
  405. Endwhile
  406.  
  407. While(rSkyShip_Ladder_9.Is3DLoaded())
  408. rSkyShip_Ladder_9.Disable()
  409. Endwhile
  410.  
  411. While(rSkyShip_Ladder_10.Is3DLoaded())
  412. rSkyShip_Ladder_10.Disable()
  413. Endwhile
  414.  
  415. While(rSkyShip_Ladder_11.Is3DLoaded())
  416. rSkyShip_Ladder_11.Disable()
  417. Endwhile
  418.  
  419. While(rSkyShip_Ladder_12.Is3DLoaded())
  420. rSkyShip_Ladder_12.Disable()
  421. Endwhile
  422.  
  423. While(rSkyShip_Ladder_13.Is3DLoaded())
  424. rSkyShip_Ladder_13.Disable()
  425. Endwhile
  426.  
  427. While(rSkyShip_Ladder_14.Is3DLoaded())
  428. rSkyShip_Ladder_14.Disable()
  429. Endwhile
  430.  
  431. While(rSkyShip_Ladder_15.Is3DLoaded())
  432. rSkyShip_Ladder_15.Disable()
  433. Endwhile
  434.  
  435. While(rSkyShip_Ladder_16.Is3DLoaded())
  436. rSkyShip_Ladder_16.Disable()
  437. Endwhile
  438.  
  439. While(rSkyShip_Ladder_17.Is3DLoaded())
  440. rSkyShip_Ladder_17.Disable()
  441. Endwhile
  442.  
  443. While(rSkyShip_Ladder_18.Is3DLoaded())
  444. rSkyShip_Ladder_18.Disable()
  445. Endwhile
  446.  
  447. While(rSkyShip_Ladder_19.Is3DLoaded())
  448. rSkyShip_Ladder_19.Disable()
  449. Endwhile
  450.  
  451. While(rSkyShip_Ladder_20.Is3DLoaded())
  452. rSkyShip_Ladder_20.Disable()
  453. Endwhile
  454.  
  455. While(rSkyShip_Ladder_21.Is3DLoaded())
  456. rSkyShip_Ladder_21.Disable()
  457. Endwhile
  458.  
  459. While(rSkyShip_Ladder_22.Is3DLoaded())
  460. rSkyShip_Ladder_22.Disable()
  461. Endwhile
  462.  
  463. While(rSkyShip_Ladder_23.Is3DLoaded())
  464. rSkyShip_Ladder_23.Disable()
  465. Endwhile
  466.  
  467. While(rSkyShip_Ladder_24.Is3DLoaded())
  468. rSkyShip_Ladder_24.Disable()
  469. Endwhile
  470.  
  471. While(rSkyShip_Ladder_25.Is3DLoaded())
  472. rSkyShip_Ladder_25.Disable()
  473. Endwhile
  474.  
  475. While(rSkyShip_Ladder_26.Is3DLoaded())
  476. rSkyShip_Ladder_26.Disable()
  477. Endwhile
  478.  
  479. While(rSkyShip_Ladder_27.Is3DLoaded())
  480. rSkyShip_Ladder_27.Disable()
  481. Endwhile
  482.  
  483. While(rSkyShip_Ladder_28.Is3DLoaded())
  484. rSkyShip_Ladder_28.Disable()
  485. Endwhile
  486.  
  487. While(rSkyShip_Ladder_29.Is3DLoaded())
  488. rSkyShip_Ladder_29.Disable()
  489. Endwhile
  490.  
  491. While(rSkyShip_Ladder_30.Is3DLoaded())
  492. rSkyShip_Ladder_30.Disable()
  493. Endwhile
  494.  
  495. While(rSkyShip_Ladder_31.Is3DLoaded())
  496. rSkyShip_Ladder_31.Disable()
  497. Endwhile
  498.  
  499. While(rSkyShip_Ladder_32.Is3DLoaded())
  500. rSkyShip_Ladder_32.Disable()
  501. Endwhile
  502.  
  503. While(rSkyShip_Ladder_33.Is3DLoaded())
  504. rSkyShip_Ladder_33.Disable()
  505. Endwhile
  506.  
  507. While(rSkyShip_Ladder_34.Is3DLoaded())
  508. rSkyShip_Ladder_34.Disable()
  509. Endwhile
  510.  
  511. While(rSkyShip_Ladder_35.Is3DLoaded())
  512. rSkyShip_Ladder_35.Disable()
  513. Endwhile
  514.  
  515. While(rSkyShip_Ladder_36.Is3DLoaded())
  516. rSkyShip_Ladder_36.Disable()
  517. Endwhile
  518.  
  519. While(rSkyShip_Ladder_37.Is3DLoaded())
  520. rSkyShip_Ladder_37.Disable()
  521. Endwhile
  522.  
  523. While(rSkyShip_Ladder_38.Is3DLoaded())
  524. rSkyShip_Ladder_38.Disable()
  525. Endwhile
  526.  
  527. While(rSkyShip_Ladder_39.Is3DLoaded())
  528. rSkyShip_Ladder_39.Disable()
  529. Endwhile
  530.  
  531. While(rSkyShip_Ladder_40.Is3DLoaded())
  532. rSkyShip_Ladder_40.Disable()
  533. Endwhile
  534.  
  535. While(rSkyShip_Ladder_41.Is3DLoaded())
  536. rSkyShip_Ladder_41.Disable()
  537. Endwhile
  538.  
  539. If (iDA_Armed == 1)
  540.  
  541. While(rSkyShip_Stopped.Is3DLoaded())
  542. rSkyShip_Stopped.Disable()
  543. Endwhile
  544.  
  545. Else
  546. Endif
  547.  
  548. If IsFastTravelEnabled() == True
  549. bFastTravel = True
  550. Elseif IsFastTravelEnabled() == False
  551. bFastTravel = False
  552. Debug.Notification("Fast Travel Is Already Disabled")
  553. Endif
  554.  
  555. ;Debug.Notification(IsFastTravelControlsEnabled() As String)
  556.  
  557. fPrevTime = GetCurrentRealTime()
  558.  
  559. If(iDASlideFix == 1)
  560.  
  561. iDAPCJump = GetMappedKey("Jump")
  562. iDAPCForward = GetMappedKey("Forward")
  563. iDAPCBack = GetMappedKey("Back")
  564. iDAPCLeft = GetMappedKey("Strafe Left")
  565. iDAPCRight = GetMappedKey("Strafe Right")
  566.  
  567. SetGameSettingFloat("fJumpFallHeightMult", 0)
  568.  
  569. Endif
  570.  
  571. iLanding = 0
  572. fZPosSpeed = 0
  573. fXYPosSpeed = 0
  574. fZAngleSpeed = 0
  575. fXYStrafingSpeed = 0
  576.  
  577. fXPosDest = rSkyShip.GetPositionX()
  578. fYPosDest = rSkyShip.GetPositionY()
  579. fZPosDest = rSkyShip.GetPositionZ()
  580. fZAngleLocal = rSkyShip.GetAngleZ()
  581.  
  582. sndShipBell.Play(GetPlayer())
  583.  
  584. iCreakID = sndShipCreak.Play(GetPlayer())
  585. SetInstanceVolume(iCreakID, 0.5)
  586.  
  587. iWindID = sndShipWind.Play(GetPlayer())
  588. SetInstanceVolume(iWindID, 0.0)
  589.  
  590. RegisterForSingleUpdate(0)
  591.  
  592. Endevent
  593.  
  594. State Flying
  595.  
  596. ;### Resets Ship in Case of Control Response Failure ###
  597.  
  598. Event OnActivate(ObjectReference akActionRef)
  599.  
  600. Notification("Flight system error, resetting.")
  601.  
  602. sndShipBell.Play(GetPlayer())
  603. StopShipReset()
  604.  
  605. StopInstance(iCreakID)
  606. StopInstance(iWindID)
  607.  
  608. iDA_Fly = 0
  609.  
  610. Endevent
  611.  
  612. Event OnMenuOpen(String MenuName)
  613.  
  614. If (Getstate() == "Flying")
  615.  
  616. If Game.IsFastTravelEnabled() == True && iDA_Fly == 1 && bFastTravel == True
  617. Game.EnableFastTravel(false)
  618. Else
  619. Endif
  620.  
  621. Else
  622. Endif
  623.  
  624. Endevent
  625.  
  626. Event OnMenuClose(String MenuName)
  627.  
  628. If (Getstate() == "Flying")
  629.  
  630. If Game.IsFastTravelEnabled() == False && iDA_Fly == 0 && bFastTravel == True
  631. Game.EnableFastTravel()
  632. Else
  633. Endif
  634.  
  635. Else
  636. Endif
  637.  
  638. Endevent
  639.  
  640. Event OnUpdate()
  641.  
  642. ;### Stops Scripts in Case of Player Death While Active ###
  643.  
  644. If(GetPlayer().IsDead())
  645.  
  646. sndShipBell.Play(GetPlayer())
  647. StopShipReset()
  648.  
  649. StopInstance(iCreakID)
  650. StopInstance(iWindID)
  651.  
  652. Endif
  653.  
  654. While((fPrevTime + 0.01) > GetCurrentRealTime())
  655. wait(0.001)
  656. Endwhile
  657.  
  658. fDeltaT = GetCurrentRealTime() - fPrevTime
  659. fPrevTime = fPrevTime + fDeltaT
  660.  
  661. If(fDeltaT > 1)
  662. fDeltaT = fDeltaTAvg
  663. Endif
  664.  
  665. fDeltaTAvg = fDeltaTAvg * 0.9 + fDeltaT * 0.1
  666.  
  667. If(IsKeyPressed(iUp))
  668.  
  669. If(iDA_Cruise == 1)
  670.  
  671. Notification("Cruise Control Released")
  672. iDA_Cruise = 0
  673.  
  674. Endif
  675.  
  676. iDA_Cruise = 0
  677. fZPosAcceleration = fUpwardPower / fMass
  678. Elseif(IsKeyPressed(iDown))
  679.  
  680. If(iDA_Cruise == 1)
  681.  
  682. Notification("Cruise Control Released")
  683. iDA_Cruise = 0
  684.  
  685. Endif
  686.  
  687. fZPosAcceleration = -fDownwardPower / fMass
  688. Else
  689. fZPosAcceleration = 0
  690. Endif
  691.  
  692. If(IsKeyPressed(iForward))
  693.  
  694. If(iDA_Cruise == 1)
  695.  
  696. Notification("Cruise Control Released")
  697. iDA_Cruise = 0
  698.  
  699. Endif
  700.  
  701. fXYPosAcceleration = fForwardPower / fMass
  702. Elseif(IsKeyPressed(iBackward))
  703.  
  704. If(iDA_Cruise == 1)
  705.  
  706. Notification("Cruise Control Released")
  707. iDA_Cruise = 0
  708.  
  709. Endif
  710.  
  711. fXYPosAcceleration = -fBackwardPower / fMass
  712. Else
  713. fXYPosAcceleration = 0
  714. Endif
  715.  
  716. If(IsKeyPressed(iLeft))
  717.  
  718. If(iDA_Cruise == 1)
  719.  
  720. Notification("Cruise Control Released")
  721. iDA_Cruise = 0
  722.  
  723. Endif
  724.  
  725. fZAngleAcceleration = -fTurnPower / fAngularMass
  726.  
  727. Elseif(IsKeyPressed(iRight))
  728.  
  729. If(iDA_Cruise == 1)
  730.  
  731. Notification("Cruise Control Released")
  732. iDA_Cruise = 0
  733.  
  734. Endif
  735.  
  736. fZAngleAcceleration = fTurnPower / fAngularMass
  737. Else
  738. fZAngleAcceleration = 0
  739. Endif
  740.  
  741. If(IsKeyPressed(iStrafeLeft))
  742.  
  743. If(iDA_Cruise == 1)
  744.  
  745. Notification("Cruise Control Released")
  746. iDA_Cruise = 0
  747.  
  748. Endif
  749.  
  750. fXYStrafingAcceleration = -fStrafePower / fMass
  751.  
  752. Elseif(IsKeyPressed(iStrafeRight))
  753.  
  754. If(iDA_Cruise == 1)
  755.  
  756. Notification("Cruise Control Released")
  757. iDA_Cruise = 0
  758.  
  759. Endif
  760.  
  761. fXYStrafingAcceleration = fStrafePower / fMass
  762. Else
  763. fXYStrafingAcceleration = 0
  764. Endif
  765.  
  766. If(IsKeyPressed(iStop) || iLanding)
  767.  
  768. If(iDA_Cruise == 1)
  769.  
  770. Notification("Cruise Control Released")
  771. iDA_Cruise = 0
  772.  
  773. Endif
  774.  
  775. fZPosAcceleration = -fZPosSpeed * 0.5
  776. fXYPosAcceleration = -fXYPosSpeed * 0.5
  777. fZAngleAcceleration = -fZAngleSpeed * 0.5
  778. fXYStrafingAcceleration = -fXYStrafingSpeed * 0.5
  779. Endif
  780.  
  781. If(IsKeyPressed(iExit) && !iLanding)
  782.  
  783. If(iDA_Cruise == 1)
  784.  
  785. Notification("Cruise Control Released")
  786. iDA_Cruise = 0
  787.  
  788. Endif
  789.  
  790. sndShipBell.Play(GetPlayer())
  791. iLanding = 1
  792.  
  793. Endif
  794.  
  795. If(IsKeyPressed(iCruise))
  796.  
  797. Notification("Cruise Control Set")
  798.  
  799. iDA_Cruise = 1
  800.  
  801. fZPosAccelerationCruise = fZPosAcceleration
  802. fXYPosAccelerationCruise = fXYPosAcceleration
  803. fZAngleAccelerationCruise = fZAngleAcceleration
  804. fXYStrafingAccelerationCruise = fXYStrafingAcceleration
  805.  
  806. fXYPosSpeedCruise = fXYPosSpeed
  807. fZPosSpeedCruise = fZPosSpeed
  808. fXYStrafingSpeedCruise = fXYStrafingSpeed
  809.  
  810. fUpwardPowerCruise = fUpwardPower
  811. fDownwardPowerCruise = fDownwardPower
  812. fForwardPowerCruise = fForwardPower
  813. fBackwardPowerCruise = fBackwardPower
  814. fTurnPowerCruise = fTurnPower
  815. fStrafePowerCruise = fStrafePower
  816.  
  817. Endif
  818.  
  819. fZAngleSpeed = fZAngleSpeed + (fZAngleAcceleration - fZAngleSpeed * 10000 / fAngularMass) * fDeltaT
  820.  
  821. fDeltaT2 = fDeltaT
  822. While(fDeltaT2 > 0.1)
  823.  
  824. fDeltaT2 = fDeltaT2 - 0.1
  825.  
  826. If(fXYPosSpeed > 0)
  827. fXYPosSpeed = fXYPosSpeed + (fXYPosAcceleration - (0.25 * fXYPosSpeed * fXYPosSpeed * 1.2 * fXZPlaneArea) / fMass) * 0.1
  828. Else
  829. fXYPosSpeed = fXYPosSpeed + (fXYPosAcceleration + (0.25 * fXYPosSpeed * fXYPosSpeed * 1.2 * fXZPlaneArea) / fMass) * 0.1
  830. Endif
  831.  
  832. If(fZPosSpeed > 0)
  833. fZPosSpeed = fZPosSpeed + (fZPosAcceleration - (0.25 * fZPosSpeed * fZPosSpeed * 1.2 * fXYPlaneArea) / fMass) * 0.1
  834. Else
  835. fZPosSpeed = fZPosSpeed + (fZPosAcceleration + (0.25 * fZPosSpeed * fZPosSpeed * 1.2 * fXYPlaneArea) / fMass) * 0.1
  836. Endif
  837.  
  838. If(fXYStrafingSpeed > 0)
  839. fXYStrafingSpeed = fXYStrafingSpeed + (fXYStrafingAcceleration - (0.25 * fXYStrafingSpeed * fXYStrafingSpeed * 1.2 * fYZPlaneArea) / fMass) * 0.1
  840. Else
  841. fXYStrafingSpeed = fXYStrafingSpeed + (fXYStrafingAcceleration + (0.25 * fXYStrafingSpeed * fXYStrafingSpeed * 1.2 * fYZPlaneArea) / fMass) * 0.1
  842. Endif
  843.  
  844. Endwhile
  845.  
  846. If(fXYPosSpeed > 0)
  847. fXYPosSpeed = fXYPosSpeed + (fXYPosAcceleration - (0.25 * fXYPosSpeed * fXYPosSpeed * 1.2 * fXZPlaneArea) / fMass) * fDeltaT2
  848. Else
  849. fXYPosSpeed = fXYPosSpeed + (fXYPosAcceleration + (0.25 * fXYPosSpeed * fXYPosSpeed * 1.2 * fXZPlaneArea) / fMass) * fDeltaT2
  850. Endif
  851.  
  852. If(fZPosSpeed > 0)
  853. fZPosSpeed = fZPosSpeed + (fZPosAcceleration - (0.25 * fZPosSpeed * fZPosSpeed * 1.2 * fXYPlaneArea) / fMass) * fDeltaT2
  854. Else
  855. fZPosSpeed = fZPosSpeed + (fZPosAcceleration + (0.25 * fZPosSpeed * fZPosSpeed * 1.2 * fXYPlaneArea) / fMass) * fDeltaT2
  856. Endif
  857.  
  858. If(fXYStrafingSpeed > 0)
  859. fXYStrafingSpeed = fXYStrafingSpeed + (fXYStrafingAcceleration - (0.25 * fXYStrafingSpeed * fXYStrafingSpeed * 1.2 * fYZPlaneArea) / fMass) * fDeltaT2
  860. Else
  861. fXYStrafingSpeed = fXYStrafingSpeed + (fXYStrafingAcceleration + (0.25 * fXYStrafingSpeed * fXYStrafingSpeed * 1.2 * fYZPlaneArea) / fMass) * fDeltaT2
  862. Endif
  863.  
  864. fXYPosDelta = (fXYPosSpeed * fDeltaT) * fUnitsPerMeter
  865. fZPosDelta = (fZPosSpeed * fDeltaT) * fUnitsPerMeter
  866. fXYStrafingDelta = (fXYStrafingSpeed * fDeltaT) * fUnitsPerMeter
  867.  
  868. fYAngleLocal = -atan((fZAngleSpeed * 3.14159 / 180) * fXYPosSpeed / 9.81)
  869. fZAngleLocal = LimitAngle180(fZAngleLocal + fZAngleSpeed * fDeltaT)
  870.  
  871. sy = sin(fYAngleLocal)
  872. cy = cos(fYAngleLocal)
  873. sz = sin(fZAngleLocal)
  874. cz = cos(fZAngleLocal)
  875.  
  876. If(sy * cz == 1) ;### Gimbal Lock condition 1 ###
  877. fXAngleDest = 0
  878. fYAngleDest = 90
  879. fZAngleDest = fZAngleLocal
  880. Elseif(sy * cz == -1) ;### Gimbal Lock condition 2 ###
  881. fXAngleDest = 0
  882. fYAngleDest = -90
  883. fZAngleDest = fZAngleLocal
  884. Else ;### Local Rotation to Global Rotation (reduced formula, only allows local Y and Z rotation) ###
  885. fXAngleDest = atan2(sz * sy, cy)
  886. fYAngleDest = asin(sy * cz)
  887. fZAngleDest = atan2(sz, cz * cy)
  888. Endif
  889.  
  890. fXPosDest = fXPosDest + sin(fZAngleLocal) * fXYPosDelta + cos(fZAngleLocal) * fXYStrafingDelta
  891. fYPosDest = fYPosDest + cos(fZAngleLocal) * fXYPosDelta - sin(fZAngleLocal) * fXYStrafingDelta
  892. fZPosDest = fZPosDest + fZPosDelta
  893.  
  894. ;### Player Stationary Translation Control ###
  895. If(iDASlideFix == 1)
  896.  
  897. fDAPCDistance = GetPlayer().GetDistance(rSkyship)
  898. fXDAPCAngleDif = LimitAngle180(GetPlayer().GetAngleX()) - LimitAngle180(rSkyship.GetAngleX())
  899. fYDAPCAngleDif = LimitAngle180(GetPlayer().GetAngleY()) - LimitAngle180(rSkyship.GetAngleY())
  900. fZDAPCAngleDif = LimitAngle180(GetPlayer().GetAngleZ()) - LimitAngle180(rSkyship.GetAngleZ())
  901.  
  902. fXDAPCDif = GetPlayer().GetPositionX() - rSkyship.GetPositionX()
  903. fYDAPCDif = GetPlayer().GetPositionY() - rSkyship.GetPositionY()
  904. fZDAPCDif = GetPlayer().GetPositionZ() - rSkyship.GetPositionZ()
  905.  
  906. If(fZDAPCDif > 600 || fZDAPCDif < -100) ; Emergency stop
  907.  
  908. If(iDA_Cruise == 1)
  909.  
  910. Notification("Cruise Control Released")
  911. iDA_Cruise = 0
  912.  
  913. Endif
  914.  
  915. sndShipBell.Play(GetPlayer())
  916.  
  917. rSkyShip.StopTranslation()
  918. rSkyShip_Havok.StopTranslation()
  919.  
  920. StopInstance(iCreakID)
  921. StopInstance(iWindID)
  922.  
  923. While(!rSkyShip.Is3DLoaded())
  924. rSkyShip.Enable()
  925. Endwhile
  926.  
  927. GetPlayer().StopTranslation()
  928.  
  929. If(fDAPCFallMult != 0)
  930. SetGameSettingFloat("fJumpFallHeightMult", fDAPCFallMult)
  931. Endif
  932.  
  933. If (iDA_Armed == 1)
  934.  
  935. rSkyship.MoveTo(rSkyship_Havok)
  936.  
  937. While(rSkyShip_Havok.Is3DLoaded())
  938. rSkyShip_Havok.Disable()
  939. Endwhile
  940.  
  941. ShipSetup_Stopped()
  942.  
  943. rSkyship_Stopped.MoveTo(rSkyship)
  944.  
  945. While(!rSkyShip_Stopped.Is3DLoaded())
  946. rSkyShip_Stopped.Enable()
  947. Endwhile
  948.  
  949. Elseif (iDA_Armed == 0)
  950.  
  951. rSkyship.MoveTo(rSkyship_Havok)
  952.  
  953. While(!rSkyShip_Havok.Is3DLoaded())
  954. rSkyShip_Havok.Enable()
  955. Endwhile
  956.  
  957. ShipSetup_Havok()
  958.  
  959. rSkyship_Stopped.MoveTo(rSkyship)
  960.  
  961. While(rSkyShip_Stopped.Is3DLoaded())
  962. rSkyShip_Stopped.Disable()
  963. Endwhile
  964.  
  965. Endif
  966.  
  967. If (iDA_Debug == 1)
  968.  
  969. Trace("Dev Aveza Debug Log: Player Moved to Ship via distance from ship Function")
  970.  
  971. Endif
  972. Gotostate("")
  973. iDA_Fly = 0
  974.  
  975. Endif
  976.  
  977. If (fZPosSpeed > 0.5)
  978. fZDAPCDif = ((GetPlayer().GetPositionZ()) + (fZPosSpeed / 500)) - rSkyship.GetPositionZ()
  979. Elseif (fZPosSpeed < 0.5)
  980. fZDAPCDif = ((GetPlayer().GetPositionZ()) - (fZPosSpeed / 500)) - rSkyship.GetPositionZ()
  981. Endif
  982.  
  983. Endif
  984.  
  985. ;If(IsKeyPressed(iTest))
  986.  
  987. ;Endif
  988.  
  989. fXPosDistance = fXPosDest - rSkyShip.GetPositionX()
  990. fYPosDistance = fYPosDest - rSkyShip.GetPositionY()
  991. fZPosDistance = fZPosDest - rSkyShip.GetPositionZ()
  992.  
  993. fXYZPosDistance = sqrt(fXPosDistance * fXPosDistance + fYPosDistance * fYPosDistance + fZPosDistance * fZPosDistance)
  994. fXYZPosSpeed = fXYZPosDistance / (fDeltaTAvg + 0.25)
  995.  
  996. If(iDASlideFix == 1)
  997.  
  998. fXDAPCPosDistance = (fXDAPCDif + fXPosDest) - GetPlayer().GetPositionX()
  999. fYDAPCPosDistance = (fYDAPCDif + fYPosDest) - GetPlayer().GetPositionY()
  1000. fZDAPCPosDistance = (fZDAPCDif + fZPosDest) - GetPlayer().GetPositionZ()
  1001.  
  1002. fXYZDAPCPosDistance = sqrt(fXDAPCPosDistance * fXDAPCPosDistance + fYDAPCPosDistance * fYDAPCPosDistance + fZDAPCPosDistance * fZDAPCPosDistance)
  1003. fXYZDAPCPosSpeed = (fXYZDAPCPosDistance / (fDeltaTAvg + 0.25)) - fXYZPosSpeed
  1004.  
  1005. Endif
  1006.  
  1007. If(fXYZPosSpeed < 4)
  1008.  
  1009. fXYZAngleDistance = GetAngleDistance(fZAngleDest, rSkyShip.GetAngleZ())
  1010. fXYZAngleSpeed = fXYZAngleDistance / (fDeltaTAvg + 0.25)
  1011.  
  1012. Else
  1013.  
  1014. fXYZAngleSpeed = 0
  1015.  
  1016. Endif
  1017.  
  1018. rSkyShip.TranslateTo(fXPosDest, fYPosDest, fZPosDest, fXAngleDest, fYAngleDest, fZAngleDest, fXYZPosSpeed, fXYZAngleSpeed)
  1019. rSkyShip_Havok.TranslateTo(fXPosDest, fYPosDest, fZPosDest, fXAngleDest, fYAngleDest, fZAngleDest, fXYZPosSpeed, fXYZAngleSpeed)
  1020. ;### Attached for Ship Collision Fix ###
  1021.  
  1022. If(iDASlideFix == 1)
  1023.  
  1024. If(IsKeyPressed(iDAPCForward)||IsKeyPressed(iDAPCBack)||IsKeyPressed(iDAPCLeft)||IsKeyPressed(iDAPCRight)||IsKeyPressed(iDAPCJump))
  1025. GetPlayer().StopTranslation()
  1026. Elseif (fDAPCDistance > 1700)
  1027. rSkyShip.StopTranslation()
  1028. rSkyShip_Havok.StopTranslation()
  1029. GetPlayer().StopTranslation()
  1030. Elseif (fZPosSpeed > 0.5 || fZPosSpeed < -0.5)
  1031. fZAngleSpeed = 0
  1032. GetPlayer().TranslateTo(fXDAPCDif + fXPosDest, fYDAPCDif + fYPosDest, fZDAPCDif + fZPosDest, fXDAPCAngleDif + fXAngleDest, fYDAPCAngleDif + fYAngleDest, fZDAPCAngleDif + fZAngleDest, fXYZPosSpeed, fXYZAngleSpeed)
  1033. Elseif (fZAngleSpeed > 0.2 || fZAngleSpeed < -0.2)
  1034. fZPosSpeed = 0
  1035. GetPlayer().StopTranslation()
  1036. Else
  1037. GetPlayer().TranslateTo(fXDAPCDif + fXPosDest, fYDAPCDif + fYPosDest, fZDAPCDif + fZPosDest, fXDAPCAngleDif + fXAngleDest, fYDAPCAngleDif + fYAngleDest, fZDAPCAngleDif + fZAngleDest, fXYZPosSpeed, fXYZAngleSpeed)
  1038. Endif
  1039.  
  1040. Endif
  1041.  
  1042. SetInstanceVolume(iWindID, fXYZPosSpeed / 1250)
  1043.  
  1044. If(iDA_Cruise == 1)
  1045.  
  1046. fZPosAcceleration = fZPosAccelerationCruise
  1047. fXYPosAcceleration = fXYPosAccelerationCruise
  1048. fZAngleAcceleration = fZAngleAccelerationCruise
  1049. fXYStrafingAcceleration = fXYStrafingAccelerationCruise
  1050.  
  1051. fXYPosSpeed = fXYPosSpeedCruise
  1052. fZPosSpeed = fZPosSpeedCruise
  1053. fXYStrafingSpeed = fXYStrafingSpeedCruise
  1054.  
  1055. fUpwardPower = fUpwardPowerCruise
  1056. fDownwardPower = fDownwardPowerCruise
  1057. fForwardPower = fForwardPowerCruise
  1058. fBackwardPower = fBackwardPowerCruise
  1059. fTurnPower = fTurnPowerCruise
  1060. fStrafePower = fStrafePowerCruise
  1061.  
  1062. Else
  1063. Endif
  1064.  
  1065. If(iLanding && fZPosSpeed < 0.5 && fXYPosSpeed < 0.5 && fZAngleSpeed < 0.5 && fXYStrafingSpeed < 0.5)
  1066.  
  1067. UnregisterForMenu("MapMenu")
  1068. StopShipReset()
  1069.  
  1070. StopInstance(iCreakID)
  1071. StopInstance(iWindID)
  1072.  
  1073. iDA_Fly = 0
  1074.  
  1075. Else
  1076. RegisterForSingleUpdate(0)
  1077. Endif
  1078.  
  1079. Endevent
  1080.  
  1081. Endstate
  1082.  
  1083. float Function atan2(float fY, float fX)
  1084.  
  1085. float fAngle
  1086.  
  1087. If(fX == 0)
  1088.  
  1089. If(fY == 0)
  1090.  
  1091. fAngle = 0
  1092.  
  1093. Elseif(fY > 0)
  1094.  
  1095. fAngle = 90
  1096.  
  1097. Elseif(fY < 0)
  1098.  
  1099. fAngle = -90
  1100.  
  1101. Endif
  1102.  
  1103. Else
  1104.  
  1105. fAngle = atan(fY / fX)
  1106.  
  1107. If(fX < 0)
  1108.  
  1109. If(fY < 0)
  1110.  
  1111. fAngle = fAngle - 180
  1112.  
  1113. Else
  1114.  
  1115. fAngle = fAngle + 180
  1116.  
  1117. Endif
  1118.  
  1119. Endif
  1120.  
  1121. Endif
  1122.  
  1123. Return fAngle
  1124.  
  1125. Endfunction
  1126.  
  1127. float Function GetAngleDistance(float fAngle1, float fAngle2)
  1128.  
  1129. float fDistance = abs(fAngle1 - fAngle2)
  1130.  
  1131. While(fDistance > 180)
  1132. fDistance = fDistance - 360
  1133. Endwhile
  1134.  
  1135. Return abs(fDistance)
  1136.  
  1137. Endfunction
  1138.  
  1139. float Function LimitAngle180(float fAngle)
  1140.  
  1141. While(fAngle < -180)
  1142. fAngle = fAngle + 360
  1143. Endwhile
  1144.  
  1145. While(fAngle > 180)
  1146. fAngle = fAngle - 360
  1147. Endwhile
  1148.  
  1149. Return fAngle
  1150.  
  1151. Endfunction
  1152.  
  1153. Function ShipSetup_Havok()
  1154.  
  1155. rSkyship_Marker.MoveToNode(rSkyship_Havok, "PlayerNode")
  1156.  
  1157. rSkyship_CreakSND.MoveTo(rSkyship_Havok)
  1158.  
  1159. rSkyship_Switch_Plank.MoveToNode(rSkyship_Havok, "PlankswitchNode")
  1160.  
  1161. rSkyShip_Plank.MoveToNode(rSkyShip_Havok, "PlankNode")
  1162.  
  1163. rSkyShip_Light_1.MoveToNode(rSkyShip_Havok, "LampNode_1")
  1164. rSkyShip_Light_2.MoveToNode(rSkyShip_Havok, "LampNode_2")
  1165. rSkyShip_Light_3.MoveToNode(rSkyShip_Havok, "LampNode_3")
  1166. rSkyShip_Light_4.MoveToNode(rSkyShip_Havok, "LampNode_4")
  1167. rSkyShip_Light_5.MoveToNode(rSkyShip_Havok, "LampNode_5")
  1168. rSkyShip_Light_6.MoveToNode(rSkyShip_Havok, "LampNode_6")
  1169. rSkyShip_Light_7.MoveToNode(rSkyShip_Havok, "LampNode_7")
  1170.  
  1171. rSkyship_Switch_Ladder_1.MoveToNode(rSkyship_Havok, "LadderClimbNode_1")
  1172.  
  1173. rSkyShip_Ladder_1.Disable()
  1174. rSkyShip_Ladder_2.Disable()
  1175. rSkyShip_Ladder_3.Disable()
  1176. rSkyShip_Ladder_4.Disable()
  1177. rSkyShip_Ladder_5.Disable()
  1178. rSkyShip_Ladder_6.Disable()
  1179. rSkyShip_Ladder_7.Disable()
  1180. rSkyShip_Ladder_8.Disable()
  1181. rSkyShip_Ladder_9.Disable()
  1182. rSkyShip_Ladder_10.Disable()
  1183. rSkyShip_Ladder_11.Disable()
  1184. rSkyShip_Ladder_12.Disable()
  1185. rSkyShip_Ladder_13.Disable()
  1186. rSkyShip_Ladder_14.Disable()
  1187. rSkyShip_Ladder_15.Disable()
  1188. rSkyShip_Ladder_16.Disable()
  1189. rSkyShip_Ladder_17.Disable()
  1190. rSkyShip_Ladder_18.Disable()
  1191. rSkyShip_Ladder_19.Disable()
  1192. rSkyShip_Ladder_20.Disable()
  1193. rSkyShip_Ladder_21.Disable()
  1194. rSkyShip_Ladder_22.Disable()
  1195. rSkyShip_Ladder_23.Disable()
  1196. rSkyShip_Ladder_24.Disable()
  1197. rSkyShip_Ladder_25.Disable()
  1198. rSkyShip_Ladder_26.Disable()
  1199. rSkyShip_Ladder_27.Disable()
  1200. rSkyShip_Ladder_28.Disable()
  1201. rSkyShip_Ladder_29.Disable()
  1202. rSkyShip_Ladder_30.Disable()
  1203. rSkyShip_Ladder_31.Disable()
  1204. rSkyShip_Ladder_32.Disable()
  1205. rSkyShip_Ladder_33.Disable()
  1206. rSkyShip_Ladder_34.Disable()
  1207. rSkyShip_Ladder_35.Disable()
  1208. rSkyShip_Ladder_36.Disable()
  1209. rSkyShip_Ladder_37.Disable()
  1210. rSkyShip_Ladder_38.Disable()
  1211. rSkyShip_Ladder_39.Disable()
  1212. rSkyShip_Ladder_40.Disable()
  1213. rSkyShip_Ladder_41.Disable()
  1214.  
  1215. rSkyship_Wheel.MoveToNode(rSkyship_Havok, "WheelNode")
  1216.  
  1217. While(!rSkyship_Wheel.Is3DLoaded())
  1218. rSkyship_Wheel.Enable()
  1219. Endwhile
  1220.  
  1221. rSkyship_Hatch.MoveToNode(rSkyship_Havok, "HatchNode")
  1222.  
  1223. While(!rSkyShip_Hatch.Is3DLoaded())
  1224. rSkyShip_Hatch.Enable()
  1225. Endwhile
  1226.  
  1227. rSkyship_Hatch.SetOpen(False)
  1228.  
  1229. While(!rSkyShip_Light_1.Is3DLoaded())
  1230. rSkyShip_Light_1.Enable()
  1231. Endwhile
  1232.  
  1233. Endfunction
  1234.  
  1235. Function ShipSetup_Stopped()
  1236.  
  1237. rSkyship_Marker.MoveToNode(rSkyship_Stopped, "PlayerNode")
  1238.  
  1239. rSkyship_CreakSND.MoveTo(rSkyship_Stopped)
  1240.  
  1241. rSkyship_Switch_Plank.MoveToNode(rSkyship_Stopped, "PlankswitchNode")
  1242.  
  1243. rSkyShip_Plank.MoveToNode(rSkyShip_Stopped, "PlankNode")
  1244.  
  1245. rSkyShip_Light_1.MoveToNode(rSkyShip_Stopped, "LampNode_1")
  1246. rSkyShip_Light_2.MoveToNode(rSkyShip_Stopped, "LampNode_2")
  1247. rSkyShip_Light_3.MoveToNode(rSkyShip_Stopped, "LampNode_3")
  1248. rSkyShip_Light_4.MoveToNode(rSkyShip_Stopped, "LampNode_4")
  1249. rSkyShip_Light_5.MoveToNode(rSkyShip_Stopped, "LampNode_5")
  1250. rSkyShip_Light_6.MoveToNode(rSkyShip_Stopped, "LampNode_6")
  1251. rSkyShip_Light_7.MoveToNode(rSkyShip_Stopped, "LampNode_7")
  1252.  
  1253. rSkyship_Switch_Ladder_1.MoveToNode(rSkyship_Stopped, "LadderClimbNode_1")
  1254.  
  1255. rSkyship_Ladder_1.MoveTo(rSkyship_Stopped)
  1256. rSkyship_Ladder_2.MoveTo(rSkyship_Stopped)
  1257. rSkyship_Ladder_3.MoveTo(rSkyship_Stopped)
  1258. rSkyship_Ladder_4.MoveTo(rSkyship_Stopped)
  1259. rSkyship_Ladder_5.MoveTo(rSkyship_Stopped)
  1260.  
  1261. rSkyShip_Cannon_Bore_R1.MoveToNode(rSkyship_Stopped, "CannonBoreNode_R1")
  1262. rSkyShip_Cannon_Bore_R2.MoveToNode(rSkyship_Stopped, "CannonBoreNode_R2")
  1263. rSkyShip_Cannon_Bore_R3.MoveToNode(rSkyship_Stopped, "CannonBoreNode_R3")
  1264. rSkyShip_Cannon_Bore_R4.MoveToNode(rSkyship_Stopped, "CannonBoreNode_R4")
  1265. rSkyShip_Cannon_Bore_L1.MoveToNode(rSkyship_Stopped, "CannonBoreNode_L1")
  1266. rSkyShip_Cannon_Bore_L2.MoveToNode(rSkyship_Stopped, "CannonBoreNode_L2")
  1267. rSkyShip_Cannon_Bore_L3.MoveToNode(rSkyship_Stopped, "CannonBoreNode_L3")
  1268. rSkyShip_Cannon_Bore_L4.MoveToNode(rSkyship_Stopped, "CannonBoreNode_L4")
  1269.  
  1270. rSkyship_Cannon_R1.MoveToNode(rSkyship_Stopped, "CannonNode_R1")
  1271. rSkyship_Cannon_R2.MoveToNode(rSkyship_Stopped, "CannonNode_R2")
  1272. rSkyship_Cannon_R3.MoveToNode(rSkyship_Stopped, "CannonNode_R3")
  1273. rSkyship_Cannon_R4.MoveToNode(rSkyship_Stopped, "CannonNode_R4")
  1274. rSkyship_Cannon_L1.MoveToNode(rSkyship_Stopped, "CannonNode_L1")
  1275. rSkyship_Cannon_L2.MoveToNode(rSkyship_Stopped, "CannonNode_L2")
  1276. rSkyship_Cannon_L3.MoveToNode(rSkyship_Stopped, "CannonNode_L3")
  1277. rSkyship_Cannon_L4.MoveToNode(rSkyship_Stopped, "CannonNode_L4")
  1278.  
  1279. rSkyship_CannonBall_R1.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1280. rSkyship_CannonBall_R2.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1281. rSkyship_CannonBall_R3.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1282. rSkyship_CannonBall_R4.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1283. rSkyship_CannonBall_L1.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1284. rSkyship_CannonBall_L2.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1285. rSkyship_CannonBall_L3.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1286. rSkyship_CannonBall_L4.MoveTo(rSkyship_Stopped, 0, 0, -100)
  1287.  
  1288. rSkyship_Wheel.MoveToNode(rSkyship_Stopped, "WheelNode")
  1289.  
  1290. While(!rSkyship_Wheel.Is3DLoaded())
  1291. rSkyship_Wheel.Enable()
  1292. Endwhile
  1293.  
  1294. rSkyship_Hatch.MoveToNode(rSkyship_Stopped, "HatchNode")
  1295.  
  1296. While(!rSkyShip_Hatch.Is3DLoaded())
  1297. rSkyShip_Hatch.Enable()
  1298. Endwhile
  1299.  
  1300. rSkyship_Hatch.SetOpen(False)
  1301.  
  1302. While(!rSkyShip_Light_1.Is3DLoaded())
  1303. rSkyShip_Light_1.Enable()
  1304. Endwhile
  1305.  
  1306. While(rSkyShip_Havok.Is3DLoaded())
  1307. rSkyShip_Havok.Disable()
  1308. Endwhile
  1309.  
  1310. Endfunction
  1311.  
  1312. Function StopShipReset()
  1313.  
  1314. rSkyShip.StopTranslation()
  1315. rSkyShip_Havok.StopTranslation()
  1316.  
  1317. While(!rSkyShip.Is3DLoaded())
  1318. rSkyShip.Enable()
  1319. Endwhile
  1320.  
  1321. If(iFlyModeTemp == 0)
  1322.  
  1323. If (iDA_Armed == 1)
  1324.  
  1325. rSkyship.MoveTo(rSkyship_Havok)
  1326. rSkyship_Stopped.MoveTo(rSkyship)
  1327.  
  1328. While(!rSkyShip_Stopped.Is3DLoaded())
  1329. rSkyShip_Stopped.Enable()
  1330. Endwhile
  1331.  
  1332. GetPlayer().SetVehicle(None)
  1333.  
  1334. If iDA_Beacon == 0
  1335. GetPlayer().MoveToNode(rSkyShip_Stopped, "PlayerNode")
  1336. Else
  1337. Endif
  1338.  
  1339. GetPlayer().SetAlpha(1)
  1340.  
  1341. ShipSetup_Stopped()
  1342.  
  1343. While(rSkyShip_Havok.Is3DLoaded())
  1344. rSkyShip_Havok.Disable()
  1345. Endwhile
  1346.  
  1347. Elseif (iDA_Armed == 0)
  1348.  
  1349. rSkyship.MoveTo(rSkyship_Havok)
  1350. rSkyship_Stopped.MoveTo(rSkyship)
  1351.  
  1352. While(!rSkyShip_Havok.Is3DLoaded())
  1353. rSkyShip_Havok.Enable()
  1354. Endwhile
  1355.  
  1356. GetPlayer().SetVehicle(None)
  1357.  
  1358. If iDA_Beacon == 0
  1359. GetPlayer().MoveToNode(rSkyShip_Havok, "PlayerNode")
  1360. Else
  1361. Endif
  1362.  
  1363. GetPlayer().SetAlpha(1)
  1364.  
  1365. ShipSetup_Havok()
  1366.  
  1367. While(rSkyShip_Stopped.Is3DLoaded())
  1368. rSkyShip_Stopped.Disable()
  1369. Endwhile
  1370.  
  1371. Endif
  1372.  
  1373. If (iDA_Debug == 1)
  1374.  
  1375. Trace("Dev Aveza Debug Log: Player Moved to Ship via DeActivation Function 'Attached to Ship'")
  1376.  
  1377. Endif
  1378.  
  1379. Elseif(iFlyModeTemp == 1)
  1380.  
  1381. If(iDASlideFix == 1)
  1382. GetPlayer().StopTranslation()
  1383. Endif
  1384.  
  1385. If(fDAPCFallMult != 0)
  1386. SetGameSettingFloat("fJumpFallHeightMult", fDAPCFallMult)
  1387. Endif
  1388.  
  1389. SetGodMode(True)
  1390.  
  1391. If (iDA_Armed == 1)
  1392.  
  1393. rSkyship.MoveTo(rSkyship_Havok)
  1394. rSkyship_Stopped.MoveTo(rSkyship)
  1395.  
  1396. While(!rSkyShip_Stopped.Is3DLoaded())
  1397. rSkyShip_Stopped.Enable()
  1398. Endwhile
  1399.  
  1400. If iDA_Beacon == 0
  1401. GetPlayer().MoveToNode(rSkyShip_Stopped, "PlayerNode")
  1402. Else
  1403. Endif
  1404.  
  1405. ShipSetup_Stopped()
  1406.  
  1407. Elseif (iDA_Armed == 0)
  1408.  
  1409. rSkyship.MoveTo(rSkyship_Havok)
  1410. rSkyship_Stopped.MoveTo(rSkyship)
  1411.  
  1412. While(!rSkyShip_Havok.Is3DLoaded())
  1413. rSkyShip_Havok.Enable()
  1414. Endwhile
  1415.  
  1416. If iDA_Beacon == 0
  1417. GetPlayer().MoveToNode(rSkyShip_Havok, "PlayerNode")
  1418. Else
  1419. Endif
  1420.  
  1421. ShipSetup_Havok()
  1422.  
  1423. While(rSkyShip_Stopped.Is3DLoaded())
  1424. rSkyShip_Stopped.Disable()
  1425. Endwhile
  1426.  
  1427. Endif
  1428.  
  1429. If Game.IsFastTravelEnabled() == False && iDA_Fly == 0 && bFastTravel == True
  1430. Game.EnableFastTravel()
  1431. Else
  1432. Endif
  1433.  
  1434. If (iDA_Debug == 1)
  1435.  
  1436. Trace("Dev Aveza Debug Log: Player Moved to Ship via DeActivation Function 'Movable on Deck'")
  1437.  
  1438. Endif
  1439.  
  1440. Endif
  1441.  
  1442. SetGodMode(False)
  1443.  
  1444. Gotostate("")
  1445.  
  1446. Endfunction
Advertisement
Add Comment
Please, Sign In to add comment