Advertisement
ScriptzMoDz

BO2 Strafe Run [GSC]

Sep 20th, 2014
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. locationSelector()
  2. {
  3. self endon("disconnect");
  4. self endon("death");
  5.  
  6. self beginLocationSelection( "map_mortar_selector" );
  7. self disableoffhandweapons();
  8. self giveWeapon( "killstreak_remote_turret_mp" );
  9. self switchToWeapon( "killstreak_remote_turret_mp" );
  10. self.selectingLocation = 1;
  11. self waittill("confirm_location", location);
  12. newLocation = BulletTrace(location+( 0, 0, 100000 ), location, false, self)["position"];
  13. self endLocationSelection();
  14. self enableoffhandweapons();
  15. self switchToWeapon(self maps\mp\_utility::getlastweapon());
  16. self.selectingLocation = undefined;
  17. return newLocation;
  18. }
  19.  
  20. initStrafeRun()
  21. {
  22. if (!level.AwaitingPreviousStrafe)
  23. {
  24. Location = locationSelector();
  25. self iPrintlnBold("Strafe Run Inbound...");
  26. level.AwaitingPreviousStrafe = true;
  27.  
  28. locationYaw = 180;
  29. flightPath1 = getFlightPath(Location, locationYaw, 0);
  30. flightPath2 = getFlightPath(Location, locationYaw, -620);
  31. flightPath3 = getFlightPath(Location, locationYaw, 620);
  32. flightPath4 = getFlightPath(Location, locationYaw, -1140);
  33. flightPath5 = getFlightPath(Location, locationYaw, 1140);
  34.  
  35. level thread Strafe_Think(self, flightPath1);
  36. wait 0.3;
  37. level thread Strafe_Think(self, flightPath2);
  38. level thread Strafe_Think(self, flightPath3);
  39. wait 0.3;
  40. level thread Strafe_Think(self, flightPath4);
  41. level thread Strafe_Think(self, flightPath5);
  42. wait 60;
  43. level.AwaitingPreviousStrafe = false;
  44. }
  45. else
  46. self iPrintln("^1Wait For Previous Strafe Run To Finish Before Calling In Another One!");
  47. }
  48.  
  49. Strafe_Think(owner, flightPath)
  50. {
  51. level endon("game_ended");
  52.  
  53. if (!isDefined(owner))
  54. return;
  55.  
  56. forward = vectorToAngles(flightPath["end"] - flightPath["start"]);
  57. StrafeHeli = SpawnStrafeHelicopter(owner, flightPath["start"], forward);
  58. StrafeHeli thread Strafe_Attack_Think();
  59.  
  60. StrafeHeli setYawSpeed(120, 60);
  61. StrafeHeli setSpeed(48, 48);
  62. StrafeHeli setVehGoalPos( flightPath["end"], 0 );
  63. StrafeHeli waittill("goal");
  64.  
  65. StrafeHeli setYawSpeed(30, 40);
  66. StrafeHeli setSpeed(32, 32);
  67. StrafeHeli setVehGoalPos( flightPath["start"], 0 );
  68. wait 2;
  69.  
  70. StrafeHeli setYawSpeed(100, 60);
  71. StrafeHeli setSpeed(64, 64);
  72. StrafeHeli waittill("goal");
  73. self notify("chopperdone");
  74. StrafeHeli delete();
  75. }
  76.  
  77. Strafe_Attack_Think()
  78. {
  79. self endon("chopperdone");
  80.  
  81. self setVehWeapon(self.defaultweapon);
  82. for( ;; )
  83. {
  84. for (i = 0; i < level.players.size; i++)
  85. {
  86. if(CanTargetPlayer(level.players[i]))
  87. {
  88. self setturrettargetent(level.players[i]);
  89. self FireWeapon("tag_flash", level.players[i]);
  90. }
  91. }
  92. wait 0.5;
  93. }
  94. }
  95.  
  96. SpawnStrafeHelicopter(owner, origin, angles)
  97. {
  98. Team = owner.pers["team"];
  99. SentryGun = spawnHelicopter(owner, origin, angles, "heli_ai_mp", "veh_t6_air_attack_heli_mp_dark");
  100. SentryGun.team = Team;
  101. SentryGun.pers["team"] = Team;
  102. SentryGun.owner = owner;
  103. SentryGun.currentstate = "ok";
  104. SentryGun setdamagestage(4);
  105. SentryGun.killCamEnt = SentryGun;
  106. return SentryGun;
  107. }
  108.  
  109. CanTargetPlayer(player)
  110. {
  111. CanTarget = true;
  112. if (!IsAlive(player) || player.sessionstate != "playing")
  113. return false;
  114. if (Distance(player.origin, self.origin ) > 5000)
  115. return false;
  116. if (!isDefined(player.pers["team"]))
  117. return false;
  118. if (level.teamBased && player.pers["team"] == self.team)
  119. return false;
  120. if (player == self.owner)
  121. return false;
  122. if (player.pers["team"] == "spectator")
  123. return false;
  124. if (!BulletTracePassed(self getTagOrigin("tag_origin"), player getTagOrigin("j_head"), false, self))
  125. return false;
  126. return CanTarget;
  127. }
  128.  
  129. getFlightPath( location, locationYaw, rightOffset )
  130. {
  131. location = location * (1, 1, 0);
  132. initialDirection = (0, locationYaw, 0);
  133. planeHalfDistance = 12000;
  134. flightPath = [];
  135.  
  136. if (isDefined(rightOffset) && rightOffset != 0)
  137. location = location + (AnglesToRight(initialDirection ) * rightOffset ) + (0, 0, RandomInt(300));
  138.  
  139. startPoint = (location + (AnglesToForward(initialDirection) * (-1 * planeHalfDistance)));
  140. endPoint = (location + (AnglesToForward(initialDirection) * planeHalfDistance));
  141.  
  142. flyheight = 1500;
  143. if (isDefined(maps/mp/killstreaks/_airsupport::getminimumflyheight()))
  144. flyheight = maps/mp/killstreaks/_airsupport::getminimumflyheight();
  145.  
  146. flightPath["start"] = startPoint + ( 0, 0, flyHeight );
  147. flightPath["end"] = endPoint + ( 0, 0, flyHeight );
  148.  
  149. return flightPath;
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement