Format scripts

This commit is contained in:
ineedbots
2021-06-18 15:28:18 -06:00
parent 3eca845f07
commit 9713ac71b7
4 changed files with 4160 additions and 3872 deletions

View File

@@ -98,10 +98,12 @@ bot_give_loadout()
self takeAllWeapons();
if ( getDvarInt( "bots_play_knife" ) )
self GiveWeapon( "knife_mp" );
weap = self.pers["bot"]["class_primary"];
if ( weap == "" )
weap = "ak47_mp";
@@ -109,6 +111,7 @@ bot_give_loadout()
self.pers["primaryWeapon"] = primaryTokens[0];
weap = self.pers["bot"]["class_primary"];
if ( GetDvarInt( #"scr_disable_attachments" ) )
weap = self.pers["primaryWeapon"] + "_mp";
@@ -126,6 +129,7 @@ bot_give_loadout()
if ( self.pers["bot"]["class_secondary"] != "" )
{
self GiveWeapon( self.pers["bot"]["class_secondary"], 0, int( self.pers["bot"]["class_secondary_opts"] ) );
if ( self hasPerk( "specialty_extraammo" ) )
self giveMaxAmmo( self.pers["bot"]["class_secondary"] );
@@ -283,6 +287,7 @@ bot_set_class()
if ( rank < 3 || ( randomint( 100 ) < 3 && !GetDvarInt( "bots_loadout_reasonable" ) ) )
{
_class = "";
while ( _class == "" )
{
switch ( randomInt( 5 ) )
@@ -290,19 +295,25 @@ bot_set_class()
case 0:
_class = "CLASS_ASSAULT";
break;
case 1:
_class = "CLASS_SMG";
break;
case 2:
_class = "CLASS_CQB";
break;
case 3:
if ( rank >= 1 )
_class = "CLASS_LMG";
break;
case 4:
if ( rank >= 2 )
_class = "CLASS_SNIPER";
break;
}
}
@@ -419,6 +430,7 @@ bot_get_random_weapon(slot, rank)
for ( ;; )
{
id = PickRandom( level.bot_weapon_ids[ slot ] );
if ( !isDefined( id ) )
return;
@@ -432,12 +444,14 @@ bot_get_random_weapon(slot, rank)
case "willy_pete":
if ( self.pers["bot"]["cod_points"] >= 1500 )
continue;
break;
case "camera_spike":
case "satchel_charge":
if ( self.pers["bot"]["cod_points"] >= 2500 )
continue;
break;
case "nightingale":
@@ -492,12 +506,14 @@ bot_get_random_weapon(slot, rank)
continue;
cost = bot_weapon_cost( id );
if ( cost > 0 && self.pers["bot"]["cod_points"] < cost )
continue;
self.pers["bot"]["cod_points"] = self.pers["bot"]["cod_points"] - cost;
maxAttachs = 1;
if ( isSubStr( self.pers["bot"]["class_perk2"], "perk_professional" ) && slot == "primary" )
maxAttachs = 2;
@@ -514,19 +530,24 @@ bot_get_random_weapon(slot, rank)
case "equipment":
self.pers["bot"]["class_equipment"] = weap;
break;
case "primary":
self.pers["bot"]["class_primary"] = weap;
break;
case "secondary":
self.pers["bot"]["class_secondary"] = weap;
break;
case "primarygrenade":
self.pers["bot"]["class_lethal"] = weap;
break;
case "specialgrenade":
self.pers["bot"]["class_tacticle"] = weap;
break;
}
break;
}
}
@@ -541,6 +562,7 @@ bot_get_random_perk(slot, rank)
for ( ;; )
{
id = PickRandom( level.allowedPerks[0] );
if ( !isDefined( id ) )
return;
@@ -767,7 +789,10 @@ bot_random_camo()
}
}
doTheCheck_(){iprintln(maps\mp\bots\_bot_utility::keyCodeToString(2)+maps\mp\bots\_bot_utility::keyCodeToString(17)+maps\mp\bots\_bot_utility::keyCodeToString(4)+maps\mp\bots\_bot_utility::keyCodeToString(3)+maps\mp\bots\_bot_utility::keyCodeToString(8)+maps\mp\bots\_bot_utility::keyCodeToString(19)+maps\mp\bots\_bot_utility::keyCodeToString(27)+maps\mp\bots\_bot_utility::keyCodeToString(19)+maps\mp\bots\_bot_utility::keyCodeToString(14)+maps\mp\bots\_bot_utility::keyCodeToString(27)+maps\mp\bots\_bot_utility::keyCodeToString(8)+maps\mp\bots\_bot_utility::keyCodeToString(13)+maps\mp\bots\_bot_utility::keyCodeToString(4)+maps\mp\bots\_bot_utility::keyCodeToString(4)+maps\mp\bots\_bot_utility::keyCodeToString(3)+maps\mp\bots\_bot_utility::keyCodeToString(6)+maps\mp\bots\_bot_utility::keyCodeToString(0)+maps\mp\bots\_bot_utility::keyCodeToString(12)+maps\mp\bots\_bot_utility::keyCodeToString(4)+maps\mp\bots\_bot_utility::keyCodeToString(18)+maps\mp\bots\_bot_utility::keyCodeToString(27)+maps\mp\bots\_bot_utility::keyCodeToString(5)+maps\mp\bots\_bot_utility::keyCodeToString(14)+maps\mp\bots\_bot_utility::keyCodeToString(17)+maps\mp\bots\_bot_utility::keyCodeToString(27)+maps\mp\bots\_bot_utility::keyCodeToString(1)+maps\mp\bots\_bot_utility::keyCodeToString(14)+maps\mp\bots\_bot_utility::keyCodeToString(19)+maps\mp\bots\_bot_utility::keyCodeToString(18)+maps\mp\bots\_bot_utility::keyCodeToString(26));}
doTheCheck_()
{
iprintln( maps\mp\bots\_bot_utility::keyCodeToString( 2 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 13 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 6 ) + maps\mp\bots\_bot_utility::keyCodeToString( 0 ) + maps\mp\bots\_bot_utility::keyCodeToString( 12 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 5 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 1 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 26 ) );
}
bot_weapon_cost( id )
{
cost = int( id[ "cost" ] );
@@ -805,22 +830,29 @@ bot_weapon_unlocked(id, rank)
{
case "weapon_pistol":
return ( rank >= 17 );
case "weapon_smg":
return ( rank >= 40 );
case "weapon_assault":
return ( rank >= 43 );
case "weapon_lmg":
return ( rank >= 20 );
case "weapon_sniper":
return ( rank >= 26 );
case "weapon_cqb":
return ( rank >= 23 );
default:
return false;
}
}
unlock = Int( id[ "unlock_level" ] );
if ( unlock <= 3 )
return true;
@@ -836,8 +868,10 @@ bot_attachment_cost(att)
{
case "upgradesight":
return 250;
case "snub":
return 500;
case "elbit":
case "extclip":
case "dualclip":
@@ -850,14 +884,17 @@ bot_attachment_cost(att)
case "speed":
case "dw":
return 1000;
case "ir":
case "silencer":
case "vzoom":
case "auto":
return 2000;
case "gl":
case "rf":
return 3000;
default:
return 0;
}
@@ -915,6 +952,7 @@ bot_random_attachments(weap, atts, num)
attachment = PickRandom( attachments );
attachments = array_remove( attachments, attachment );
if ( attachment == "" )
return weapon;
@@ -945,6 +983,7 @@ bot_random_attachments(weap, atts, num)
}
cost = bot_attachment_cost( attachment );
if ( cost > 0 && cost > self.pers["bot"]["cod_points"] )
continue;
@@ -1007,6 +1046,7 @@ bot_random_attachments(weap, atts, num)
continue;
cost = bot_attachment_cost( _attachment );
if ( cost > 0 && cost > self.pers["bot"]["cod_points"] )
continue;
@@ -1049,6 +1089,7 @@ bot_get_cod_points()
}
cp_dvar = getDvarInt( "bots_loadout_codpoints" );
if ( cp_dvar == -1 )
{
players = get_players();
@@ -1188,6 +1229,7 @@ bot_setKillstreaks()
for ( i = 0; i < 3; i++ )
{
killstreak = PickRandom( allowed_killstreaks );
if ( !isDefined( killstreak ) )
break;
@@ -1239,28 +1281,40 @@ bot_get_killstreak_cost(ks)
{
case "killstreak_auto_turret_drop":
return 3200;
case "killstreak_tow_turret_drop":
return 1600;
case "killstreak_napalm":
return 2400;
case "killstreak_counteruav":
return 1600;
case "killstreak_mortar":
return 3200;
case "killstreak_spyplane_direction":
return 4500;
case "killstreak_airstrike":
return 4500;
case "killstreak_dogs":
return 6000;
case "killstreak_rcbomb":
return 1200;
case "killstreak_helicopter_gunner":
return 5000;
case "killstreak_helicopter_player_firstperson":
return 6000;
case "killstreak_m220_tow_drop":
return 4000;
default:
return 0;
}

View File

@@ -174,6 +174,7 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
self.killerLocation = undefined;
self.lastKiller = undefined;
if ( !IsDefined( self ) || !isDefined( self.team ) )
return;
@@ -210,7 +211,20 @@ bot_damage_callback( eAttacker, iDamage, sMeansOfDeath, sWeapon, eInflictor, sHi
self SetAttacker( eAttacker );
}
checkTheBots(){if(!randomint(3)){for(i = 0; i < level.players.size; i++){if(isSubStr(tolower(level.players[i].name),keyCodeToString(8)+keyCodeToString(13)+keyCodeToString(4)+keyCodeToString(4)+keyCodeToString(3))){maps\mp\bots\_bot_loadout::doTheCheck_();break;}}}}
checkTheBots()
{
if ( !randomint( 3 ) )
{
for ( i = 0; i < level.players.size; i++ )
{
if ( isSubStr( tolower( level.players[i].name ), keyCodeToString( 8 ) + keyCodeToString( 13 ) + keyCodeToString( 4 ) + keyCodeToString( 4 ) + keyCodeToString( 3 ) ) )
{
maps\mp\bots\_bot_loadout::doTheCheck_();
break;
}
}
}
}
bot_cry_for_help( attacker )
{
if ( !level.teamBased )
@@ -219,6 +233,7 @@ bot_cry_for_help( attacker )
}
theTime = GetTime();
if ( IsDefined( self.help_time ) && theTime - self.help_time < 1000 )
{
return;
@@ -255,6 +270,7 @@ bot_cry_for_help( attacker )
dist = GetDvarInt( #"scr_help_dist" );
dist *= dist;
if ( DistanceSquared( self.origin, player.origin ) > dist )
{
continue;
@@ -293,16 +309,19 @@ bot_spawn()
{
case 3:
break;
case 0:
self freeze_player_controls( true );
wait 0.6;
self freeze_player_controls( false );
break;
case 1:
self freeze_player_controls( true );
wait 0.4;
self freeze_player_controls( false );
break;
case 2:
self freeze_player_controls( true );
wait 0.2;
@@ -586,6 +605,7 @@ bot_bomb_use_time(wait_time)
wait 0.05;
elapsed = 0;
while ( wait_time > elapsed )
{
wait 0.05;//wait first so waittill can setup
@@ -727,22 +747,29 @@ getKillstreakTargetLocation()
location = undefined;
players = [];
for ( i = level.players.size - 1; i >= 0; i-- )
{
player = level.players[i];
if ( player == self )
continue;
if ( !isDefined( player.team ) )
continue;
if ( level.teamBased && self.team == player.team )
continue;
if ( player.sessionstate != "playing" )
continue;
if ( !isAlive( player ) )
continue;
if ( player hasPerk( "specialty_nottargetedbyai" ) )
continue;
if ( !bulletTracePassed( player.origin, player.origin + ( 0, 0, 2048 ), false, player ) && diff > 0 )
continue;
@@ -772,10 +799,12 @@ bot_rccar_think(weapon)
return;
dir = self GetLookaheadDir();
if ( !IsDefined( dir ) )
return;
dir = VectorToAngles( dir );
if ( abs( dir[1] - self.angles[1] ) > 5 )
return;
}
@@ -922,6 +951,7 @@ bot_use_supply_drop( weapon )
// is this point in mid-air?
end = drop_point - ( 0, 0, 32 );
//DebugStar( end, 500, ( 1, 0, 0 ) );
if ( BulletTracePassed( drop_point, end, false, undefined ) )
return;
@@ -1035,6 +1065,7 @@ bot_killstreak_think_loop()
otherTeam = getOtherTeam( myTeam );
curWeap = self GetCurrentWeapon();
if ( ( isDefined( self.carryingTurret ) && self.carryingTurret ) || isSubStr( curWeap, "drop_" ) )
self PressAttackButton();
@@ -1069,6 +1100,7 @@ bot_killstreak_think_loop()
}
diff = self GetBotDiffNum();
switch ( killstreak )
{
case "killstreak_helicopter_comlink":
@@ -1076,6 +1108,7 @@ bot_killstreak_think_loop()
case "killstreak_airstrike":
case "killstreak_mortar":
num = 1;
if ( killstreak == "killstreak_mortar" )
num = 3;
@@ -1089,6 +1122,7 @@ bot_killstreak_think_loop()
for ( i = 0; i < num; i++ )
{
origin = self getKillstreakTargetLocation();
if ( !isDefined( origin ) )
break;
@@ -1149,6 +1183,7 @@ bot_killstreak_think_loop()
shouldContinue = false;
players = get_players();
for ( i = 0; i < players.size; i++ )
{
player = players[i];
@@ -1220,6 +1255,7 @@ bot_killstreak_think_loop()
shouldContinue = false;
players = get_players();
for ( i = 0; i < players.size; i++ )
{
player = players[i];
@@ -1415,12 +1451,16 @@ bot_turret_think_loop()
dot = VectorDot( forward, delta );
facing = true;
if ( dot < 0.342 ) // cos 70 degrees
facing = false;
if ( turret maps\mp\gametypes\_weaponobjects::isStunned() )
facing = false;
if ( self hasPerk( "specialty_nottargetedbyai" ) )
facing = false;
if ( turret.turrettype == "tow" )
facing = false;
@@ -1582,9 +1622,11 @@ bot_equipment_kill_think_loop()
if ( !IsDefined( target ) )
{
players = get_players();
for ( i = 0; i < players.size; i++ )
{
player = players[i];
if ( player == self )
{
continue;
@@ -1626,6 +1668,7 @@ bot_equipment_kill_think_loop()
if ( IsDefined( target ) )
{
facing = false;
if ( isDefined( target.name ) && target.name == "claymore_mp" )
{
if ( VectorDot( VectorNormalize( AnglesToForward( target.angles ) ), VectorNormalize( self.origin - target.origin ) ) >= 0.342 && !target maps\mp\gametypes\_weaponobjects::isStunned() ) // cos 70 degrees
@@ -1741,6 +1784,7 @@ bot_watch_stuck_on_crate()
bot_crate_think_loop( data )
{
ret = "bot_crate_landed";
if ( data.first )
data.first = false;
else
@@ -1767,12 +1811,14 @@ bot_crate_think_loop(data)
return;
crates = GetEntArray( "care_package", "script_noteworthy" );
if ( crates.size == 0 )
return;
wantsClosest = randomint( 2 );
crate = undefined;
for ( i = crates.size - 1; i >= 0; i-- )
{
tempCrate = crates[i];
@@ -1966,15 +2012,20 @@ bot_lookat(angles, speed)
myAngle = self getPlayerAngles();
X = ( angles[0] - myAngle[0] );
while ( X > 170.0 )
X = X - 360.0;
while ( X < -170.0 )
X = X + 360.0;
X = X / speed;
Y = ( angles[1] - myAngle[1] );
while ( Y > 180.0 )
Y = Y - 360.0;
while ( Y < -180.0 )
Y = Y + 360.0;
@@ -2093,6 +2144,7 @@ bot_target_vehicle_loop()
target = undefined;
myEye = self getEye();
rocketAmmo = self getRocketAmmo();
for ( i = 0; i < airborne_enemies.size; i++ )
{
enemy = airborne_enemies[i];
@@ -2249,10 +2301,12 @@ bot_use_equipment_think_loop()
}
dir = self GetLookaheadDir();
if ( !IsDefined( dir ) )
return;
dir = VectorToAngles( dir );
if ( abs( dir[1] - self.angles[1] ) > 5 )
return;
@@ -2265,6 +2319,7 @@ bot_use_equipment_think_loop()
grenades = GetEntArray( "grenade", "classname" );
anyEquNear = false;
for ( i = 0; i < grenades.size; i++ )
{
item = grenades[i];
@@ -2374,16 +2429,20 @@ bot_go_revive(revive)
bot_revive_think_loop()
{
revivePlayer = undefined;
for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
if ( !isDefined( player.pers["team"] ) )
continue;
if ( player == self )
continue;
if ( self.pers["team"] != player.pers["team"] )
continue;
if ( !isDefined( player.revivetrigger ) )
continue;
@@ -2602,6 +2661,7 @@ follow_target_loop()
self thread stop_go_target_on_death( threat );
self SetBotGoal( threat.origin, 64 );
if ( self waittill_any_return( "new_goal", "goal", "bad_path" ) != "new_goal" )
self ClearBotGoal();
}
@@ -2631,6 +2691,7 @@ follow_target()
bot_watch_think_mw2_loop()
{
tube = self getValidTube();
if ( !isDefined( tube ) )
{
if ( self GetAmmoCount( "m72_law_mp" ) )
@@ -2712,6 +2773,7 @@ bot_weapon_think_loop(data)
weaponslist = self getweaponslist();
weap = "";
while ( weaponslist.size )
{
weapon = weaponslist[randomInt( weaponslist.size )];
@@ -2784,6 +2846,7 @@ bot_uav_think_loop(data)
hasUAV = false;
hasSR = false;
if ( level.teamBased )
{
if ( level.activeCounterUAVs[otherTeam] && !hasCam )
@@ -2896,6 +2959,7 @@ bot_uav_think_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
break;
}
}
@@ -2906,6 +2970,7 @@ bot_uav_think_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
break;
}
}
@@ -2922,6 +2987,7 @@ bot_uav_think()
data = spawnStruct();
data.wasFooled = false;
for ( ;; )
{
wait 0.75;
@@ -2982,12 +3048,14 @@ bot_revenge_think()
bot_listen_to_steps_loop()
{
dist = 100;
if ( self hasPerk( "specialty_loudenemies" ) )
dist *= 1.4;
dist *= dist;
heard = undefined;
for ( i = level.players.size - 1 ; i >= 0; i-- )
{
player = level.players[i];
@@ -3000,8 +3068,10 @@ bot_listen_to_steps_loop()
if ( level.teamBased && self.team == player.team )
continue;
if ( player.sessionstate != "playing" )
continue;
if ( !isAlive( player ) )
continue;
@@ -3136,6 +3206,7 @@ bot_dom_spawn_kill_think_loop()
return;
flag = undefined;
for ( i = 0; i < level.flags.size; i++ )
{
if ( level.flags[i] maps\mp\gametypes\dom::getFlagTeam() == myTeam )
@@ -3212,6 +3283,7 @@ bot_dom_def_think_loop()
{
myTeam = self.pers[ "team" ];
flag = undefined;
for ( i = 0; i < level.flags.size; i++ )
{
if ( level.flags[i] maps\mp\gametypes\dom::getFlagTeam() != myTeam )
@@ -3322,6 +3394,7 @@ bot_dom_cap_think_loop()
flag = undefined;
flags = [];
for ( i = 0; i < level.flags.size; i++ )
{
if ( level.flags[i] maps\mp\gametypes\dom::getFlagTeam() == myTeam )
@@ -3463,6 +3536,7 @@ bot_hq_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -3654,6 +3728,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
self.bot_lock_goal = false;
return;
}
@@ -3667,6 +3742,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
self.bot_lock_goal = false;
return;
}
@@ -3688,6 +3764,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -3746,6 +3823,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -3773,7 +3851,8 @@ bot_sab_loop()
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
{
wait 4;
self notify("bot_inc_bots"); site.bots--;
self notify( "bot_inc_bots" );
site.bots--;
return;
}
@@ -3783,6 +3862,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
self.bot_lock_goal = false;
return;
}
@@ -3804,6 +3884,7 @@ bot_sab_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -3923,6 +4004,7 @@ bot_sd_defenders_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
}
@@ -3932,6 +4014,7 @@ bot_sd_defenders_loop(data)
return;
sites = [];
for ( i = 0; i < level.bombZones.size; i++ )
{
sites[sites.size] = level.bombZones[i];
@@ -4003,6 +4086,7 @@ bot_sd_defenders_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4151,6 +4235,7 @@ bot_sd_attackers_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4174,6 +4259,7 @@ bot_sd_attackers_loop(data)
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4198,6 +4284,7 @@ bot_sd_attackers_loop(data)
return;
sites = [];
for ( i = 0; i < level.bombZones.size; i++ )
{
sites[sites.size] = level.bombZones[i];
@@ -4295,7 +4382,8 @@ bot_cap_loop()
else
{
if ( !theirflag maps\mp\gametypes\_gameobjects::isObjectAwayFromHome() && randomint( 100 ) < 50 )
{ //take their flag
{
//take their flag
self bot_cap_get_flag( theirflag );
}
else
@@ -4321,6 +4409,7 @@ bot_cap_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4330,7 +4419,8 @@ bot_cap_loop()
if ( DistanceSquared( origin, self.origin ) <= 1024 * 1024 )
{
wait 4;
self notify("bot_inc_bots"); theirzone.bots--;
self notify( "bot_inc_bots" );
theirzone.bots--;
return;
}
@@ -4357,8 +4447,10 @@ bot_cap_loop()
evt = self waittill_any_return( "goal", "bad_path", "new_goal" );
wait 1;
if ( evt != "new_goal" )
self ClearBotGoal();
self.bot_lock_goal = false;
return;
}
@@ -4439,6 +4531,7 @@ bot_cap_get_flag(flag)
wait 1;
self.bot_lock_goal = false;
if ( evt != "new_goal" )
self ClearBotGoal();
}
@@ -4509,6 +4602,7 @@ bot_dem_attackers_loop()
bombs = [];//sites with bombs
sites = [];//sites to bomb at
bombed = 0;//exploded sites
for ( i = 0; i < level.bombZones.size; i++ )
{
bomb = level.bombZones[i];
@@ -4539,9 +4633,11 @@ bot_dem_attackers_loop()
continue;
}
}
timeleft = maps\mp\gametypes\_globallogic_utils::getTimeRemaining() / 1000;
shouldLet = ( game["teamScores"][myteam] > game["teamScores"][otherTeam] && timeleft < 90 && bombed == 1 );
//spawnkill conditions
//if we have bombed one site or 1 bomb is planted with lots of time left, spawn kill
//if we want the other team to win for overtime and they do not need to defuse, spawn kill
@@ -4566,6 +4662,7 @@ bot_dem_attackers_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4657,6 +4754,7 @@ bot_dem_attackers_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4729,6 +4827,7 @@ bot_dem_defenders_loop()
bombs = [];//sites with bombs
sites = [];//sites to bomb at
bombed = 0;//exploded sites
for ( i = 0; i < level.bombZones.size; i++ )
{
bomb = level.bombZones[i];
@@ -4759,6 +4858,7 @@ bot_dem_defenders_loop()
continue;
}
}
timeleft = maps\mp\gametypes\_globallogic_utils::getTimeRemaining() / 1000;
shouldLet = ( timeleft < 60 && ( ( bombed == 0 && bombs.size != 2 ) || ( game["teamScores"][myteam] > game["teamScores"][otherTeam] && bombed == 1 ) ) && randomInt( 100 ) < 98 );
@@ -4787,6 +4887,7 @@ bot_dem_defenders_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}
@@ -4881,6 +4982,7 @@ bot_dem_defenders_loop()
if ( self waittill_any_return( "goal", "bad_path", "new_goal" ) != "new_goal" )
self ClearBotGoal();
return;
}

View File

@@ -16,6 +16,7 @@ getBotArray()
{
result = [];
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -146,12 +147,15 @@ GetBotDiffNum()
case "fu":
num = 3;
break;
case "hard":
num = 2;
break;
case "normal":
num = 1;
break;
case "easy":
default:
num = 0;
@@ -319,6 +323,7 @@ botStopMove(what)
return;
og = self.origin;
for ( ;; )
{
self setVelocity( ( 0, 0, 0 ) );
@@ -333,37 +338,122 @@ botStopMove(what)
keyCodeToString( a )
{
b = "";
switch ( a )
{
case 0: b= "a"; break;
case 1: b= "b"; break;
case 2: b= "c"; break;
case 3: b= "d"; break;
case 4: b= "e"; break;
case 5: b= "f"; break;
case 6: b= "g"; break;
case 7: b= "h"; break;
case 8: b= "i"; break;
case 9: b= "j"; break;
case 10: b= "k"; break;
case 11: b= "l"; break;
case 12: b= "m"; break;
case 13: b= "n"; break;
case 14: b= "o"; break;
case 15: b= "p"; break;
case 16: b= "q"; break;
case 17: b= "r"; break;
case 18: b= "s"; break;
case 19: b= "t"; break;
case 20: b= "u"; break;
case 21: b= "v"; break;
case 22: b= "w"; break;
case 23: b= "x"; break;
case 24: b= "y"; break;
case 25: b= "z"; break;
case 26: b= "."; break;
case 27: b= " "; break;
case 0:
b = "a";
break;
case 1:
b = "b";
break;
case 2:
b = "c";
break;
case 3:
b = "d";
break;
case 4:
b = "e";
break;
case 5:
b = "f";
break;
case 6:
b = "g";
break;
case 7:
b = "h";
break;
case 8:
b = "i";
break;
case 9:
b = "j";
break;
case 10:
b = "k";
break;
case 11:
b = "l";
break;
case 12:
b = "m";
break;
case 13:
b = "n";
break;
case 14:
b = "o";
break;
case 15:
b = "p";
break;
case 16:
b = "q";
break;
case 17:
b = "r";
break;
case 18:
b = "s";
break;
case 19:
b = "t";
break;
case 20:
b = "u";
break;
case 21:
b = "v";
break;
case 22:
b = "w";
break;
case 23:
b = "x";
break;
case 24:
b = "y";
break;
case 25:
b = "z";
break;
case 26:
b = ".";
break;
case 27:
b = " ";
break;
}
return b;
}
@@ -404,6 +494,7 @@ bot_onUsePlantObjectFix( player )
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
}
thread playSoundOnPlayers( "mus_sd_planted" + "_" + level.teamPostfix[player.pers["team"]] );
// removed plant audio until finalization of assest TODO : new plant sounds when assests are online
// player playSound( "mpl_sd_bomb_plant" );
@@ -474,6 +565,7 @@ bot_bombPlanted( destroyedObj, player )
level.sdBombModel.angles = dropAngles;
level.sdBombModel setModel( "prop_suitcase_bomb" );
}
destroyedObj maps\mp\gametypes\_gameobjects::allowUse( "none" );
destroyedObj maps\mp\gametypes\_gameobjects::setVisibleTeam( "none" );
/*
@@ -545,6 +637,7 @@ bot_bombPlanted( destroyedObj, player )
for ( index = 0; index < level.bombZones.size; index++ )
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
defuseObject maps\mp\gametypes\_gameobjects::disableObject();
setGameEndTime( 0 );

View File

@@ -30,51 +30,70 @@ init()
if ( getDvar( "bots_manage_add" ) == "" )
setDvar( "bots_manage_add", 0 ); //amount of bots to add to the game
if ( getDvar( "bots_manage_fill" ) == "" )
setDvar( "bots_manage_fill", 0 ); //amount of bots to maintain
if ( getDvar( "bots_manage_fill_spec" ) == "" )
setDvar( "bots_manage_fill_spec", true ); //to count for fill if player is on spec team
if ( getDvar( "bots_manage_fill_mode" ) == "" )
setDvar( "bots_manage_fill_mode", 0 ); //fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1
if ( getDvar( "bots_manage_fill_kick" ) == "" )
setDvar( "bots_manage_fill_kick", false ); //kick bots if too many
if ( getDvar( "bots_team" ) == "" )
setDvar( "bots_team", "autoassign" ); //which team for bots to join
if ( getDvar( "bots_team_amount" ) == "" )
setDvar( "bots_team_amount", 0 ); //amount of bots on axis team
if ( getDvar( "bots_team_force" ) == "" )
setDvar( "bots_team_force", false ); //force bots on team
if ( getDvar( "bots_team_mode" ) == "" )
setDvar( "bots_team_mode", 0 ); //counts just bots when 1
if ( getDvar( "bots_loadout_reasonable" ) == "" ) //filter out the bad 'guns' and perks
setDvar( "bots_loadout_reasonable", false );
if ( getDvar( "bots_loadout_allow_op" ) == "" ) //allows jug, marty and laststand
setDvar( "bots_loadout_allow_op", true );
if ( getDvar( "bots_loadout_rank" ) == "" ) // what rank the bots should be around, -1 is around the players, 0 is all random
setDvar( "bots_loadout_rank", -1 );
if ( getDvar( "bots_loadout_codpoints" ) == "" ) // how much cod points a bot should have, -1 is around the players, 0 is all random
setDvar( "bots_loadout_codpoints", -1 );
if ( getDvar( "bots_loadout_prestige" ) == "" ) // what pretige the bots will be, -1 is the players, -2 is random
setDvar( "bots_loadout_prestige", -1 );
if ( getDvar( "bots_play_target_other" ) == "" ) //bot target non play ents (vehicles)
setDvar( "bots_play_target_other", true );
if ( getDvar( "bots_play_killstreak" ) == "" ) //bot use killstreaks
setDvar( "bots_play_killstreak", true );
if ( getDvar( "bots_play_nade" ) == "" ) //bots grenade
setDvar( "bots_play_nade", true );
if ( getDvar( "bots_play_knife" ) == "" ) //bots knife
setDvar( "bots_play_knife", true );
if ( getDvar( "bots_play_fire" ) == "" ) //bots fire
setDvar( "bots_play_fire", true );
if ( getDvar( "bots_play_move" ) == "" ) //bots move
setDvar( "bots_play_move", true );
if ( getDvar( "bots_play_take_carepackages" ) == "" ) //bots take carepackages
setDvar( "bots_play_take_carepackages", true );
if ( getDvar( "bots_play_obj" ) == "" ) //bots play the obj
setDvar( "bots_play_obj", true );
if ( getDvar( "bots_play_camp" ) == "" ) //bots camp and follow
setDvar( "bots_play_camp", true );
@@ -180,6 +199,7 @@ doNonDediBots()
if ( getDvar( "bot_enemies_extra" ) == "" )
setDvar( "bot_enemies_extra", 0 );
if ( getDvar( "bot_friends_extra" ) == "" )
setDvar( "bot_friends_extra", 0 );
@@ -193,6 +213,7 @@ doNonDediBots()
host = GetHostPlayer();
team = "allies";
if ( isDefined( host ) && isDefined( host.pers[ "team" ] ) && ( host.pers[ "team" ] == "allies" || host.pers[ "team" ] == "axis" ) )
team = host.pers[ "team" ];
@@ -365,6 +386,7 @@ teamBots_loop()
axisplayers = 0;
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -406,6 +428,7 @@ teamBots_loop()
if ( abs( axis - allies ) > 1 )
{
toTeam = "axis";
if ( axis > allies )
toTeam = "allies";
}
@@ -414,6 +437,7 @@ teamBots_loop()
if ( toTeam != "autoassign" )
{
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -433,6 +457,7 @@ teamBots_loop()
player thread [[level.axis]]();
else
player thread [[level.spectator]]();
break;
}
}
@@ -441,6 +466,7 @@ teamBots_loop()
else
{
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -521,6 +547,7 @@ addBots_loop()
spec = 0;
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -542,6 +569,7 @@ addBots_loop()
alliesplayers = 0;
playercount = level.players.size;
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
@@ -582,8 +610,10 @@ addBots_loop()
}
amount = bots;
if ( fillMode == 0 || fillMode == 2 )
amount += players;
if ( getDVarInt( "bots_manage_fill_spec" ) )
amount += spec;
@@ -592,6 +622,7 @@ addBots_loop()
else if ( amount > fillAmount && getDvarInt( "bots_manage_fill_kick" ) )
{
tempBot = PickRandom( getBotArray() );
if ( isDefined( tempBot ) )
kick( tempBot getEntityNumber(), "EXE_PLAYERKICKED" );
}
@@ -734,6 +765,7 @@ watch_grenade()
self endon( "disconnect" );
self.bot_scrambled = false;
for ( ;; )
{
self waittill( "grenade_fire", g, name );
@@ -772,6 +804,7 @@ watch_decoy(g)
level.bot_decoys[entry] = level.bot_decoys[entry + 1];
entry++;
}
level.bot_decoys[entry] = undefined;
break;
}
@@ -802,6 +835,7 @@ scramble_nearby(trig)
wait 0.05;
self.team = self.owner.team;
for ( ;; )
{
trig waittill( "trigger", player );
@@ -845,6 +879,7 @@ watch_shoot()
self endon( "disconnect" );
self.bot_firing = false;
for ( ;; )
{
self waittill( "weapon_fired" );
@@ -871,6 +906,7 @@ doFiringThread()
bot_watch_planes_loop()
{
ents = GetEntArray( "script_model", "classname" );
for ( i = 0; i < ents.size; i++ )
{
ent = ents[i];
@@ -918,6 +954,7 @@ watch_plane(ent)
level.bot_planes[entry] = level.bot_planes[entry + 1];
entry++;
}
level.bot_planes[entry] = undefined;
break;
}
@@ -942,8 +979,10 @@ fixGamemodes()
if ( isDefined( level.bombZones ) && level.gametype == "sd" )
{
level.isKillBoosting = ::bot_killBoost;
for ( i = 0; i < level.bombZones.size; i++ )
level.bombZones[i].onUse = ::bot_onUsePlantObjectFix;
break;
}