From 66a66212cab73dab9a9f2121b598b32f8c80bdd4 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Wed, 24 Mar 2021 02:34:10 -0600 Subject: [PATCH] Added weapon sswitch anim cancel, and init weapon switch on spawn --- userraw/maps/mp/bots/_bot_internal.gsc | 1 + userraw/maps/mp/bots/_bot_script.gsc | 36 ++++++++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/userraw/maps/mp/bots/_bot_internal.gsc b/userraw/maps/mp/bots/_bot_internal.gsc index f27979a..670933b 100644 --- a/userraw/maps/mp/bots/_bot_internal.gsc +++ b/userraw/maps/mp/bots/_bot_internal.gsc @@ -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"]["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"] = []; } diff --git a/userraw/maps/mp/bots/_bot_script.gsc b/userraw/maps/mp/bots/_bot_script.gsc index 65f0641..e0c30fc 100644 --- a/userraw/maps/mp/bots/_bot_script.gsc +++ b/userraw/maps/mp/bots/_bot_script.gsc @@ -3655,7 +3655,7 @@ doReloadCancel() for (;;) { - self waittill("reload"); + ret = self waittill_any_return("reload", "weapon_change"); if(self BotIsFrozen()) continue; @@ -3670,10 +3670,17 @@ doReloadCancel() continue; curWeap = self GetCurrentWeapon(); - // check single reloads - if (self GetWeaponAmmoClip(curWeap) < WeaponClipSize(curWeap)) + + if (!maps\mp\gametypes\_weapons::isPrimaryWeapon(curWeap)) continue; + if (ret == "reload") + { + // check single reloads + if (self GetWeaponAmmoClip(curWeap) < WeaponClipSize(curWeap)) + continue; + } + // check difficulty if (self.pers["bots"]["skill"]["base"] <= 3) continue; @@ -3686,7 +3693,7 @@ doReloadCancel() weapon = weaponslist[randomInt(weaponslist.size)]; weaponslist = array_remove(weaponslist, weapon); - if (!isWeaponPrimary(weapon)) + if (!maps\mp\gametypes\_weapons::isPrimaryWeapon(weapon)) continue; if(curWeap == weapon || weapon == "none" || weapon == "") @@ -3704,6 +3711,7 @@ doReloadCancel() self BotChangeToWeapon(weap); wait 0.25; self BotChangeToWeapon(curWeap); + wait 2; } } @@ -3715,6 +3723,8 @@ bot_weapon_think() self endon("death"); self endon("disconnect"); level endon("game_ended"); + + first = true; for(;;) { @@ -3762,13 +3772,23 @@ bot_weapon_think() 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; + + if(randomInt(100) > self.pers["bots"]["behavior"]["initswitch"]) 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; + if(hasTarget) + continue; + } } weaponslist = self getweaponslistall();