From 91a7d462e1dc266ba9732ec0cd90881206e16976 Mon Sep 17 00:00:00 2001 From: ineedbots Date: Sun, 25 Jul 2021 15:05:28 -0600 Subject: [PATCH] gtnw --- userraw/maps/mp/bots/_bot_script.gsc | 80 +++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/userraw/maps/mp/bots/_bot_script.gsc b/userraw/maps/mp/bots/_bot_script.gsc index f238c22..1db5f75 100644 --- a/userraw/maps/mp/bots/_bot_script.gsc +++ b/userraw/maps/mp/bots/_bot_script.gsc @@ -6451,6 +6451,82 @@ bot_think_revive() { } +/* + Bots play the Global thermonuclear warfare +*/ +bot_gtnw_loop() +{ + myteam = self.team; + theirteam = getOtherTeam( myteam ); + origin = level.nukeSite.trigger.origin; + trigger = level.nukeSite.trigger; + + ourCapCount = level.nukeSite.touchList[myteam]; + theirCapCount = level.nukeSite.touchList[theirteam]; + rand = self BotGetRandom(); + + if ( ( !ourCapCount && !theirCapCount ) || rand <= 20 ) + { + // go cap the obj + self.bot_lock_goal = true; + self SetScriptGoal( origin, 64 ); + self thread bots_watch_touch_obj( trigger ); + + ret = self waittill_any_return( "goal", "bad_path", "new_goal" ); + + if ( ret != "new_goal" ) + self ClearScriptGoal(); + + if ( ret != "goal" || !self isTouching( trigger ) ) + { + self.bot_lock_goal = false; + return; + } + + self SetScriptGoal( self.origin, 64 ); + + while ( self isTouching( trigger ) ) + { + cur = level.nukeSite.curProgress; + wait 0.5; + + if ( cur == level.nukeSite.curProgress ) + break;//no prog made, enemy must be capping + } + + self ClearScriptGoal(); + self.bot_lock_goal = false; + return; + } + + if ( theirCapCount ) + { + // kill capturtour + self.bot_lock_goal = true; + + self SetScriptGoal( origin, 64 ); + self thread bots_watch_touch_obj( trigger ); + + if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" ) + self ClearScriptGoal(); + + self.bot_lock_goal = false; + return; + } + + //else hang around the site + if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 ) + return; + + self.bot_lock_goal = true; + self SetScriptGoal( origin, 256 ); + + if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" ) + self ClearScriptGoal(); + + self.bot_lock_goal = false; +} + /* Bots play the Global thermonuclear warfare */ @@ -6472,10 +6548,10 @@ bot_gtnw() continue; } - if ( !isDefined( level.nukeSite ) ) + if ( !isDefined( level.nukeSite ) || !isDefined( level.nukeSite.trigger ) ) continue; - + self bot_gtnw_loop(); } }