From d109167383f1323c68382ad5fc709efde66b2eb1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 11 Sep 2020 22:08:37 -0600 Subject: [PATCH] equipment use --- userraw/maps/mp/bots/_bot_script.gsc | 95 +++++++++++++++++++++++++++- userraw/todo.txt | 1 - 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/userraw/maps/mp/bots/_bot_script.gsc b/userraw/maps/mp/bots/_bot_script.gsc index 095124c..0e6f8e8 100644 --- a/userraw/maps/mp/bots/_bot_script.gsc +++ b/userraw/maps/mp/bots/_bot_script.gsc @@ -1104,11 +1104,12 @@ onBotSpawned() self thread bot_uav_think(); self thread bot_listen_to_steps(); - self thread bot_jav_loc_think(); self thread bot_think_follow(); self thread bot_think_camp(); + self thread bot_jav_loc_think(); self thread bot_use_grenade_think(); self thread bot_use_tube_think(); + self thread bot_use_equipment_think(); self thread bot_dom_def_think(); self thread bot_dom_spawn_kill_think(); @@ -1547,6 +1548,98 @@ fire_current_weapon() } } +bot_use_equipment_think() +{ + self endon("disconnect"); + self endon("death"); + level endon("game_ended"); + + for (;;) + { + wait randomintRange(2, 4); + + if (randomInt(100) < 20) + continue; + + nade = undefined; + if (self GetAmmoCount("claymore_mp")) + nade = "claymore_mp"; + if (self GetAmmoCount("flare_mp")) + nade = "flare_mp"; + + if (!isDefined(nade)) + continue; + + if (self HasThreat() || self HasBotJavelinLocation() || self HasScriptAimPos()) + continue; + + if(self BotIsFrozen()) + continue; + + if(self IsBotReloading() || self IsBotFragging() || self IsBotKnifing()) + continue; + + if(self isDefusing() || self isPlanting()) + continue; + + curWeap = self GetCurrentWeapon(); + if (!isWeaponPrimary(curWeap) || self.disabledWeapon) + continue; + + if (self botIsClimbing()) + continue; + + if (self IsUsingRemote()) + continue; + + clayWp = undefined; + + for (i = 0; i < level.waypointsClay.size; i++) + { + if (Distance(self.origin, level.waypointsClay[i].origin) > 1024) + continue; + + if (isDefined(clayWp) && closer(self.origin, clayWp.origin, level.waypointsClay[i].origin)) + continue; + + clayWp = level.waypointsClay[i]; + } + + loc = undefined; + if (!isDefined(clayWp) || self HasScriptGoal() || self.bot_lock_goal) + { + myEye = self GetEye(); + loc = myEye + AnglesToForward(self GetPlayerAngles()) * 256; + + if (!bulletTracePassed(myEye, loc, false, self)) + continue; + } + else + { + loc = clayWp.origin + AnglesToForward(clayWp.angles) * 2048; + + self SetScriptGoal(clayWp.origin, 16); + + ret = self waittill_any_return("new_goal", "goal", "bad_path"); + + if (ret != "new_goal") + self ClearScriptGoal(); + + if (ret != "goal") + continue; + } + + self SetScriptAimPos(loc); + self BotStopMoving(true); + wait 1; + + self throwBotGrenade(nade); + + self ClearScriptAimPos(loc); + self BotStopMoving(false); + } +} + bot_use_grenade_think() { self endon("disconnect"); diff --git a/userraw/todo.txt b/userraw/todo.txt index 2642bb5..b42a77d 100644 --- a/userraw/todo.txt +++ b/userraw/todo.txt @@ -1,7 +1,6 @@ _script: bomb gamemodes, unreleased gamemodes -tube, grenade equipment waypoints use _utility: host assignment