Change weap

This commit is contained in:
INeedBots 2020-11-22 18:02:29 -06:00
parent 5efef605a1
commit ec7428848c

View File

@ -1277,7 +1277,6 @@ onSpawned()
self.bot_oma_class = undefined; self.bot_oma_class = undefined;
self.help_time = undefined; self.help_time = undefined;
self.bot_was_follow_script_update = undefined; self.bot_was_follow_script_update = undefined;
self.bot_perf_switch_weapon = undefined;
self.bot_stuck_on_carepackage = undefined; self.bot_stuck_on_carepackage = undefined;
self thread bot_dom_cap_think(); self thread bot_dom_cap_think();
@ -1594,10 +1593,8 @@ bot_use_bomb_weapon(weap)
if(self getCurrentWeapon() != weap) if(self getCurrentWeapon() != weap)
{ {
self GiveWeapon( weap ); self GiveWeapon( weap );
self BotChangeToWeapon(weap);
self waittill_any_timeout(10, "weapon_change"); if (!self ChangeToWeapon(weap))
if(self getCurrentWeapon() != weap)
{ {
self notify("bot_try_use_fail"); self notify("bot_try_use_fail");
return; return;
@ -1612,7 +1609,7 @@ bot_use_bomb_weapon(weap)
ret = self waittill_any_return("bot_try_use_fail", "bot_try_use_success"); ret = self waittill_any_return("bot_try_use_fail", "bot_try_use_success");
if(lastWeap != "none") if(lastWeap != "none")
self BotChangeToWeapon(lastWeap); self thread ChangeToWeapon(lastWeap);
else else
self takeWeapon(weap); self takeWeapon(weap);
} }
@ -2481,13 +2478,10 @@ changeToWeapon(weap)
if (self GetCurrentWeapon() == weap) if (self GetCurrentWeapon() == weap)
return true; return true;
self.bot_perf_switch_weapon = weap; self BotChangeToWeapon(weap);
self notify("bot_force_check_switch");
self waittill_any_timeout(5, "weapon_change"); self waittill_any_timeout(5, "weapon_change");
self.bot_perf_switch_weapon = undefined;
return (self GetCurrentWeapon() == weap); return (self GetCurrentWeapon() == weap);
} }
@ -3310,7 +3304,7 @@ bot_weapon_think()
{ {
self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch"); self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch");
if(self BotIsFrozen() || self.disabledWeapon) if(self BotIsFrozen())
continue; continue;
if(self isDefusing() || self isPlanting()) if(self isDefusing() || self isPlanting())
@ -3332,7 +3326,7 @@ bot_weapon_think()
if(entIsVehicle(threat) && isDefined(rocketAmmo)) if(entIsVehicle(threat) && isDefined(rocketAmmo))
{ {
if (curWeap != rocketAmmo) if (curWeap != rocketAmmo)
self BotChangeToWeapon(rocketAmmo); self thread ChangeToWeapon(rocketAmmo);
continue; continue;
} }
} }
@ -3340,7 +3334,7 @@ bot_weapon_think()
if (self HasBotJavelinLocation() && self GetAmmoCount("javelin_mp")) if (self HasBotJavelinLocation() && self GetAmmoCount("javelin_mp"))
{ {
if (curWeap != "javelin_mp") if (curWeap != "javelin_mp")
self BotChangeToWeapon("javelin_mp"); self thread ChangeToWeapon("javelin_mp");
continue; continue;
} }
@ -3348,16 +3342,7 @@ bot_weapon_think()
if (isDefined(self.bot_oma_class)) if (isDefined(self.bot_oma_class))
{ {
if (curWeap != "onemanarmy_mp") if (curWeap != "onemanarmy_mp")
self BotChangeToWeapon("onemanarmy_mp"); self thread ChangeToWeapon("onemanarmy_mp");
continue;
}
if (isDefined(self.bot_perf_switch_weapon))
{
if (curWeap != self.bot_perf_switch_weapon)
self BotChangeToWeapon(self.bot_perf_switch_weapon);
self.bot_perf_switch_weapon = undefined;
continue; continue;
} }
@ -3393,7 +3378,7 @@ bot_weapon_think()
if(weap == "") if(weap == "")
continue; continue;
self BotChangeToWeapon(weap); self thread ChangeToWeapon(weap);
} }
} }
@ -3704,7 +3689,6 @@ bot_killstreak_think()
self notify("place_sentry"); self notify("place_sentry");
wait 0.05; wait 0.05;
self notify("cancel_sentry"); self notify("cancel_sentry");
wait 0.5;
self thread changeToWeapon(curWeap); self thread changeToWeapon(curWeap);
@ -3722,12 +3706,10 @@ bot_killstreak_think()
self thread clear_remote_on_death(); self thread clear_remote_on_death();
self BotStopMoving(true); self BotStopMoving(true);
self BotChangeToWeapon(ksWeap);
if (!self changeToWeapon(ksWeap)) if (!self changeToWeapon(ksWeap))
{ {
self ClearUsingRemote(); self ClearUsingRemote();
self notify("bot_clear_remote_on_death"); self notify("bot_clear_remote_on_death");
self thread changeToWeapon(curWeap);
self BotStopMoving(false); self BotStopMoving(false);
continue; continue;
} }
@ -3768,6 +3750,11 @@ bot_killstreak_think()
self BotStopMoving(true); self BotStopMoving(true);
self changeToWeapon(ksWeap); self changeToWeapon(ksWeap);
self BotStopMoving(false); self BotStopMoving(false);
wait 3;
if ( !isDefined( level.ac130player ) || level.ac130player != self )
self thread changeToWeapon(curWeap);
} }
else if (streakName == "helicopter_minigun") else if (streakName == "helicopter_minigun")
{ {
@ -3777,6 +3764,11 @@ bot_killstreak_think()
self BotStopMoving(true); self BotStopMoving(true);
self changeToWeapon(ksWeap); self changeToWeapon(ksWeap);
self BotStopMoving(false); self BotStopMoving(false);
wait 3;
if ( !isDefined( level.chopper ) || !isDefined( level.chopper.gunner ) || level.chopper.gunner != self )
self thread changeToWeapon(curWeap);
} }
} }
else else