This commit is contained in:
Your Name 2020-08-30 16:53:44 -06:00
parent 9b38cf0942
commit 3b12df2e2f
2 changed files with 144 additions and 1 deletions

View File

@ -1100,6 +1100,9 @@ onBotSpawned()
self thread bot_equipment_kill_think();
self thread bot_jav_loc_think();
self thread bot_perk_think();
self thread bot_dom_def_think();
self thread bot_dom_spawn_kill_think();
}
}
@ -2328,6 +2331,146 @@ bot_killstreak_think()
}
}
bot_dom_spawn_kill_think()
{
self endon( "death" );
self endon( "disconnect" );
if ( level.gametype != "dom" )
return;
myTeam = self.pers[ "team" ];
otherTeam = getOtherTeam( myTeam );
for ( ;; )
{
wait( randomintrange( 10, 20 ) );
if ( randomint( 100 ) < 20 )
continue;
if ( self HasScriptGoal() || self.bot_lock_goal)
continue;
myFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( myTeam );
if ( myFlagCount == level.flags.size )
continue;
otherFlagCount = maps\mp\gametypes\dom::getTeamFlagCount( otherTeam );
if (myFlagCount <= otherFlagCount || otherFlagCount != 1)
continue;
flag = undefined;
for ( i = 0; i < level.flags.size; i++ )
{
if ( level.flags[i] maps\mp\gametypes\dom::getFlagTeam() == myTeam )
continue;
}
if(!isDefined(flag))
continue;
if(DistanceSquared(self.origin, flag.origin) < 2048*2048)
continue;
self SetScriptGoal( flag.origin, 1024 );
self thread bot_dom_watch_flags(myFlagCount, myTeam);
if (self waittill_any_return( "goal", "bad_path". "new_goal" ) != "new_goal")
self ClearScriptGoal();
}
}
bot_dom_watch_flags(count, myTeam)
{
self endon( "death" );
self endon( "disconnect" );
self endon( "goal" );
self endon( "bad_path" );
self endon( "new_goal" );
for (;;)
{
wait 0.5;
if (maps\mp\gametypes\dom::getTeamFlagCount( myTeam ) != count)
break;
}
self notify("bad_path");
}
bot_dom_def_think()
{
self endon( "death" );
self endon( "disconnect" );
if ( level.gametype != "dom" )
return;
myTeam = self.pers[ "team" ];
for ( ;; )
{
wait( randomintrange( 1, 3 ) );
if ( randomint( 100 ) < 35 )
continue;
if ( self HasScriptGoal() || self.bot_lock_goal )
continue;
flag = undefined;
for ( i = 0; i < level.flags.size; i++ )
{
if ( level.flags[i] maps\mp\gametypes\dom::getFlagTeam() != myTeam )
continue;
if ( !level.flags[i].useObj.objPoints[myTeam].isFlashing )
continue;
if ( !isDefined(flag) || DistanceSquared(self.origin,level.flags[i].origin) < DistanceSquared(self.origin,flag.origin) )
flag = level.flags[i];
}
if ( !isDefined(flag) )
continue;
self SetScriptGoal( flag.origin, 128 );
self thread bot_dom_watch_for_flashing(flag, myTeam);
self thread bots_watch_touch_obj(flag);
if (self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal")
self ClearScriptGoal();
}
}
bot_dom_watch_for_flashing(flag, myTeam)
{
self endon( "death" );
self endon( "disconnect" );
self endon( "goal" );
self endon( "bad_path" );
self endon( "new_goal" );
for (;;)
{
wait 0.5;
if (!isDefined(flag))
break;
if (flag maps\mp\gametypes\dom::getFlagTeam() != myTeam || !flag.useObj.objPoints[myTeam].isFlashing)
break;
}
self notify("bad_path");
}
bot_dom_cap_think()
{
self endon( "death" );

View File

@ -1 +1 @@
start iw4x.exe -nosteam -dump -console +set r_fullscreen "0" +set fs_game "mods/dev" +set developer "1" +set developer_script "1" +set cg_drawfps "4" +set sv_cheats "1" +set drawlagometer "1" +set scr_game_spectatetype "2" +set r_mode "1024x768" +devmap mp_rust
start iw4x.exe -nosteam -dump -console +set r_fullscreen "0" +set fs_game "mods/dev" +set developer "1" +set developer_script "1" +set cg_drawfps "4" +set sv_cheats "1" +set bots_manage_add "8" +set drawlagometer "1" +set scr_game_spectatetype "2" +set r_mode "1024x768" +devmap mp_rust