Guest User

Untitled

a guest
Aug 29th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.68 KB | None | 0 0
  1. ScriptName _DA_Skyship_Ladder_Switch_v1 extends ObjectReference
  2.  
  3. Import Utility
  4. Import Game
  5.  
  6. _DA_Skyship_v1 Property rSkyShip Auto
  7.  
  8. float fDepthCheck
  9. float fXPOS
  10. float fYPOS
  11.  
  12. float fXPOSDest
  13. float fYPOSDest
  14. float fZPOSDest
  15. float fZPosOffSet
  16. Actor Property ZOffset Auto Hidden
  17.  
  18. Event OnActivate(ObjectReference akActionRef)
  19.  
  20. If(rSkyship.rSkyship_Ladder_1.Is3DLoaded())
  21.  
  22. GetPlayer().MoveTo(rSkyship.rSkyship_Ladder_Marker)
  23.  
  24. Wait(0.5)
  25.  
  26. Actor FollowerActor = (DialogueFollower.getAlias(0) as ReferenceAlias).getReference() as Actor
  27.  
  28. If (FollowerActor != "NONE")
  29. SummonToPlayer(FollowerActor)
  30. Endif
  31.  
  32. Wait(0.25)
  33.  
  34. If (FollowerActor != "NONE")
  35. SummonToPlayer(FollowerActor)
  36. Endif
  37.  
  38. Elseif(!rSkyship.rSkyship_Ladder_1.Is3DLoaded())
  39.  
  40. Debug.Notification("Calculating Elevation...")
  41.  
  42. ResetDepthCheck()
  43.  
  44. Wait (4.0)
  45.  
  46. If(rSkyship.iDA_Armed == 1)
  47.  
  48. fDepthcheck = rSkyship.rSkyShip_Stopped.GetPositionZ() - ZOffset.GetPositionZ()
  49.  
  50. Elseif(rSkyship.iDA_Armed == 0)
  51.  
  52. fDepthcheck = rSkyship.rSkyShip_Havok.GetPositionZ() - ZOffset.GetPositionZ()
  53.  
  54. Endif
  55.  
  56. If(fDepthCheck > 1870)
  57. Debug.Notification("Altitude Exceeds Safe Debarkation Distance.")
  58. Debug.Notification("Distance: Exceeds 1870")
  59.  
  60. Elseif(fDepthCheck < 1870)
  61. Debug.Notification("Distance: " + fDepthCheck + " / 1870")
  62. Debug.Notification("Elevation is within limits: Deploying Ladder.")
  63. If(fDepthCheck < 200)
  64. Debug.Notification("Depth Check system error, please try again.")
  65. Else
  66.  
  67. If fXPOS - fXPOSDest < 25 && fXPOS - fXPOSDest > -25 || fYPOS - fYPOSDest < 25 && fYPOS - fYPOSDest > -25
  68.  
  69. rSkyship.rSkyship_Ladder_Marker.MoveTo(ZOffset)
  70. rSkyship.rSkyship_Ladder_Marker.SetAngle(ZOffset.GetAngleX(), ZOffset.GetAngleY(), 0)
  71. If fXPOS - fXPOSDest > 0 && fXPOS - fXPOSDest > fYPOS - fYPOSDest
  72. fZPOSOffSet = fXPOS - fXPOSDest
  73. Elseif fYPOS - fYPOSDest > 0 && fYPOS - fYPOSDest > fXPOS - fXPOSDest
  74. fZPOSOffSet = fYPOS - fYPOSDest
  75. Elseif fXPOS - fXPOSDest < 0 && fXPOS - fXPOSDest < fYPOS - fYPOSDest
  76. fZPOSOffSet = (fXPOS - fXPOSDest) * -1
  77. Elseif fYPOS - fYPOSDest < 0 && fYPOS - fYPOSDest < fXPOS - fXPOSDest
  78. fZPOSOffSet = (fYPOS - fYPOSDest) * -1
  79. Endif
  80.  
  81. If fZPOSOffSet > 400
  82. Debug.Notification("Terrain too unstable for deployment")
  83. Return
  84. Endif
  85.  
  86. Else
  87. ZOffset.SetPosition(fXPOS, fYPOS, fZPOSDest + fZPOSOffSet)
  88. rSkyship.rSkyship_Ladder_Marker.MoveTo(ZOffset)
  89. rSkyship.rSkyship_Ladder_Marker.SetAngle(ZOffset.GetAngleX(), ZOffset.GetAngleY(), 0)
  90. Endif
  91.  
  92. Debug.Notification("Elevation is within limits: Deploying Ladder.")
  93.  
  94. If fDepthCheck > 200
  95. rSkyship.rSkyship_Ladder_1.MoveTo(rSkyship.rSkyship)
  96. rSkyship.rSkyship_Ladder_1.Enable()
  97. Endif
  98.  
  99. If fDepthCheck > 383
  100. rSkyship.rSkyship_Ladder_2.MoveTo(rSkyship.rSkyship)
  101. rSkyship.rSkyship_Ladder_2.Enable()
  102. Endif
  103.  
  104. If fDepthCheck > 421
  105. rSkyship.rSkyship_Ladder_3.MoveTo(rSkyship.rSkyship)
  106. rSkyship.rSkyship_Ladder_3.MoveTo(rSkyship.rSkyship_Ladder_2, 0, 0, -38)
  107. rSkyship.rSkyship_Ladder_3.Enable()
  108. Endif
  109.  
  110. If fDepthCheck > 459
  111. rSkyship.rSkyship_Ladder_4.MoveTo(rSkyship.rSkyship)
  112. rSkyship.rSkyship_Ladder_4.MoveTo(rSkyship.rSkyship_Ladder_3, 0, 0, -38)
  113. rSkyship.rSkyship_Ladder_4.Enable()
  114. Endif
  115.  
  116. If fDepthCheck > 497
  117. rSkyship.rSkyship_Ladder_5.MoveTo(rSkyship.rSkyship)
  118. rSkyship.rSkyship_Ladder_5.MoveTo(rSkyship.rSkyship_Ladder_4, 0, 0, -38)
  119. rSkyship.rSkyship_Ladder_5.Enable()
  120. Endif
  121.  
  122. If fDepthCheck > 535
  123. rSkyship.rSkyship_Ladder_6.MoveTo(rSkyship.rSkyship)
  124. rSkyship.rSkyship_Ladder_6.MoveTo(rSkyship.rSkyship_Ladder_5, 0, 0, -38)
  125. rSkyship.rSkyship_Ladder_6.Enable()
  126. Endif
  127.  
  128. If fDepthCheck > 573
  129. rSkyship.rSkyship_Ladder_7.MoveTo(rSkyship.rSkyship)
  130. rSkyship.rSkyship_Ladder_7.MoveTo(rSkyship.rSkyship_Ladder_6, 0, 0, -38)
  131. rSkyship.rSkyship_Ladder_7.Enable()
  132. Endif
  133.  
  134. If fDepthCheck > 611
  135. rSkyship.rSkyship_Ladder_8.MoveTo(rSkyship.rSkyship)
  136. rSkyship.rSkyship_Ladder_8.MoveTo(rSkyship.rSkyship_Ladder_7, 0, 0, -38)
  137. rSkyship.rSkyship_Ladder_8.Enable()
  138. Endif
  139.  
  140. If fDepthCheck > 649
  141. rSkyship.rSkyship_Ladder_9.MoveTo(rSkyship.rSkyship)
  142. rSkyship.rSkyship_Ladder_9.MoveTo(rSkyship.rSkyship_Ladder_8, 0, 0, -38)
  143. rSkyship.rSkyship_Ladder_9.Enable()
  144. Endif
  145.  
  146. If fDepthCheck > 687
  147. rSkyship.rSkyship_Ladder_10.MoveTo(rSkyship.rSkyship)
  148. rSkyship.rSkyship_Ladder_10.MoveTo(rSkyship.rSkyship_Ladder_9, 0, 0, -38)
  149. rSkyship.rSkyship_Ladder_10.Enable()
  150. Endif
  151.  
  152. If fDepthCheck > 725
  153. rSkyship.rSkyship_Ladder_11.MoveTo(rSkyship.rSkyship)
  154. rSkyship.rSkyship_Ladder_11.MoveTo(rSkyship.rSkyship_Ladder_10, 0, 0, -38)
  155. rSkyship.rSkyship_Ladder_11.Enable()
  156. Endif
  157.  
  158. If fDepthCheck > 763
  159. rSkyship.rSkyship_Ladder_12.MoveTo(rSkyship.rSkyship)
  160. rSkyship.rSkyship_Ladder_12.MoveTo(rSkyship.rSkyship_Ladder_11, 0, 0, -38)
  161. rSkyship.rSkyship_Ladder_12.Enable()
  162. Endif
  163.  
  164. If fDepthCheck > 801
  165. rSkyship.rSkyship_Ladder_13.MoveTo(rSkyship.rSkyship)
  166. rSkyship.rSkyship_Ladder_13.MoveTo(rSkyship.rSkyship_Ladder_12, 0, 0, -38)
  167. rSkyship.rSkyship_Ladder_13.Enable()
  168. Endif
  169.  
  170. If fDepthCheck > 839
  171. rSkyship.rSkyship_Ladder_14.MoveTo(rSkyship.rSkyship)
  172. rSkyship.rSkyship_Ladder_14.MoveTo(rSkyship.rSkyship_Ladder_13, 0, 0, -38)
  173. rSkyship.rSkyship_Ladder_14.Enable()
  174. Endif
  175.  
  176. If fDepthCheck > 877
  177. rSkyship.rSkyship_Ladder_15.MoveTo(rSkyship.rSkyship)
  178. rSkyship.rSkyship_Ladder_15.MoveTo(rSkyship.rSkyship_Ladder_14, 0, 0, -38)
  179. rSkyship.rSkyship_Ladder_15.Enable()
  180. Endif
  181.  
  182. If fDepthCheck > 915
  183. rSkyship.rSkyship_Ladder_16.MoveTo(rSkyship.rSkyship)
  184. rSkyship.rSkyship_Ladder_16.MoveTo(rSkyship.rSkyship_Ladder_15, 0, 0, -38)
  185. rSkyship.rSkyship_Ladder_16.Enable()
  186. Endif
  187.  
  188. If fDepthCheck > 953
  189. rSkyship.rSkyship_Ladder_17.MoveTo(rSkyship.rSkyship)
  190. rSkyship.rSkyship_Ladder_17.MoveTo(rSkyship.rSkyship_Ladder_16, 0, 0, -38)
  191. rSkyship.rSkyship_Ladder_17.Enable()
  192. Endif
  193.  
  194. If fDepthCheck > 991
  195. rSkyship.rSkyship_Ladder_18.MoveTo(rSkyship.rSkyship)
  196. rSkyship.rSkyship_Ladder_18.MoveTo(rSkyship.rSkyship_Ladder_17, 0, 0, -38)
  197. rSkyship.rSkyship_Ladder_18.Enable()
  198. Endif
  199.  
  200. If fDepthCheck > 1029
  201. rSkyship.rSkyship_Ladder_19.MoveTo(rSkyship.rSkyship)
  202. rSkyship.rSkyship_Ladder_19.MoveTo(rSkyship.rSkyship_Ladder_18, 0, 0, -38)
  203. rSkyship.rSkyship_Ladder_19.Enable()
  204. Endif
  205.  
  206. If fDepthCheck > 1067
  207. rSkyship.rSkyship_Ladder_20.MoveTo(rSkyship.rSkyship)
  208. rSkyship.rSkyship_Ladder_20.MoveTo(rSkyship.rSkyship_Ladder_19, 0, 0, -38)
  209. rSkyship.rSkyship_Ladder_20.Enable()
  210. Endif
  211.  
  212. If fDepthCheck > 1105
  213. rSkyship.rSkyship_Ladder_21.MoveTo(rSkyship.rSkyship)
  214. rSkyship.rSkyship_Ladder_21.MoveTo(rSkyship.rSkyship_Ladder_20, 0, 0, -38)
  215. rSkyship.rSkyship_Ladder_21.Enable()
  216. Endif
  217.  
  218. If fDepthCheck > 1143
  219. rSkyship.rSkyship_Ladder_22.MoveTo(rSkyship.rSkyship)
  220. rSkyship.rSkyship_Ladder_22.MoveTo(rSkyship.rSkyship_Ladder_21, 0, 0, -38)
  221. rSkyship.rSkyship_Ladder_22.Enable()
  222. Endif
  223.  
  224. If fDepthCheck > 1181
  225. rSkyship.rSkyship_Ladder_23.MoveTo(rSkyship.rSkyship)
  226. rSkyship.rSkyship_Ladder_23.MoveTo(rSkyship.rSkyship_Ladder_22, 0, 0, -38)
  227. rSkyship.rSkyship_Ladder_23.Enable()
  228. Endif
  229.  
  230. If fDepthCheck > 1219
  231. rSkyship.rSkyship_Ladder_24.MoveTo(rSkyship.rSkyship)
  232. rSkyship.rSkyship_Ladder_24.MoveTo(rSkyship.rSkyship_Ladder_23, 0, 0, -38)
  233. rSkyship.rSkyship_Ladder_24.Enable()
  234. Endif
  235.  
  236. If fDepthCheck > 1257
  237. rSkyship.rSkyship_Ladder_25.MoveTo(rSkyship.rSkyship)
  238. rSkyship.rSkyship_Ladder_25.MoveTo(rSkyship.rSkyship_Ladder_24, 0, 0, -38)
  239. rSkyship.rSkyship_Ladder_25.Enable()
  240. Endif
  241.  
  242. If fDepthCheck > 1295
  243. rSkyship.rSkyship_Ladder_26.MoveTo(rSkyship.rSkyship)
  244. rSkyship.rSkyship_Ladder_26.MoveTo(rSkyship.rSkyship_Ladder_25, 0, 0, -38)
  245. rSkyship.rSkyship_Ladder_26.Enable()
  246. Endif
  247.  
  248. If fDepthCheck > 1333
  249. rSkyship.rSkyship_Ladder_27.MoveTo(rSkyship.rSkyship)
  250. rSkyship.rSkyship_Ladder_27.MoveTo(rSkyship.rSkyship_Ladder_26, 0, 0, -38)
  251. rSkyship.rSkyship_Ladder_27.Enable()
  252. Endif
  253.  
  254. If fDepthCheck > 1371
  255. rSkyship.rSkyship_Ladder_28.MoveTo(rSkyship.rSkyship)
  256. rSkyship.rSkyship_Ladder_28.MoveTo(rSkyship.rSkyship_Ladder_27, 0, 0, -38)
  257. rSkyship.rSkyship_Ladder_28.Enable()
  258. Endif
  259.  
  260. If fDepthCheck > 1409
  261. rSkyship.rSkyship_Ladder_29.MoveTo(rSkyship.rSkyship)
  262. rSkyship.rSkyship_Ladder_29.MoveTo(rSkyship.rSkyship_Ladder_28, 0, 0, -38)
  263. rSkyship.rSkyship_Ladder_29.Enable()
  264. Endif
  265.  
  266. If fDepthCheck > 1447
  267. rSkyship.rSkyship_Ladder_30.MoveTo(rSkyship.rSkyship)
  268. rSkyship.rSkyship_Ladder_30.MoveTo(rSkyship.rSkyship_Ladder_29, 0, 0, -38)
  269. rSkyship.rSkyship_Ladder_30.Enable()
  270. Endif
  271.  
  272. If fDepthCheck > 1485
  273. rSkyship.rSkyship_Ladder_31.MoveTo(rSkyship.rSkyship)
  274. rSkyship.rSkyship_Ladder_31.MoveTo(rSkyship.rSkyship_Ladder_30, 0, 0, -38)
  275. rSkyship.rSkyship_Ladder_31.Enable()
  276. Endif
  277.  
  278. If fDepthCheck > 1523
  279. rSkyship.rSkyship_Ladder_32.MoveTo(rSkyship.rSkyship)
  280. rSkyship.rSkyship_Ladder_32.MoveTo(rSkyship.rSkyship_Ladder_31, 0, 0, -38)
  281. rSkyship.rSkyship_Ladder_32.Enable()
  282. Endif
  283.  
  284. If fDepthCheck > 1561
  285. rSkyship.rSkyship_Ladder_33.MoveTo(rSkyship.rSkyship)
  286. rSkyship.rSkyship_Ladder_33.MoveTo(rSkyship.rSkyship_Ladder_32, 0, 0, -38)
  287. rSkyship.rSkyship_Ladder_33.Enable()
  288. Endif
  289.  
  290. If fDepthCheck > 1599
  291. rSkyship.rSkyship_Ladder_34.MoveTo(rSkyship.rSkyship)
  292. rSkyship.rSkyship_Ladder_34.MoveTo(rSkyship.rSkyship_Ladder_33, 0, 0, -38)
  293. rSkyship.rSkyship_Ladder_34.Enable()
  294. Endif
  295.  
  296. If fDepthCheck > 1637
  297. rSkyship.rSkyship_Ladder_35.MoveTo(rSkyship.rSkyship)
  298. rSkyship.rSkyship_Ladder_35.MoveTo(rSkyship.rSkyship_Ladder_34, 0, 0, -38)
  299. rSkyship.rSkyship_Ladder_35.Enable()
  300. Endif
  301.  
  302. If fDepthCheck > 1675
  303. rSkyship.rSkyship_Ladder_36.MoveTo(rSkyship.rSkyship)
  304. rSkyship.rSkyship_Ladder_36.MoveTo(rSkyship.rSkyship_Ladder_35, 0, 0, -38)
  305. rSkyship.rSkyship_Ladder_36.Enable()
  306. Endif
  307.  
  308. If fDepthCheck > 1713
  309. rSkyship.rSkyship_Ladder_37.MoveTo(rSkyship.rSkyship)
  310. rSkyship.rSkyship_Ladder_37.MoveTo(rSkyship.rSkyship_Ladder_36, 0, 0, -38)
  311. rSkyship.rSkyship_Ladder_37.Enable()
  312. Endif
  313.  
  314. If fDepthCheck > 1751
  315. rSkyship.rSkyship_Ladder_38.MoveTo(rSkyship.rSkyship)
  316. rSkyship.rSkyship_Ladder_38.MoveTo(rSkyship.rSkyship_Ladder_37, 0, 0, -38)
  317. rSkyship.rSkyship_Ladder_38.Enable()
  318. Endif
  319.  
  320. If fDepthCheck > 1789
  321. rSkyship.rSkyship_Ladder_39.MoveTo(rSkyship.rSkyship)
  322. rSkyship.rSkyship_Ladder_39.MoveTo(rSkyship.rSkyship_Ladder_38, 0, 0, -38)
  323. rSkyship.rSkyship_Ladder_39.Enable()
  324. Endif
  325.  
  326. If fDepthCheck > 1827
  327. rSkyship.rSkyship_Ladder_40.MoveTo(rSkyship.rSkyship)
  328. rSkyship.rSkyship_Ladder_40.MoveTo(rSkyship.rSkyship_Ladder_39, 0, 0, -38)
  329. rSkyship.rSkyship_Ladder_40.Enable()
  330. Endif
  331.  
  332. If fDepthCheck > 1860
  333. rSkyship.rSkyship_Ladder_41.MoveTo(rSkyship.rSkyship)
  334. rSkyship.rSkyship_Ladder_41.MoveTo(rSkyship.rSkyship_Ladder_40, 0, 0, -38)
  335. rSkyship.rSkyship_Ladder_41.Enable()
  336. Endif
  337.  
  338. Endif
  339.  
  340. ZOffset.Disable()
  341. ZOffset.Delete()
  342.  
  343. Endif
  344.  
  345. Endif
  346.  
  347. Endevent
  348.  
  349. Function ResetDepthCheck()
  350.  
  351. If(rSkyship.iDA_Armed == 1)
  352.  
  353. ZOffset = GetPlayer().PlaceActorAtMe(rSkyship.aZCheckFox, 1)
  354. ZOffset.SetAlpha(0)
  355. ZOffset.MoveToNode(rSkyship.rSkyship_Stopped, "DepthStart")
  356.  
  357. Elseif(rSkyship.iDA_Armed == 0)
  358. ZOffset = GetPlayer().PlaceActorAtMe(rSkyship.aZCheckFox, 1)
  359. ZOffset.SetAlpha(0)
  360. ZOffset.MoveToNode(rSkyship.rSkyship_Havok, "DepthStart")
  361.  
  362. Endif
  363.  
  364. Endfunction
  365.  
  366. Function SummonToPlayer (Actor Act)
  367. If (Act.GetActorValue("WaitingForPlayer") == 0)
  368. Act.MoveTo(Game.GetPlayer())
  369. Endif
  370. Endfunction
  371.  
  372. Quest Property DialogueFollower Auto
Add Comment
Please, Sign In to add comment