ForbodingAngel

Untitled

Mar 8th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. #define TA // This is a TA script
  2.  
  3. #include "sfxtype.h"
  4. #include "exptype.h"
  5.  
  6. piece base, rearforwarddoor, rearbackdoor, frontforwarddoor, frontbackdoor, nanoarms, nanopoint1, nano1, nano2, nano3, nano4, sfxpoint1, sfxpoint2;
  7.  
  8. static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building;
  9.  
  10. // Signal definitions
  11. #define SIG_ACTIVATE 2
  12.  
  13.  
  14. SmokeUnit(healthpercent, sleeptime, smoketype)
  15. {
  16. while( get BUILD_PERCENT_LEFT )
  17. {
  18. sleep 400;
  19. }
  20. while( TRUE )
  21. {
  22. healthpercent = get HEALTH;
  23. if( healthpercent < 66 )
  24. {
  25. smoketype = 256 | 2;
  26. if( Rand( 1, 66 ) < healthpercent )
  27. {
  28. smoketype = 256 | 1;
  29. }
  30. emit-sfx 1026 from base;
  31. }
  32. sleeptime = healthpercent * 50;
  33. if( sleeptime < 200 )
  34. {
  35. sleeptime = 200;
  36. }
  37. sleep sleeptime;
  38. }
  39. }
  40.  
  41. buildingfx()
  42. {
  43. while( TRUE )
  44. {
  45. if (building)
  46. {
  47. emit-sfx 1024 from nano1;
  48. sleep 60;
  49. emit-sfx 1024 from nano4;
  50. sleep 60;
  51. emit-sfx 1024 from nano3;
  52. sleep 60;
  53. emit-sfx 1024 from nano2;
  54. sleep 60;
  55. }
  56. sleep 600;
  57. }
  58. }
  59.  
  60. buildingfx2()
  61. {
  62. while( TRUE )
  63. {
  64. if (building)
  65. {
  66. emit-sfx 1025 from nanopoint1;
  67. }
  68. sleep 300;
  69. }
  70. }
  71.  
  72. fx()
  73. {
  74. while( get BUILD_PERCENT_LEFT )
  75. {
  76. sleep 400;
  77. }
  78. while( TRUE )
  79. {
  80. // if (tech)
  81. // {
  82. emit-sfx 1027 from sfxpoint1;
  83. emit-sfx 1027 from sfxpoint2;
  84. // }
  85. sleep 500;
  86. }
  87. }
  88.  
  89. OpenYard()
  90. {
  91. move nanoarms to y-axis [20] speed [10];
  92. turn frontforwarddoor to x-axis <90> speed <100>;
  93. turn frontbackdoor to x-axis <-90> speed <100>;
  94. turn rearforwarddoor to x-axis <90> speed <100>;
  95. turn rearbackdoor to x-axis <-90> speed <100>;
  96. wait-for-move nanoarms along y-axis;
  97. wait-for-turn frontforwarddoor around x-axis;
  98. set YARD_OPEN to 1;
  99. while( !get YARD_OPEN )
  100. {
  101. set BUGGER_OFF to 1;
  102. sleep 1500;
  103. set YARD_OPEN to 1;
  104. }
  105. set BUGGER_OFF to 0;
  106. }
  107.  
  108. CloseYard()
  109. {
  110. move nanoarms to y-axis [0] speed [10];
  111. turn frontforwarddoor to x-axis <0> speed <20>;
  112. turn frontbackdoor to x-axis <0> speed <20>;
  113. turn rearforwarddoor to x-axis <0> speed <20>;
  114. turn rearbackdoor to x-axis <0> speed <20>;
  115. set YARD_OPEN to 0;
  116. while( get YARD_OPEN )
  117. {
  118. set BUGGER_OFF to 1;
  119. sleep 1500;
  120. set YARD_OPEN to 0;
  121. }
  122. set BUGGER_OFF to 0;
  123. }
  124.  
  125. Go()
  126. {
  127. call-script OpenYard();
  128. set INBUILDSTANCE to 1;
  129. }
  130.  
  131. Stop()
  132. {
  133. set INBUILDSTANCE to 0;
  134. call-script CloseYard();
  135.  
  136. }
  137.  
  138. InitState()
  139. {
  140. statechg_DesiredState = TRUE;
  141. statechg_StateChanging = FALSE;
  142. }
  143.  
  144. RequestState(requestedstate, currentstate)
  145. {
  146. if( statechg_StateChanging )
  147. {
  148. statechg_DesiredState = requestedstate;
  149. return (0);
  150. }
  151. statechg_StateChanging = TRUE;
  152. currentstate = statechg_DesiredState;
  153. statechg_DesiredState = requestedstate;
  154. while( statechg_DesiredState != currentstate )
  155. {
  156. if( statechg_DesiredState == 0 )
  157. {
  158. call-script Go();
  159. currentstate = 0;
  160. }
  161. if( statechg_DesiredState == 1 )
  162. {
  163. call-script Stop();
  164. currentstate = 1;
  165. }
  166. }
  167. statechg_StateChanging = FALSE;
  168. }
  169.  
  170. Create()
  171. {
  172. unitviewer = FALSE;
  173. spray = nanopoint1;
  174. call-script InitState();
  175. start-script SmokeUnit();
  176. start-script Buildingfx();
  177. // start-script Buildingfx2();
  178. start-script fx();
  179. }
  180.  
  181. QueryNanoPiece(piecenum)
  182. {
  183. if( spray == 0 )
  184. {
  185. piecenum = nano1;
  186. }
  187. if( spray == 1 )
  188. {
  189. piecenum = nano2;
  190. }
  191. if( spray == 2 )
  192. {
  193. piecenum = nano3;
  194. }
  195. if( spray == 3 )
  196. {
  197. piecenum = nano4;
  198. }
  199. ++spray;
  200. if( spray >= 4 )
  201. {
  202. spray = 0;
  203. }
  204. }
  205.  
  206.  
  207. Activate()
  208. {
  209. signal SIG_ACTIVATE;
  210. start-script RequestState(0);
  211. }
  212.  
  213. Deactivate()
  214. {
  215. signal SIG_ACTIVATE;
  216. set-signal-mask SIG_ACTIVATE;
  217.  
  218. set-signal-mask 0;
  219. start-script RequestState(1);
  220. }
  221.  
  222. StartBuilding()
  223. {
  224. building = 1;
  225. }
  226.  
  227. StopBuilding()
  228. {
  229. building = 0;
  230. }
  231.  
  232. QueryBuildInfo(piecenum)
  233. {
  234. piecenum = nanopoint1;
  235. }
  236.  
  237.  
  238. Killed(severity, corpsetype) // how it explodes
  239. {
  240. corpsetype = 1;
  241. explode nanoarms type EXPLODE_ON_HIT;
  242. explode frontforwarddoor type EXPLODE_ON_HIT;
  243. explode frontbackdoor type EXPLODE_ON_HIT;
  244. explode rearforwarddoor type EXPLODE_ON_HIT;
  245. explode rearbackdoor type EXPLODE_ON_HIT;
  246. }
Advertisement
Add Comment
Please, Sign In to add comment