Added weapon sswitch anim cancel, and init weapon switch on spawn

This commit is contained in:
INeedBots 2021-03-24 02:34:10 -06:00
parent bc888f95cf
commit 66a66212ca
2 changed files with 29 additions and 8 deletions

View File

@ -55,6 +55,7 @@ added()
self.pers["bots"]["behavior"]["jump"] = 100; // percentage of how often the bot will jumpshot and dropshot self.pers["bots"]["behavior"]["jump"] = 100; // percentage of how often the bot will jumpshot and dropshot
self.pers["bots"]["behavior"]["quickscope"] = false; // is a quickscoper self.pers["bots"]["behavior"]["quickscope"] = false; // is a quickscoper
self.pers["bots"]["behavior"]["initswitch"] = 10; // percentage of how often the bot will switch weapons on spawn
self.pers["bots"]["unlocks"] = []; self.pers["bots"]["unlocks"] = [];
} }

View File

@ -3655,7 +3655,7 @@ doReloadCancel()
for (;;) for (;;)
{ {
self waittill("reload"); ret = self waittill_any_return("reload", "weapon_change");
if(self BotIsFrozen()) if(self BotIsFrozen())
continue; continue;
@ -3670,10 +3670,17 @@ doReloadCancel()
continue; continue;
curWeap = self GetCurrentWeapon(); curWeap = self GetCurrentWeapon();
// check single reloads
if (self GetWeaponAmmoClip(curWeap) < WeaponClipSize(curWeap)) if (!maps\mp\gametypes\_weapons::isPrimaryWeapon(curWeap))
continue; continue;
if (ret == "reload")
{
// check single reloads
if (self GetWeaponAmmoClip(curWeap) < WeaponClipSize(curWeap))
continue;
}
// check difficulty // check difficulty
if (self.pers["bots"]["skill"]["base"] <= 3) if (self.pers["bots"]["skill"]["base"] <= 3)
continue; continue;
@ -3686,7 +3693,7 @@ doReloadCancel()
weapon = weaponslist[randomInt(weaponslist.size)]; weapon = weaponslist[randomInt(weaponslist.size)];
weaponslist = array_remove(weaponslist, weapon); weaponslist = array_remove(weaponslist, weapon);
if (!isWeaponPrimary(weapon)) if (!maps\mp\gametypes\_weapons::isPrimaryWeapon(weapon))
continue; continue;
if(curWeap == weapon || weapon == "none" || weapon == "") if(curWeap == weapon || weapon == "none" || weapon == "")
@ -3704,6 +3711,7 @@ doReloadCancel()
self BotChangeToWeapon(weap); self BotChangeToWeapon(weap);
wait 0.25; wait 0.25;
self BotChangeToWeapon(curWeap); self BotChangeToWeapon(curWeap);
wait 2;
} }
} }
@ -3716,6 +3724,8 @@ bot_weapon_think()
self endon("disconnect"); self endon("disconnect");
level endon("game_ended"); level endon("game_ended");
first = true;
for(;;) for(;;)
{ {
self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch"); self waittill_any_timeout(randomIntRange(2, 4), "bot_force_check_switch");
@ -3762,14 +3772,24 @@ bot_weapon_think()
continue; continue;
} }
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "stinger_mp" && curWeap != "javelin_mp" && curWeap != "onemanarmy_mp") if (first)
{ {
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"]) first = false;
continue;
if(hasTarget) if(randomInt(100) > self.pers["bots"]["behavior"]["initswitch"])
continue; continue;
} }
else
{
if(curWeap != "none" && self getAmmoCount(curWeap) && curWeap != "stinger_mp" && curWeap != "javelin_mp" && curWeap != "onemanarmy_mp")
{
if(randomInt(100) > self.pers["bots"]["behavior"]["switch"])
continue;
if(hasTarget)
continue;
}
}
weaponslist = self getweaponslistall(); weaponslist = self getweaponslistall();
weap = ""; weap = "";