Prep work for bot chatter

This commit is contained in:
ineed bots 2022-04-20 12:57:19 -06:00
parent 7eb6c7d246
commit e773996274
5 changed files with 86 additions and 10 deletions

View File

@ -102,6 +102,8 @@ You can easily setup a local LAN dedicated server for you to join and play on. H
| bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 |
| bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 |
| bots_skill_allies_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the allies team. The remaining bots on the team will be set to easy difficulty. | 0 |
| bots_skill_min | The minimum difficulty level for the bots. | 1 |
| bots_skill_max | The maximum difficulty level for the bots. | 7 |
| bots_loadout_reasonable | If the bots should filter bad performing create-a-class selections. | false |
| bots_loadout_allow_op | If the bots should be able to use overpowered and annoying create-a-class selections. | true |
| bots_loadout_rank | What rank to set the bots.<ul><li>`-1` - Average of all players in the match.</li><li>`0` - All random.</li><li>`1` or higher - Sets the bots' rank to this.</li></ul> | -1 |
@ -140,7 +142,7 @@ You can easily setup a local LAN dedicated server for you to join and play on. H
## Credits
- CoD4x Team - https://github.com/callofduty4x/CoD4x_Server
- INeedGames(me) - http://www.moddb.com/mods/bot-warfare
- INeedGames - http://www.moddb.com/mods/bot-warfare
- PeZBot team - http://www.moddb.com/mods/pezbot
- Ability
- Salvation

View File

@ -74,6 +74,12 @@ init()
if ( getDvar( "bots_skill_allies_med" ) == "" )
setDvar( "bots_skill_allies_med", 0 );
if ( getDvar( "bots_skill_min" ) == "" )
setDvar( "bots_skill_min", 1 );
if ( getDvar( "bots_skill_max" ) == "" )
setDvar( "bots_skill_max", 7 );
if ( getDvar( "bots_loadout_reasonable" ) == "" ) //filter out the bad 'guns' and perks
setDvar( "bots_loadout_reasonable", false );
@ -370,6 +376,26 @@ connected()
self thread onDisconnect();
level notify( "bot_connected", self );
self thread watchBotDebugEvent();
}
/*
DEBUG
*/
watchBotDebugEvent()
{
self endon( "disconnect" );
for ( ;; )
{
self waittill( "bot_event", msg, str, b, c, d, e, f, g );
if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) )
{
printToConsole( "Bot Warfare debug: " + self.name + ": " + str );
}
}
}
/*
@ -481,6 +507,20 @@ diffBots_loop()
player.pers["bots"]["skill"]["base"] = var_skill;
}
}
playercount = level.players.size;
min_diff = GetDvarInt( "bots_skill_min" );
max_diff = GetDvarInt( "bots_skill_max" );
for ( i = 0; i < playercount; i++ )
{
player = level.players[i];
if ( !player is_bot() )
continue;
player.pers["bots"]["skill"]["base"] = int( clamp( player.pers["bots"]["skill"]["base"], min_diff, max_diff ) );
}
}
/*

View File

@ -1843,6 +1843,7 @@ doWalkScriptNotify()
*/
doWalk( goal, dist, isScriptGoal )
{
level endon ( "game_ended" );
self endon( "kill_goal" );
self endon( "goal_internal" ); //so that the watchOnGoal notify can happen same frame, not a frame later
@ -1940,6 +1941,8 @@ movetowards( goal )
randomDir = self getRandomLargestStafe( stucks );
self BotNotifyBotEvent( "stuck" );
self botMoveTo( randomDir );
wait stucks;
self stand();

View File

@ -1454,6 +1454,10 @@ bot_think_camp_loop()
self SetScriptGoal( campSpot.origin, 16 );
time = randomIntRange( 10, 20 );
self BotNotifyBotEvent( "camp", "go", campSpot, time );
ret = self waittill_any_return( "new_goal", "goal", "bad_path" );
if ( ret != "new_goal" )
@ -1462,8 +1466,12 @@ bot_think_camp_loop()
if ( ret != "goal" )
return;
self thread killCampAfterTime( randomIntRange( 10, 20 ) );
self BotNotifyBotEvent( "camp", "start", campSpot, time );
self thread killCampAfterTime( time );
self CampAtSpot( campSpot.origin, campSpot.origin + AnglesToForward( campSpot.angles ) * 2048 );
self BotNotifyBotEvent( "camp", "stop", campSpot, time );
}
/*
@ -1582,8 +1590,14 @@ bot_think_follow_loop()
if ( !isDefined( toFollow ) )
return;
self thread killFollowAfterTime( randomIntRange( 10, 20 ) );
time = randomIntRange( 10, 20 );
self BotNotifyBotEvent( "follow", "start", toFollow, time );
self thread killFollowAfterTime( time );
self followPlayer( toFollow );
self BotNotifyBotEvent( "follow", "stop", toFollow, time );
}
/*

View File

@ -228,6 +228,14 @@ BotStopMoving( what )
self notify( "kill_goal" );
}
/*
Notify the bot chat message
*/
BotNotifyBotEvent( msg, a, b, c, d, e, f, g )
{
self notify( "bot_event", msg, a, b, c, d, e, f, g );
}
/*
Returns if the bot has a script goal.
(like t5 gsc bot)
@ -956,16 +964,25 @@ Round( x )
}
/*
Rounds up the given value.
clamps angle between -180 and 180
*/
RoundUp( floatVal )
AngleClamp180( angle )
{
i = int( floatVal );
angleFrac = angle / 360.0;
angle = ( angleFrac - floor( angleFrac ) ) * 360.0;
if ( i != floatVal )
return i + 1;
else
return i;
if ( angle > 180.0 )
return angle - 360.0;
return angle;
}
/*
Clamps between value
*/
Clamp( a, minv, maxv )
{
return max( min( a, maxv ), minv );
}
/*