Advertisement
Chaquator

jumping hoverchip mod for goy

Jul 12th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. @name Chaqua Hovercraft Base
  2. @persist [E P Dri]:entity PWrk VSV Ign VelLL Mul Ntrpl HoverHeight FlyAng SpeedMultiplier YawSpeed JumpForce
  3. @model models/hunter/blocks/cube1x2x05.mdl
  4.  
  5. #[
  6. Summary of my edits:
  7. Added a "JumpForce" variable and the bit of code that uses it
  8. lines 2, 45 , and 131
  9. Added an Alt key variable, which is the walk key, and changed the code so that pressing your walk key will make you turn up
  10. lines 65 , 131
  11. Upped the hover height so that it's harder to crash into the ground as a result of the anti-velocity being turned down when you fall
  12. line 46
  13. Speaking of anti-velocity, changed the 0.045 in "VelL * vec(0.025, 0.006125, 0.045)" to "0.025 * (VelL:z() < 0 ? 1 : 0.25)
  14. line 131
  15. Added an empty if conditional that activates when you press space to jump
  16. line 138 through 141
  17.  
  18. Message:
  19. so uh you can change the variable JumpForce in order to make yourself jump higher
  20. ]#
  21.  
  22. interval(90)
  23.  
  24. if(duped() | dupefinished())
  25. {
  26. reset()
  27. }
  28.  
  29. if(first())
  30. {
  31. Ntrpl = 90/(500/33) #If your hovercraft is spazzing out, try lowing that 90 in the interval (Line 4) and this line here. Warning: Decreasing the interval will increase the ops usage.
  32.  
  33. E = entity()
  34. P = entity():isConstrainedTo()
  35.  
  36. E:setMass(5000)
  37. E:propFreeze(0)
  38.  
  39. soundPlay("idl", 0, "vehicles/diesel_loop2.wav")
  40. soundPlay("thr", 0, "ambient/machines/turbine_loop_2.wav")
  41. soundPitch("idl", 0)
  42. soundPitch("thr", 0)
  43.  
  44. rangerHitWater(1)
  45. rangerPersist(1)
  46.  
  47. #Settings:
  48. JumpForce = 200
  49. HoverHeight = 80 #Self-explanitory
  50. FlyAng = -25 #Angle at which you want to fly towards when you hold Space
  51. SpeedMultiplier = 1 #Mess with this number if you wanna fly fast
  52. YawSpeed = 8 #Speed at which the hovercraft turns left and right
  53. }
  54.  
  55. if(PWrk)
  56. {
  57. Dri = P:driver()
  58. Act = P:driver():isValid()
  59.  
  60. if(Act)
  61. {
  62. W = Dri:keyForward()
  63. A = Dri:keyLeft()
  64. S = Dri:keyBack()
  65. D = Dri:keyRight()
  66. Shi = Dri:keySprint()
  67. Spc = Dri:keyJump()
  68. Alt = Dri:keyWalk()
  69. R = Dri:keyReload()
  70. M1 = Dri:keyAttack1()
  71. M2 = Dri:keyAttack2()
  72.  
  73. if(changed(R) & R)
  74. {
  75. Ign = !Ign
  76. soundStop("fail")
  77. soundPitch("thr", 0)
  78. soundPlay("ignv", Ign ? 0.874 : 1.13, Ign ? "hl1/fvox/activated.wav" : "hl1/fvox/deactivated.wav")
  79. }
  80. }
  81.  
  82. Mul += Ign ? 0.125 : -0.125
  83. Mul = clamp(Mul, 0, 1)
  84. if(changed(Mul))
  85. {
  86. soundPitch("idl", Mul*65)
  87. }
  88.  
  89. if(changed(P))
  90. {
  91. PWrk = P:isValid()
  92. }
  93.  
  94. VelLL = E:vel():length()
  95. DV = $VelLL
  96. }else
  97. {
  98. findByClass("prop_vehicle_prisoner_pod")
  99. findSortByDistance(E:pos())
  100. if(find():model() == "models/nova/airboat_seat.mdl" & find():owner() == owner())
  101. {
  102. P = find()
  103. P:setPos(E:toWorld(vec(0, 5.5, 17.25))) #Mess with that vector to change the offset position of the chair
  104. P:setAng(E:toWorld(ang(0, 180, 0))) #If you DO want your chair to face backwards or something, go ahead and mess with this
  105.  
  106. timer("parent", 20)
  107. }
  108. if(clk("parent"))
  109. {
  110. stoptimer("parent")
  111.  
  112. P:parentTo(E)
  113.  
  114. rangerFilter(array(E, P))
  115.  
  116. PWrk = 1
  117. }
  118. }
  119.  
  120. if(Ign)
  121. {
  122. VelL = E:velL()
  123. VSV = clamp(-E:velL():y()/7.5, -1500, 1500)
  124.  
  125. if(changed(VSV))
  126. {
  127. soundPitch("thr", abs(VSV))
  128. }
  129.  
  130. GR = rangerOffset(HoverHeight, E:pos() + (E:right() * clamp(VSV, 0, 1500)), vec(0, 0, -1))
  131. FR = rangerOffset(25 + clamp(VSV, 0, 1500), mix(E:pos(), GR:pos(), 0.5), E:right())
  132.  
  133. #applyForce(((vec(0, 0, (HoverHeight - GR:distance()) * GR:hit()))*0.75 + (E:right() * (W-S) * SpeedMultiplier * (10 * 1 + Spc*3 + Shi*4 + FR:hit() * 3)) - E:toWorldAxis(VelL * vec(0.025, 0.006125, 0.045))) * E:mass() * Ntrpl)
  134. applyForce(((vec(0, 0, (HoverHeight - GR:distance()) * GR:hit()))*0.75 + vec(0, 0, JumpForce * (changed(Spc) & Spc) * GR:hit()) + (E:right() * (W-S) * SpeedMultiplier * (10 * 1 + Spc*3 + Shi*4 + FR:hit() * 3)) - E:toWorldAxis(VelL * vec(0.025, 0.006125, 0.045 * (VelL:z() < 0 ? 1 : 0.25)))) * E:mass() * Ntrpl)
  135.  
  136. applyAngForce(((ang(E:angVel():yaw() / 6 - (2 * !GR:hit()), (A-D) * YawSpeed, ((Alt * FlyAng * (W-S)) + clamp((E:angles():roll() - 35) * FR:hit() * W, -90, 0)) * (W|S)) - E:angles()*ang(1, 0, 1))*5 - E:angVel()/ang(2.5, 2.5, 1.5)) * E:mass() * Ntrpl)
  137.  
  138. if(changed(Spc) & Spc) #If you jumped, basically
  139. {
  140. #Here's where you'd put a soundPlay method to play a sound when you jump
  141. }
  142.  
  143. if(DV < -200) #Mess with the number if you wanna change the resistence to crashing
  144. {
  145. Ign = 0
  146. soundStop("ignv")
  147. soundPitch("thr", 0)
  148. soundPlay("crash", 0.8, "vehicles/v8/vehicle_impact_heavy"+randint(1, 4):toString()+".wav")
  149. soundPlay("fail", 4.176, "hl1/fvox/hev_critical_fail.wav")
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement