From 01eebf6a8c38970b2621fbd1c656db0aaaeca29a Mon Sep 17 00:00:00 2001 From: INeedBots Date: Fri, 26 Mar 2021 19:11:42 -0600 Subject: [PATCH] Can switch to altmode with spawnweapon hack --- main_shared/maps/mp/bots/_bot_script.gsc | 4 +++- main_shared/maps/mp/bots/_bot_utility.gsc | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/main_shared/maps/mp/bots/_bot_script.gsc b/main_shared/maps/mp/bots/_bot_script.gsc index 8882c17..aa86703 100644 --- a/main_shared/maps/mp/bots/_bot_script.gsc +++ b/main_shared/maps/mp/bots/_bot_script.gsc @@ -688,6 +688,9 @@ changeToWeapon(weap) self SwitchToWeapon(weap); + if (isWeaponAltmode(weap)) + self setSpawnWeapon(weap); + self waittill_any_timeout(5, "weapon_change"); return (self GetCurrentWeapon() == weap); @@ -2530,7 +2533,6 @@ follow_target() /* Fast swaps or reload cancels don't work cause t5 bots wait for the anim to complete - t5 bots cannot switch to altmode Bots will think to switch weapons */ bot_weapon_think() diff --git a/main_shared/maps/mp/bots/_bot_utility.gsc b/main_shared/maps/mp/bots/_bot_utility.gsc index a1e42d4..0a286bd 100644 --- a/main_shared/maps/mp/bots/_bot_utility.gsc +++ b/main_shared/maps/mp/bots/_bot_utility.gsc @@ -145,6 +145,25 @@ GetBotDiffNum() return num; } +/* + is the weapon alt mode? +*/ +isWeaponAltmode(weap) +{ + if (isStrStart(weap, "gl_") || isStrStart(weap, "ft_") || isStrStart(weap, "mk_")) + return true; + + return false; +} + +/* + If the string starts with +*/ +isStrStart( string1, subStr ) +{ + return ( getSubStr( string1, 0, subStr.size ) == subStr ); +} + /* Taken from iw4 script */