This commit is contained in:
ineed bots 2022-03-24 16:19:57 -06:00
parent 395a991b6f
commit a015aed62a

View File

@ -6,15 +6,18 @@
init() init()
{ {
setDvarIfUninitialized( "bots_sniperLoadout", false ); setDvarIfUninitialized( "bots_sniperLoadout", false );
setDvarIfUninitialized( "bots_oneHardIsSniper", false );
level thread onBotConnected(); level thread onBotConnected();
level thread watchOneHardIsSniper();
} }
onBotConnected() onBotConnected()
{ {
for (;;) for ( ;; )
{ {
level waittill("bot_connected", bot); level waittill( "bot_connected", bot );
bot thread onBotGivenLoadout(); bot thread onBotGivenLoadout();
} }
@ -22,15 +25,43 @@ onBotConnected()
onBotGivenLoadout() onBotGivenLoadout()
{ {
self endon("disconnect"); self endon( "disconnect" );
for (;;) for ( ;; )
{ {
self waittill( "bot_giveLoadout", allowCopycat ); self waittill( "bot_giveLoadout", allowCopycat );
if (!getDvarInt("bots_sniperLoadout")) if ( !getDvarInt( "bots_sniperLoadout" ) )
continue; continue;
self give_sniper_loadout();
}
}
watchOneHardIsSniper()
{
for(;;)
{
wait 1;
if ( !getDvarInt( "bots_oneHardIsSniper" ) )
continue;
foreach (bot in level.bots)
{
if (bot.pers["bots"]["skill"]["base"] >= 7)
{
if (isAlive(bot) && !bot.isSniper)
bot give_sniper_loadout();
break;
}
}
}
}
give_sniper_loadout()
{
self.pers["bots"]["behavior"]["quickscope"] = true; self.pers["bots"]["behavior"]["quickscope"] = true;
// clear perks and weapons // clear perks and weapons
@ -57,8 +88,9 @@ onBotGivenLoadout()
// make into sniper model // make into sniper model
if ( level.environment != "" ) if ( level.environment != "" )
self [[game[self.team+"_model"]["GHILLIE"]]](); self [[game[self.team + "_model"]["GHILLIE"]]]();
else else
self [[game[self.team+"_model"]["SNIPER"]]](); self [[game[self.team + "_model"]["SNIPER"]]]();
}
self.isSniper = true;
} }