From 61f14dab323572e400d10352725124060551a1a6 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Thu, 8 Sep 2022 09:01:37 +0200 Subject: [PATCH] all_or_nothings bots fix Fixed the infinite loop when using giveLoadout on a bot preventing us from giving a throwing knife and the scavenger specialist bonus on bots --- gamemodes/README.md | 2 +- gamemodes/all_or_nothing.gsc | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gamemodes/README.md b/gamemodes/README.md index 5ed8989..dcd1133 100644 --- a/gamemodes/README.md +++ b/gamemodes/README.md @@ -2,4 +2,4 @@ ## all_or_nothing.gsc Recreation of the Modern Warfare 3 All or Nothing gamemode based on [the wiki](https://callofduty.fandom.com/wiki/All_or_Nothing_(Game_Mode)#Call_of_Duty:_Modern_Warfare_3). -Sadly the scavenger killstreak and giving a throwing knife doesn't work for bots since for some reason the `giveLoadout()` function in `ReplaceKillstreaks()` causes an infinite loop that crashes the game. \ No newline at end of file +The bots won't use their throwing knives often and when they do they will use preset grenade spots, they won't directly aim at a player. \ No newline at end of file diff --git a/gamemodes/all_or_nothing.gsc b/gamemodes/all_or_nothing.gsc index ae60cf8..f8d0c50 100644 --- a/gamemodes/all_or_nothing.gsc +++ b/gamemodes/all_or_nothing.gsc @@ -110,10 +110,19 @@ ReplaceKillstreaks() self.pers["gamemodeLoadout"]["loadoutKillstreak2"] = "none"; self.pers["gamemodeLoadout"]["loadoutKillstreak3"] = "none"; - if (!isDefined(self.pers["isBot"]) || !self.pers["isBot"]) + if (self IsBot()) { + self maps\mp\bots\_bot_utility::botGiveLoadout(self.team, "gamemode", false, true); + } + else + { self maps\mp\gametypes\_class::giveLoadout(self.team, "gamemode", false, true); } maps\mp\killstreaks\_killstreaks::clearKillstreaks(); +} + +IsBot() +{ + return IsDefined(self.pers["isBot"]) && self.pers["isBot"]; } \ No newline at end of file