From f0aa54189dd5d77f17ea2ef228d17f9757d87fa7 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Wed, 3 Mar 2021 18:11:37 -0600 Subject: [PATCH] added weapon class dist mutiplier --- main_shared/maps/mp/bots/_bot_internal.gsc | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/main_shared/maps/mp/bots/_bot_internal.gsc b/main_shared/maps/mp/bots/_bot_internal.gsc index 9066dca..da42898 100644 --- a/main_shared/maps/mp/bots/_bot_internal.gsc +++ b/main_shared/maps/mp/bots/_bot_internal.gsc @@ -149,6 +149,7 @@ resetBotVars() self.bot.jump_time = undefined; self.bot.is_cur_full_auto = false; + self.bot.cur_weap_dist_multi = 1; self.bot.rand = randomInt(100); @@ -270,6 +271,27 @@ spawned() self notify("bot_spawned"); } +/* + Sets the factor of distance for a weapon +*/ +SetWeaponDistMulti(weap) +{ + if (weap == "none") + return 1; + + switch(weaponClass(weap)) + { + case "rifle": + return 0.9; + case "smg": + return 0.7; + case "pistol": + return 0.5; + default: + return 1; + } +} + /* The hold breath thread. */ @@ -285,7 +307,7 @@ watchHoldBreath() if(self.bot.isfrozen) continue; - self holdbreath((self playerADS() && weaponClass(self getCurrentWEapon()) == "rifle")); + self holdbreath(self playerADS() >= 1); } } @@ -336,6 +358,7 @@ onWeaponChange() weap = self GetCurrentWeapon(); self.bot.is_cur_full_auto = WeaponIsFullAuto(weap); + self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap); if (weap != "none") self changeToWeap(weap); @@ -344,6 +367,7 @@ onWeaponChange() self waittill( "weapon_change", newWeapon ); self.bot.is_cur_full_auto = WeaponIsFullAuto(newWeapon); + self.bot.cur_weap_dist_multi = SetWeaponDistMulti(weap); if (newWeapon == "none") { @@ -639,9 +663,11 @@ updateAimOffset(obj) targetObjUpdateTraced(obj, daDist, ent, theTime, isScriptObj) { distClose = self.pers["bots"]["skill"]["dist_start"]; + distClose *= self.bot.cur_weap_dist_multi; distClose *= distClose; distMax = self.pers["bots"]["skill"]["dist_max"]; + distMax *= self.bot.cur_weap_dist_multi; distMax *= distMax; timeMulti = 1;