mirror of
https://github.com/JezuzLizard/t4sp_bot_warfare.git
synced 2025-12-24 18:41:50 +00:00
Compare commits
2 Commits
d22af0209a
...
d8b494017f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8b494017f | ||
|
|
766e846fe4 |
@@ -241,7 +241,12 @@ onActorDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon,
|
|||||||
{
|
{
|
||||||
if ( isdefined( eAttacker ) && isplayer( eAttacker ) && eAttacker is_bot() && getdvarint( "bots_t8_mode" ) && ( !isdefined( self.magic_bullet_shield ) || !self.magic_bullet_shield ) )
|
if ( isdefined( eAttacker ) && isplayer( eAttacker ) && eAttacker is_bot() && getdvarint( "bots_t8_mode" ) && ( !isdefined( self.magic_bullet_shield ) || !self.magic_bullet_shield ) )
|
||||||
{
|
{
|
||||||
iDamage += int( self.maxhealth * randomfloatrange( 0.25, 1.25 ) );
|
bonus = int( self.maxhealth * randomfloatrange( 0.25, 1.25 ) );
|
||||||
|
|
||||||
|
if ( bonus > 0 )
|
||||||
|
{
|
||||||
|
iDamage += bonus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self [[ level.prevcallbackactordamage ]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset );
|
self [[ level.prevcallbackactordamage ]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset );
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ init()
|
|||||||
setdvar( "developer_script", 1 );
|
setdvar( "developer_script", 1 );
|
||||||
setdvar( "developer", 2 );
|
setdvar( "developer", 2 );
|
||||||
|
|
||||||
setdvar( "sv_mapRotation", "map " + getdvar( "mapname" ) );
|
BotBuiltinCmdExec( "devmap " + getdvar( "mapname" ) );
|
||||||
exitlevel( false );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +72,7 @@ onPlayerSpawned()
|
|||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
self waittill( "spawned_player" );
|
self waittill( "spawned_player" );
|
||||||
|
self.score = 100000;
|
||||||
self thread beginDebug();
|
self thread beginDebug();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ watch_for_unlink()
|
|||||||
self endon( "disconnect" );
|
self endon( "disconnect" );
|
||||||
self endon( "zombified" );
|
self endon( "zombified" );
|
||||||
|
|
||||||
self BotBuiltinNotifyOnPlayerCommand( "+smoke", "toggle_unlink" );
|
self BotBuiltinNotifyOnPlayerCommand( "toggle_unlink", "+smoke" );
|
||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2145,14 +2145,14 @@ pressADS( time )
|
|||||||
time = 0.05;
|
time = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "+ads" );
|
self BotBuiltinBotAction( "+speed_throw" );
|
||||||
|
|
||||||
if ( time )
|
if ( time )
|
||||||
{
|
{
|
||||||
wait time;
|
wait time;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "-ads" );
|
self BotBuiltinBotAction( "-speed_throw" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2300,14 +2300,14 @@ pressFire( time )
|
|||||||
time = 0.05;
|
time = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "+fire" );
|
self BotBuiltinBotAction( "+attack" );
|
||||||
|
|
||||||
if ( time )
|
if ( time )
|
||||||
{
|
{
|
||||||
wait time;
|
wait time;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "-fire" );
|
self BotBuiltinBotAction( "-attack" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2456,8 +2456,8 @@ jump()
|
|||||||
*/
|
*/
|
||||||
stand()
|
stand()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-gocrouch" );
|
self BotBuiltinBotAction( "-crouch" );
|
||||||
self BotBuiltinBotAction( "-goprone" );
|
self BotBuiltinBotAction( "-prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2465,8 +2465,8 @@ stand()
|
|||||||
*/
|
*/
|
||||||
crouch()
|
crouch()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "+gocrouch" );
|
self BotBuiltinBotAction( "+crouch" );
|
||||||
self BotBuiltinBotAction( "-goprone" );
|
self BotBuiltinBotAction( "-prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2474,8 +2474,8 @@ crouch()
|
|||||||
*/
|
*/
|
||||||
prone()
|
prone()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-gocrouch" );
|
self BotBuiltinBotAction( "-crouch" );
|
||||||
self BotBuiltinBotAction( "+goprone" );
|
self BotBuiltinBotAction( "+prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -409,6 +409,7 @@ start_bot_threads()
|
|||||||
self endon( "zombified" );
|
self endon( "zombified" );
|
||||||
|
|
||||||
self thread doReloadCancel();
|
self thread doReloadCancel();
|
||||||
|
self thread bot_weapon_think();
|
||||||
|
|
||||||
self thread maps\bots\objectives\_manager::start_bot_threads();
|
self thread maps\bots\objectives\_manager::start_bot_threads();
|
||||||
}
|
}
|
||||||
@@ -532,3 +533,102 @@ doReloadCancel()
|
|||||||
self doReloadCancel_loop();
|
self doReloadCancel_loop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bot logic for switching weapons.
|
||||||
|
*/
|
||||||
|
bot_weapon_think_loop( data )
|
||||||
|
{
|
||||||
|
ret = self waittill_any_timeout( randomintrange( 2, 4 ), "bot_force_check_switch" );
|
||||||
|
|
||||||
|
if ( self BotIsFrozen() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( self inLastStand() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasTarget = self hasThreat();
|
||||||
|
curWeap = self getcurrentweapon();
|
||||||
|
|
||||||
|
force = ( ret == "bot_force_check_switch" );
|
||||||
|
|
||||||
|
if ( data.first )
|
||||||
|
{
|
||||||
|
data.first = false;
|
||||||
|
|
||||||
|
if ( randomint( 100 ) > self.pers[ "bots" ][ "behavior" ][ "initswitch" ] )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( curWeap != "none" && self getammocount( curWeap ) && curWeap != "molotov" && curWeap != "molotov_zombie" )
|
||||||
|
{
|
||||||
|
if ( randomint( 100 ) > self.pers[ "bots" ][ "behavior" ][ "switch" ] )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hasTarget )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
force = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
weaponslist = self getweaponslistprimaries();
|
||||||
|
weap = "";
|
||||||
|
|
||||||
|
while ( weaponslist.size )
|
||||||
|
{
|
||||||
|
weapon = weaponslist[ randomint( weaponslist.size ) ];
|
||||||
|
weaponslist = array_remove( weaponslist, weapon );
|
||||||
|
|
||||||
|
if ( !self getammocount( weapon ) && !force )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( curWeap == weapon )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
weap = weapon;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( weap == "" )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self thread changeToWeapon( weap );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Bot logic for switching weapons.
|
||||||
|
*/
|
||||||
|
bot_weapon_think()
|
||||||
|
{
|
||||||
|
self endon( "disconnect" );
|
||||||
|
self endon( "zombified" );
|
||||||
|
level endon( "game_ended" );
|
||||||
|
|
||||||
|
data = spawnstruct();
|
||||||
|
data.first = true;
|
||||||
|
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
self bot_weapon_think_loop( data );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ init()
|
|||||||
|
|
||||||
do_printconsole( s )
|
do_printconsole( s )
|
||||||
{
|
{
|
||||||
printconsole( s );
|
printf( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
do_botaction( action )
|
do_botaction( action )
|
||||||
@@ -49,8 +49,7 @@ do_botmeleeparams( yaw, dist )
|
|||||||
|
|
||||||
do_botangles( angles )
|
do_botangles( angles )
|
||||||
{
|
{
|
||||||
self setplayerangles( angles );
|
self botangles( angles );
|
||||||
// self botangles( angles[ 0 ], angles[ 1 ], angles[ 2 ] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_isbot()
|
do_isbot()
|
||||||
|
|||||||
Reference in New Issue
Block a user