Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. // exec ("server/game/customStuff.cs");
  2.  
  3. datablock StaticShapeData(testBlock)
  4. {
  5. shapeFile = "legions/data/shapes/props/jumppad/jumppad1.dts";
  6. };
  7.  
  8.  
  9.  
  10.  
  11. $testscore = 0;
  12. $zone1count = 0;
  13. $zone1count2 = 0;
  14. $zone1control = 0;
  15.  
  16.  
  17.  
  18.  
  19. datablock TriggerData(point1trigger){
  20. tickPeriodMS = 1000;
  21. };
  22.  
  23.  
  24.  
  25. %obj = new Trigger(point1trigger) {
  26. canSaveDynamicFields = "1";
  27. Enabled = "1";
  28. Position = "162.342 482.691 225.491";
  29. rotation = "1 0 0 0";
  30. scale = "1 1 1";
  31. doDistanceFade = "0";
  32. startFadeDistance = "10";
  33. endFadeDistance = "500";
  34. teamIndex = "-1";
  35. dataBlock = "point1trigger";
  36. polyhedron = "0.0000000 0.0000000 0.0000000 30.0000000 0.0000000 0.0000000 0.0000000 -30.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
  37. active = "1";
  38. };
  39.  
  40.  
  41.  
  42. function addZone1fx() {
  43.  
  44. if(isObject($zone1fx))
  45. {
  46. }
  47. else
  48. {
  49.  
  50. $zone1fx = new ParticleEmitterNode() {
  51. canSaveDynamicFields = "1";
  52. Enabled = "1";
  53. Position = "177.899 466.987 225.184";
  54. rotation = "0 0 1 190.222";
  55. scale = "1 1 1";
  56. doDistanceFade = "0";
  57. startFadeDistance = "10";
  58. endFadeDistance = "500";
  59. teamIndex = "-1";
  60. dataBlock = "defaultParticleEmitterNode";
  61. emitter = "captureRingEmitter";
  62. velocity = "1";
  63. };
  64.  
  65. new StaticShape(point1shape) {
  66.  
  67. dataBlock = "testBlock";
  68. position = "177.899 466.987 225.184";
  69. rotation = "1 0 0 0";
  70. scale = "1 1 1";
  71. };
  72. }
  73.  
  74. }
  75.  
  76.  
  77.  
  78. function deleteZone1fx() {
  79.  
  80. $zone1fx.delete();
  81.  
  82. }
  83.  
  84.  
  85.  
  86. function point1trigger::onEnterTrigger( %this, %trigger, %obj )
  87. {
  88. %capZone1InRange = true;
  89. echo("In range.");
  90.  
  91. addZone1fx();
  92.  
  93. zone1capGuiBar.cancelDecay();
  94. zone1updateControl();
  95. Canvas.pushDialog(zone1capGui);
  96.  
  97.  
  98. if (%obj.getClassName() $= "Player" && %player.teamIndex == 1)
  99. {
  100. zone1playercount();
  101. }
  102.  
  103. if (%obj.getClassName() $= "Player" && %player.teamIndex == 0)
  104. {
  105. zone1playercount2();
  106. }
  107.  
  108. }
  109. function point1trigger::onLeaveTrigger( %this, %trigger, %obj )
  110. {
  111. %capZone1InRange = false;
  112. echo("Out of range.");
  113.  
  114.  
  115. deleteZone1fx();
  116. point1shape.delete();
  117.  
  118.  
  119.  
  120. if (%obj.getClassName() $= "Player" && %player.teamIndex == 1)
  121. {
  122. zone1playerreset();
  123. }
  124.  
  125. if (%obj.getClassName() $= "Player" && %player.teamIndex == 0)
  126. {
  127. zone1playerreset2();
  128. }
  129.  
  130. if ($zone1count == 0){
  131. zone1capGuiBar.cancelUpdate();
  132. }
  133.  
  134. zone1capGuiBar.decay();
  135.  
  136. Canvas.popDialog(zone1capGui);
  137.  
  138. }
  139.  
  140. function point1trigger::onTickTrigger(%this,%trigger)
  141. {
  142. echo ("Ticked (while inside) defaultTrigger");
  143. // zone1capGuiBar.update();
  144. Parent::onTickTrigger(%this,%trigger);
  145. zone1updateControl();
  146. }
  147.  
  148.  
  149. function zone1capInit()
  150. {
  151. if(!isObject(zone1capGui))
  152. {
  153. new GuiControlProfile(zone1capGuiProfile)
  154. {
  155. opaque = false;
  156. // fillColor = "50 0 100 0.2";
  157. border = "1";
  158. // borderColor = "0 0 150";
  159. fillcolorhl = "0 0 100 0.5";
  160. fillcolorna = "0 0 100 0.5";
  161. // borderthickness = "5";
  162. // transparency = "0.2";
  163. };
  164.  
  165. new GuiControl(zone1capGui)
  166. {
  167. position = "0 0";
  168. extent = "640 480";
  169. noCursor = true;
  170. modal = "false";
  171. helpTag = "0";
  172. setFirstResponder = "False";
  173.  
  174. new GuiProgressCtrl(zone1capGuiBar)
  175. {
  176. profile = "zone1capProfile";
  177. horizSizing = "center";
  178. vertSizing = "top";
  179. position = "150 350";
  180. extent = "350 20";
  181. minExtent = "8 8";
  182. visible = "1";
  183. helpTag = "0";
  184. expression = "10";
  185. };
  186. };
  187. }
  188.  
  189. }
  190.  
  191. function zone1playercount() {
  192. $zone1count = $zone1count + 1;
  193. }
  194.  
  195. function zone1playercount2() {
  196. $zone1count2 = $zone1count2 + 1;
  197. }
  198.  
  199.  
  200. function zone1playerreset() {
  201.  
  202. $zone1count = $zone1count - 1;
  203. }
  204.  
  205. function zone1playerreset2() {
  206.  
  207. $zone1count2 = $zone1count2 - 1;
  208. }
  209.  
  210.  
  211.  
  212.  
  213. function zone1updateControl()
  214.  
  215. {
  216. $zone1count = $zone1count;
  217. $zone1count2 = $zone1count2;
  218. if (($zone1count) > ($zone1count2))
  219.  
  220. {
  221.  
  222. $zone1control = "0";
  223.  
  224. }
  225.  
  226. if (($zone1count2) > ($zone1count))
  227.  
  228. {
  229.  
  230. $zone1control = "1";
  231.  
  232. }
  233.  
  234. if (($zone1count) == ($zone1count2))
  235.  
  236. {
  237.  
  238. $zone1control = "2";
  239.  
  240. }
  241.  
  242. else
  243. {
  244. $zone1control = "2";
  245.  
  246. }
  247.  
  248.  
  249.  
  250. }
  251.  
  252.  
  253.  
  254.  
  255.  
  256. function zone1capGuiBar::cancelUpdate(%this)
  257. {
  258.  
  259. if(isEventPending(zone1capGuiBar.updateThread))
  260. cancel(zone1capGuiBar.updateThread);
  261.  
  262. }
  263.  
  264. function zone1capGuiBar::decay(%this)
  265. {
  266.  
  267. $newValue2 = %this.getValue() - 0.2;
  268. if (%newValue < 1 ) {
  269. %this.setValue($newValue2);
  270. %this.updateThread2 = %this.schedule(1000, "decay");
  271. }
  272.  
  273. if(%newValue >= 1)
  274. {
  275. %newValue = 1;
  276. %this.setValue(%newValue);
  277.  
  278. }
  279.  
  280.  
  281.  
  282. }
  283.  
  284. function zone1capGuiBar::cancelDecay(%this)
  285. {
  286.  
  287. if(isEventPending(zone1capGuiBar.updateThread2))
  288. cancel(zone1capGuiBar.updateThread2);
  289.  
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement