mirror of
https://github.com/ineedbots/t5_bot_warfare.git
synced 2025-05-10 14:14:51 +00:00
adapter
This commit is contained in:
parent
aa140d7417
commit
5063850e66
@ -5382,16 +5382,6 @@ bot_dem_defend_spawnkill()
|
|||||||
self notify( "bad_path" );
|
self notify( "bad_path" );
|
||||||
}
|
}
|
||||||
|
|
||||||
botMovementOverride( a, b ) {}
|
|
||||||
botClearMovementOverride() {}
|
|
||||||
botClearButtonOverride( a ) {}
|
|
||||||
botButtonOverride( a, b ) {}
|
|
||||||
botClearOverrides( a ) {}
|
|
||||||
botMantleOverride() {}
|
|
||||||
botClearMantleOverride() {}
|
|
||||||
botClearWeaponOverride() {}
|
|
||||||
botWeaponOverride( a ) {}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
custom movement stuff
|
custom movement stuff
|
||||||
*/
|
*/
|
||||||
@ -5400,7 +5390,7 @@ watch_for_override_stuff()
|
|||||||
self endon( "disconnect" );
|
self endon( "disconnect" );
|
||||||
self endon( "death" );
|
self endon( "death" );
|
||||||
|
|
||||||
self botClearOverrides( true );
|
self BotBuiltinClearOverrides( true );
|
||||||
|
|
||||||
NEAR_DIST = 80;
|
NEAR_DIST = 80;
|
||||||
LONG_DIST = 1000;
|
LONG_DIST = 1000;
|
||||||
@ -5438,7 +5428,7 @@ watch_for_override_stuff()
|
|||||||
if ( need_to_clear_mantle_override && ( time - last_jump_time ) > 3000 )
|
if ( need_to_clear_mantle_override && ( time - last_jump_time ) > 3000 )
|
||||||
{
|
{
|
||||||
need_to_clear_mantle_override = false;
|
need_to_clear_mantle_override = false;
|
||||||
self botClearMantleOverride();
|
self BotBuiltinClearMantleOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomInt( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
|
if ( ( dist > NEAR_DIST ) && ( dist < LONG_DIST ) && ( randomInt( 100 ) < chance ) && ( ( time - last_jump_time ) > SPAM_JUMP_TIME ) )
|
||||||
@ -5449,28 +5439,28 @@ watch_for_override_stuff()
|
|||||||
{
|
{
|
||||||
last_jump_time = time;
|
last_jump_time = time;
|
||||||
need_to_clear_mantle_override = true;
|
need_to_clear_mantle_override = true;
|
||||||
self botMantleOverride();
|
self BotBuiltinMantleOverride();
|
||||||
|
|
||||||
// drop shot
|
// drop shot
|
||||||
self botMovementOverride( 0, 0 );
|
self BotBuiltinMovementOverride( 0, 0 );
|
||||||
self botButtonOverride( "prone", "enable" );
|
self BotBuiltinButtonOverride( "prone", "enable" );
|
||||||
|
|
||||||
wait 1.5;
|
wait 1.5;
|
||||||
|
|
||||||
self botClearMovementOverride();
|
self BotBuiltinClearMovementOverride();
|
||||||
self botClearButtonOverride( "prone" );
|
self BotBuiltinClearButtonOverride( "prone" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
last_jump_time = time;
|
last_jump_time = time;
|
||||||
need_to_clear_mantle_override = true;
|
need_to_clear_mantle_override = true;
|
||||||
self botMantleOverride();
|
self BotBuiltinMantleOverride();
|
||||||
|
|
||||||
// jump shot
|
// jump shot
|
||||||
self botButtonOverride( "gostand", "enable" );
|
self BotBuiltinButtonOverride( "gostand", "enable" );
|
||||||
wait 0.1;
|
wait 0.1;
|
||||||
self botClearButtonOverride( "gostand" );
|
self BotBuiltinClearButtonOverride( "gostand" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,130 @@
|
|||||||
#include maps\mp\_utility;
|
#include maps\mp\_utility;
|
||||||
#include maps\mp\gametypes\_hud_util;
|
#include maps\mp\gametypes\_hud_util;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Waits for the built-ins to be defined
|
||||||
|
*/
|
||||||
|
wait_for_builtins()
|
||||||
|
{
|
||||||
|
for ( i = 0; i < 20; i++ )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if ( i < 18 )
|
||||||
|
waittillframeend;
|
||||||
|
else
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Prints to console without dev script on
|
||||||
|
*/
|
||||||
|
BotBuiltinPrintConsole( s )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "printconsole" ] ) )
|
||||||
|
{
|
||||||
|
[[ level.bot_builtins[ "printconsole" ] ]]( s );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrintLn( s );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinMovementOverride( a, b )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botmovementoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botmovementoverride" ] ]]( a, b );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearMovementOverride()
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearmovementoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botclearmovementoverride" ] ]]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearButtonOverride( a )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearbuttonoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botclearbuttonoverride" ] ]]( a );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinButtonOverride( a, b )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botbuttonoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botbuttonoverride" ] ]]( a, b );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearOverrides( a )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearoverrides" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botclearoverrides" ] ]]( a );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinMantleOverride()
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botmantleoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botmantleoverride" ] ]]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearMantleOverride()
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearmantleoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botclearmantleoverride" ] ]]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinClearWeaponOverride()
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearweaponoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botclearweaponoverride" ] ]]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinWeaponOverride( a )
|
||||||
|
{
|
||||||
|
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botweaponoverride" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botweaponoverride" ] ]]( a );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns an array of all the bots in the game.
|
Returns an array of all the bots in the game.
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,9 @@ init()
|
|||||||
if ( !getDvarInt( "bots_main" ) )
|
if ( !getDvarInt( "bots_main" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( !wait_for_builtins() )
|
||||||
|
PrintLn( "FATAL: NO BUILT-INS FOR BOTS" );
|
||||||
|
|
||||||
if ( getDvar( "bots_main_waitForHostTime" ) == "" )
|
if ( getDvar( "bots_main_waitForHostTime" ) == "" )
|
||||||
setDvar( "bots_main_waitForHostTime", 10.0 ); //how long to wait to wait for the host player
|
setDvar( "bots_main_waitForHostTime", 10.0 ); //how long to wait to wait for the host player
|
||||||
|
|
||||||
@ -228,11 +231,11 @@ watchBotDebugEvent()
|
|||||||
if ( isDefined( g ) && isString( g ) )
|
if ( isDefined( g ) && isString( g ) )
|
||||||
big_str += ": " + g;
|
big_str += ": " + g;
|
||||||
|
|
||||||
Println( big_str );
|
BotBuiltinPrintConsole( big_str );
|
||||||
}
|
}
|
||||||
else if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) )
|
else if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) )
|
||||||
{
|
{
|
||||||
Println( "Bot Warfare debug: " + self.name + ": " + str );
|
BotBuiltinPrintConsole( "Bot Warfare debug: " + self.name + ": " + str );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
63
scripts/bots_adapter.gsc
Normal file
63
scripts/bots_adapter.gsc
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
init()
|
||||||
|
{
|
||||||
|
level.bot_builtins["printconsole"] = ::do_printconsole;
|
||||||
|
level.bot_builtins["botmovementoverride"] = ::do_botmovementoverride;
|
||||||
|
level.bot_builtins["botclearmovementoverride"] = ::do_botclearmovementoverride;
|
||||||
|
level.bot_builtins["botclearbuttonoverride"] = ::do_botclearbuttonoverride;
|
||||||
|
level.bot_builtins["botbuttonoverride"] = ::do_botbuttonoverride;
|
||||||
|
level.bot_builtins["botclearoverrides"] = ::do_botclearoverrides;
|
||||||
|
level.bot_builtins["botmantleoverride"] = ::do_botmantleoverride;
|
||||||
|
level.bot_builtins["botclearmantleoverride"] = ::do_botclearmantleoverride;
|
||||||
|
level.bot_builtins["botclearweaponoverride"] = ::do_botclearweaponoverride;
|
||||||
|
level.bot_builtins["botweaponoverride"] = ::do_botweaponoverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_printconsole( s )
|
||||||
|
{
|
||||||
|
PrintLn( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botmovementoverride( a, b )
|
||||||
|
{
|
||||||
|
self botMovementOverride( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botclearmovementoverride()
|
||||||
|
{
|
||||||
|
self botClearMovementOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botclearbuttonoverride( a )
|
||||||
|
{
|
||||||
|
self botClearButtonOverride( a );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botbuttonoverride( a, b )
|
||||||
|
{
|
||||||
|
self botButtonOverride( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botclearoverrides( a )
|
||||||
|
{
|
||||||
|
self botClearOverrides( a );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botmantleoverride()
|
||||||
|
{
|
||||||
|
self botMantleOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botclearmantleoverride()
|
||||||
|
{
|
||||||
|
self botClearMantleOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botclearweaponoverride()
|
||||||
|
{
|
||||||
|
self botClearWeaponOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
do_botweaponoverride( a )
|
||||||
|
{
|
||||||
|
self botWeaponOverride( a );
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user