From 5ceeabcc2aa36ebee84b922cafbbd167a3de975e Mon Sep 17 00:00:00 2001 From: ineed bots Date: Thu, 30 Nov 2023 03:31:43 -0600 Subject: [PATCH] added prio goal --- maps/mp/bots/_bot_internal.gsc | 6 ++++-- maps/mp/bots/_bot_utility.gsc | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/maps/mp/bots/_bot_internal.gsc b/maps/mp/bots/_bot_internal.gsc index 1ebddfd..6a95f09 100644 --- a/maps/mp/bots/_bot_internal.gsc +++ b/maps/mp/bots/_bot_internal.gsc @@ -141,6 +141,8 @@ resetBotVars() self.bot.is_cur_sniper = false; self.bot.is_cur_akimbo = false; + self.bot.prio_objective = false; + self.bot.rand = randomInt( 100 ); self BotBuiltinBotStop(); @@ -1567,7 +1569,7 @@ aim_loop() return; } - if ( isDefined( self.bot.target ) && isDefined( self.bot.target.entity ) ) + if ( isDefined( self.bot.target ) && isDefined( self.bot.target.entity ) && !( self.bot.prio_objective && isDefined( self.bot.script_aimpos ) ) ) { no_trace_look_time = self.pers["bots"]["skill"]["no_trace_look_time"]; no_trace_time = self.bot.target.no_trace_time; @@ -1983,7 +1985,7 @@ killWalkCauseNoWaypoints() */ walk_loop() { - hasTarget = ( ( isDefined( self.bot.target ) && isDefined( self.bot.target.entity ) ) || isDefined( self.bot.jav_loc ) ); + hasTarget = ( ( isDefined( self.bot.target ) && isDefined( self.bot.target.entity ) && !self.bot.prio_objective ) || isDefined( self.bot.jav_loc ) ); if ( hasTarget ) { diff --git a/maps/mp/bots/_bot_utility.gsc b/maps/mp/bots/_bot_utility.gsc index 335a648..97d57d8 100644 --- a/maps/mp/bots/_bot_utility.gsc +++ b/maps/mp/bots/_bot_utility.gsc @@ -381,6 +381,32 @@ HasBotJavelinLocation() return isDefined( self.bot.jav_loc ); } +/* + Returns whether the bot has a priority objective +*/ +HasPriorityObjective() +{ + return self.bot.prio_objective; +} + +/* + Sets the bot to prioritize the objective over targeting enemies +*/ +SetPriorityObjective() +{ + self.bot.prio_objective = true; + self notify( "kill_goal" ); +} + +/* + Clears the bot's priority objective to allow the bot to target enemies automatically again +*/ +ClearPriorityObjective() +{ + self.bot.prio_objective = false; + self notify( "kill_goal" ); +} + /* Sets the aim position of the bot */