From e25adccf152ebd9fdb60bc376965a047c78e50d2 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Fri, 14 Jul 2023 20:18:54 -0600 Subject: [PATCH] small fixes --- maps/bots/objectives/_powerup.gsc | 13 ++++++++++++- maps/bots/objectives/_revive.gsc | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/maps/bots/objectives/_powerup.gsc b/maps/bots/objectives/_powerup.gsc index 1a84bae..4961346 100644 --- a/maps/bots/objectives/_powerup.gsc +++ b/maps/bots/objectives/_powerup.gsc @@ -6,25 +6,29 @@ Finder( eObj ) { answer = []; - ents = getentarray( "script_model", "classname" ); if ( self inLastStand() ) { return answer; } + ents = getentarray( "script_model", "classname" ); + for ( i = 0; i < ents.size; i++ ) { + // not a powerup script_model if ( !isDefined( ents[i].powerup_name ) ) { continue; } + // can we path to it? if ( GetPathIsInaccessible( self.origin, ents[i].origin ) ) { continue; } + // make sure we are the only one going for it if ( self GetBotsAmountForEntity( ents[i] ) >= 1 ) { continue; @@ -56,6 +60,7 @@ Executer( eObj ) self endon( "zombified" ); powerup = eObj.eEnt; + org = powerup.origin; self thread IncrementBotsForEntity( powerup ); self thread WatchForCancel( powerup ); @@ -66,6 +71,12 @@ Executer( eObj ) self DecrementBotsForEntity( powerup ); self ClearScriptGoal(); + if ( distance( org, self.origin ) <= 64 ) + { + eObj.sReason = "completed"; + eObj.bWasSuccessful = true; + } + self CompletedObjective( eObj.bWasSuccessful, eObj.sReason ); } diff --git a/maps/bots/objectives/_revive.gsc b/maps/bots/objectives/_revive.gsc index df93b28..ec42973 100644 --- a/maps/bots/objectives/_revive.gsc +++ b/maps/bots/objectives/_revive.gsc @@ -98,6 +98,8 @@ WatchForCancelRevive( revivee ) self endon( "zombified" ); self endon( "WatchForCancelRevive" ); + org = revivee.origin; + for ( ;; ) { wait 0.05; @@ -119,6 +121,12 @@ WatchForCancelRevive( revivee ) self CancelObjective( "revivee.revivetrigger.beingrevived && !self isReviving( revivee )" ); break; } + + if ( distance( revivee.origin, org ) > 16 ) + { + self CancelObjective( "distance( revivee.origin, org ) > 16" ); + break; + } } }