From 779a83a83afffb2eaf68d521279f767cd2cd3b51 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Wed, 13 Jan 2021 16:21:29 -0600 Subject: [PATCH] Fix possible script errors --- userraw/maps/mp/bots/_bot_script.gsc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/userraw/maps/mp/bots/_bot_script.gsc b/userraw/maps/mp/bots/_bot_script.gsc index 6d05f0c..82602bf 100644 --- a/userraw/maps/mp/bots/_bot_script.gsc +++ b/userraw/maps/mp/bots/_bot_script.gsc @@ -2870,6 +2870,9 @@ bot_equipment_kill_think() { item = grenades[i]; + if (!isDefined(item)) + continue; + if ( !IsDefined( item.name ) ) continue; @@ -2945,7 +2948,7 @@ bot_equipment_kill_think() if (path != "new_goal") self ClearScriptGoal(); - if (path != "goal") + if (path != "goal" || !isDefined(target)) continue; if (randomInt(100) < self.pers["bots"]["behavior"]["camp"] * 8) @@ -3278,6 +3281,9 @@ bot_turret_think() for (i = turretsKeys.size - 1; i >= 0; i--) { tempTurret = turrets[turretsKeys[i]]; + + if (!isDefined(tempTurret)) + continue; if(tempTurret.health <= 20000) continue; @@ -3365,6 +3371,9 @@ bot_watch_stuck_on_crate() { tempCrate = crates[i]; + if (!isDefined(tempCrate)) + continue; + if (!isDefined(tempCrate.doingPhysics) || tempCrate.doingPhysics) continue; @@ -3437,6 +3446,9 @@ bot_crate_think() { tempCrate = crates[i]; + if (!isDefined(tempCrate)) + continue; + if (!isDefined(tempCrate.doingPhysics) || tempCrate.doingPhysics) continue; @@ -3480,7 +3492,7 @@ bot_crate_think() if (path != "new_goal") self ClearScriptGoal(); - if (path != "goal" || DistanceSquared(self.origin, crate.origin) > radius*radius) + if (path != "goal" || !isDefined(crate) || DistanceSquared(self.origin, crate.origin) > radius*radius) continue; } @@ -3488,7 +3500,7 @@ bot_crate_think() self BotFreezeControls(true); waitTime = 3; - if (crate.owner == self) + if (isDefined(crate.owner) && crate.owner == self) waitTime = 0.5; crate waittill_notify_or_timeout("captured", waitTime);