Advertisement
Guest User

Untitled

a guest
Sep 18th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.64 KB | None | 0 0
  1.  
  2. include "constants.lua"
  3.  
  4. -- pieces
  5. local head = piece "head"
  6. local hips = piece "hips"
  7. local chest = piece "chest"
  8.  
  9. -- left arm
  10. local lshoulder = piece "lshoulder"
  11. local lforearm = piece "lforearm"
  12. local halberd = piece "halberd"
  13. local blade = piece "blade"
  14.  
  15. -- right arm
  16. local rshoulder = piece "rshoulder"
  17. local rforearm = piece "rforearm"
  18.  
  19. -- left leg
  20. local lthigh = piece "lthigh"
  21. local lshin = piece "lshin"
  22. local lfoot = piece "lfoot"
  23.  
  24. -- right leg
  25. local rthigh = piece "rthigh"
  26. local rshin = piece "rshin"
  27. local rfoot = piece "rfoot"
  28.  
  29. local smokePiece = {head, hips, chest}
  30.  
  31.  
  32. --constants
  33. local runspeed = 6
  34. local steptime = 40
  35.  
  36. -- variables
  37. local firing = 0
  38.  
  39. --signals
  40. local SIG_Restore = 1
  41. local SIG_Walk = 2
  42. local SIG_Aim = 4
  43. local SIG_Idle = 6
  44.  
  45. function script.Create()
  46. StartThread(SmokeUnit, smokePiece)
  47. Turn(lforearm, x_axis, 0, 2)
  48. Turn(lshoulder, z_axis, - 0.9, 6)
  49. Turn(lshoulder, x_axis, - 0.8, 6)
  50. Turn(lforearm, y_axis, - 1, 5)
  51. Turn(halberd, z_axis, 0, 5)
  52. end
  53.  
  54. local idle = false
  55.  
  56. local function RestoreFromIdle ()
  57. idle = false
  58. Turn (rthigh, y_axis, 0, math.rad(60))
  59. Turn (lthigh, y_axis, 0, math.rad(100))
  60. Turn (rthigh, x_axis, 0, math.rad(100))
  61. Turn (lthigh, x_axis, 0, math.rad(60))
  62. Turn (rshin, z_axis, 0, math.rad(60))
  63. Turn (lshin, z_axis, 0, math.rad(60))
  64. Turn (rshin, x_axis, 0, math.rad(60))
  65. Turn (lshin, x_axis, 0, math.rad(160))
  66. Turn (rfoot, z_axis, 0, math.rad(50))
  67. Turn (rfoot, x_axis, 0, math.rad(40))
  68. Turn (lfoot, x_axis, 0, math.rad(110))
  69. Turn (lfoot, z_axis, 0, math.rad(40))
  70. Move (hips, y_axis, 0, 10)
  71. Turn (head, y_axis, 0, math.rad(70))
  72. Turn (rshoulder, x_axis, 0, math.rad(150))
  73. Turn (rforearm, x_axis, 0, math.rad(34.38))
  74. Turn (rforearm, y_axis, 0, math.rad(-126))
  75. Turn (rforearm, z_axis, 0, math.rad(57.3))
  76. Turn (lshoulder, z_axis, 0, math.rad(60))
  77. Turn (lshoulder, x_axis, 0, math.rad(60))
  78. Turn (lforearm, x_axis, 0, math.rad(60))
  79. Turn (lforearm, y_axis, 0, math.rad(120))
  80. Move (halberd, z_axis, 0, 30)
  81. Turn (chest, y_axis, 0, math.rad(140))
  82. end
  83.  
  84. local function Idle ()
  85. Signal (SIG_Idle)
  86. SetSignalMask (SIG_Idle)
  87. Sleep (5000)
  88. idle = true
  89. Turn (rthigh, y_axis, math.rad(-30), math.rad(60))
  90. Turn (lthigh, y_axis, math.rad(50), math.rad(100))
  91. Turn (rthigh, x_axis, math.rad(-50), math.rad(100))
  92. Turn (lthigh, x_axis, math.rad(-30), math.rad(60))
  93. Turn (rshin, z_axis, math.rad(-30), math.rad(60))
  94. Turn (lshin, z_axis, math.rad(30), math.rad(60))
  95. Turn (rshin, x_axis, math.rad(30), math.rad(60))
  96. Turn (lshin, x_axis, math.rad(80), math.rad(160))
  97. Turn (rfoot, z_axis, math.rad(25), math.rad(50))
  98. Turn (rfoot, x_axis, math.rad(20), math.rad(40))
  99. Turn (lfoot, x_axis, math.rad(-55), math.rad(110))
  100. Turn (lfoot, z_axis, math.rad(-20), math.rad(40))
  101. Move (hips, y_axis, -5, 10)
  102. Turn (head, y_axis, math.rad(-35), math.rad(70))
  103. Turn (rshoulder, x_axis, math.rad(-75), math.rad(150))
  104. Turn (rforearm, x_axis, math.rad(17.2), math.rad(34.38))
  105. Turn (rforearm, y_axis, math.rad(-63), math.rad(-126))
  106. Turn (rforearm, z_axis, math.rad(28.65), math.rad(57.3))
  107. Turn (lshoulder, z_axis, math.rad(30), math.rad(60))
  108. Turn (lshoulder, x_axis, math.rad(-30), math.rad(60))
  109. Turn (lforearm, x_axis, math.rad(-30), math.rad(60))
  110. Turn (lforearm, y_axis, math.rad(-60), math.rad(120))
  111. Move (halberd, z_axis, 15, 30)
  112.  
  113. while true do
  114. Sleep (math.random(1000, 2500))
  115. Turn (chest, y_axis, math.rad(math.random(10, 70)), math.rad(45))
  116. WaitForTurn (chest, y_axis)
  117. end
  118. end
  119.  
  120. local function Walk()
  121. if idle then RestoreFromIdle() end
  122. Signal(SIG_Walk)
  123. SetSignalMask(SIG_Walk)
  124. while (true) do
  125. Turn(lshoulder, x_axis, -1.2, runspeed*0.2)
  126. Turn(hips, z_axis, 0.1, runspeed*0.05)
  127. Turn(rshoulder, x_axis, 0.5, runspeed*0.3)
  128.  
  129. Turn(rthigh, x_axis, -1.5, runspeed*1)
  130. Turn(rshin, x_axis, 1.3, runspeed*1)
  131. -- Turn(rfoot, x_axis, 0.5, runspeed*1)
  132.  
  133. Turn(lshin, x_axis, 0.2, runspeed*1)
  134. Turn(lthigh, x_axis, 1.2, runspeed*1)
  135.  
  136. WaitForTurn(rthigh, x_axis)
  137.  
  138. Sleep(steptime)
  139.  
  140. Turn(lshoulder, x_axis, -0.6, runspeed*0.2)
  141. Turn(hips, z_axis, -0.1, runspeed*0.05)
  142. Turn(rshoulder, x_axis, -0.5, runspeed*0.3)
  143.  
  144. Turn(lthigh, x_axis, -1.5, runspeed*1)
  145. Turn(lshin, x_axis, 1.3, runspeed*1)
  146. -- Turn(lfoot, x_axis, 0.5, runspeed*1)
  147.  
  148. Turn(rshin, x_axis, 0.2, runspeed*1)
  149. Turn(rthigh, x_axis, 1.2, runspeed*1)
  150.  
  151. WaitForTurn(lthigh, x_axis)
  152.  
  153. Sleep(steptime)
  154.  
  155. end
  156. end
  157.  
  158. local function StopWalk()
  159. Signal(SIG_Walk)
  160. SetSignalMask(SIG_Walk)
  161. Turn(hips, z_axis, 0, 0.5)
  162. Turn(rshoulder, x_axis, 0, 0.5)
  163.  
  164. Turn(lthigh, x_axis, 0, 2)
  165. Turn(lshin, x_axis, 0, 2)
  166. Turn(lfoot, x_axis, 0, 2)
  167.  
  168. Turn(rthigh, x_axis, 0, 2)
  169. Turn(rshin, x_axis, 0, 2)
  170. Turn(rfoot, x_axis, 0, 2)
  171.  
  172. StartThread (Idle)
  173. end
  174.  
  175. function script.StartMoving()
  176. StartThread(Walk)
  177. end
  178.  
  179. function script.StopMoving()
  180. StartThread(StopWalk)
  181. end
  182.  
  183. local function RestoreAfterDelay()
  184. Signal(SIG_Restore)
  185. SetSignalMask(SIG_Restore)
  186. Sleep(2000)
  187. firing = 0
  188. Turn(chest, y_axis, 0, 3)
  189. Move(halberd, z_axis, 0, 2)
  190.  
  191. StartThread (Idle)
  192. end
  193.  
  194. ----[[
  195. function script.QueryWeapon1() return head end
  196.  
  197. function script.AimFromWeapon1() return head end
  198.  
  199. function script.AimWeapon1(heading, pitch)
  200. if idle then RestoreFromIdle() end
  201. Signal(SIG_Aim)
  202. SetSignalMask(SIG_Aim)
  203. --[[ Gun Hugger
  204. Turn(chest, y_axis, 1.1 + heading, 12)
  205. Turn(lshoulder, x_axis, -1 -pitch, 12)
  206. Turn(rshoulder, x_axis, -0.9 -pitch, 12)
  207.  
  208. Turn(rshoulder, z_axis, 0.3, 9)
  209. Turn(lshoulder, z_axis, -0.3, 9)
  210.  
  211. Turn(head, y_axis, -0.8, 9)
  212. Turn(head, x_axis, -pitch, 9)--]]
  213.  
  214. -- Outstreched Arm
  215. firing = 1
  216. Turn(chest, y_axis, heading, 12)
  217.  
  218. WaitForTurn(chest, y_axis)
  219. StartThread(RestoreAfterDelay)
  220. return true
  221. end
  222.  
  223. function script.FireWeapon1()
  224. Turn(lforearm, x_axis, 0.4, 5)
  225. Turn(lshoulder, z_axis, - 0, 12)
  226. Turn(lshoulder, x_axis, - 0.7, 12)
  227. Turn(lforearm, y_axis, - 0.2, 10)
  228. Turn(halberd, z_axis, 1, 8)
  229. Move(halberd, z_axis, 15, 40)
  230. Sleep (800)
  231. Turn(lforearm, x_axis, 0, 2)
  232. Turn(lshoulder, z_axis, - 0.9, 6)
  233. Turn(lshoulder, x_axis, - 0.8, 6)
  234. Turn(lforearm, y_axis, - 1, 5)
  235. Turn(halberd, z_axis, 0, 5)
  236. end
  237.  
  238. function script.Killed(recentDamage, maxHealth)
  239. local severity = recentDamage / maxHealth
  240. if (severity <= .25) then
  241. Explode(hips, sfxNone)
  242. Explode(head, sfxNone)
  243. Explode(chest, sfxNone)
  244. return 1 -- corpsetype
  245. elseif (severity <= .5) then
  246. Explode(hips, sfxNone)
  247. Explode(head, sfxNone)
  248. Explode(chest, sfxShatter)
  249. return 1 -- corpsetype
  250. else
  251. Explode(hips, sfxShatter)
  252. Explode(head, sfxSmoke + sfxFire)
  253. Explode(chest, sfxSmoke + sfxFire + sfxExplode)
  254. return 2 -- corpsetype
  255. end
  256. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement