bots_loadout_rank

This commit is contained in:
INeedBots 2020-12-20 20:36:22 -06:00
parent 4f374c60e7
commit 9f327ec50b
3 changed files with 51 additions and 33 deletions

View File

@ -126,6 +126,8 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar
- bots_loadout_allow_op - a boolean value (0 or 1), whether or not if the bots are allowed to use deathstreaks, noobtubes, rpg, laststand, etc.
- bots_loadout_rank - an integer number, bots will be around this rank, -1 is average of all players in game, 0 is all random
- bots_play_move - a boolean value (0 or 1), whether or not if the bots will move
- bots_play_knife - a boolean value (0 or 1), whether or not if the bots will use the knife
- bots_play_fire - a boolean value (0 or 1), whether or not if the bots will fire their weapons

View File

@ -66,6 +66,8 @@ init()
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_play_move") == "")//bots move
setDvar("bots_play_move", true);

View File

@ -57,48 +57,62 @@ connected()
*/
bot_get_rank()
{
ranks = [];
bot_ranks = [];
human_ranks = [];
for ( i = level.players.size - 1; i >= 0; i-- )
rank = 1;
rank_dvar = getDvarInt("bots_loadout_rank");
if (rank_dvar == -1)
{
player = level.players[i];
if ( player == self )
continue;
ranks = [];
bot_ranks = [];
human_ranks = [];
if ( !IsDefined( player.pers[ "rank" ] ) )
continue;
for ( i = level.players.size - 1; i >= 0; i-- )
{
player = level.players[i];
if ( player is_bot() )
{
bot_ranks[ bot_ranks.size ] = player.pers[ "rank" ];
if ( player == self )
continue;
if ( !IsDefined( player.pers[ "rank" ] ) )
continue;
if ( player is_bot() )
{
bot_ranks[ bot_ranks.size ] = player.pers[ "rank" ];
}
else
{
human_ranks[ human_ranks.size ] = player.pers[ "rank" ];
}
}
else
if( !human_ranks.size )
human_ranks[ human_ranks.size ] = Round( random_normal_distribution( 45, 20, 0, level.maxRank ) );
human_avg = array_average( human_ranks );
while ( bot_ranks.size + human_ranks.size < 5 )
{
human_ranks[ human_ranks.size ] = player.pers[ "rank" ];
// add some random ranks for better random number distribution
rank = human_avg + RandomIntRange( -10, 10 );
human_ranks[ human_ranks.size ] = rank;
}
ranks = array_combine( human_ranks, bot_ranks );
avg = array_average( ranks );
s = array_std_deviation( ranks, avg );
rank = Round( random_normal_distribution( avg, s, 0, level.maxRank ) );
}
if( !human_ranks.size )
human_ranks[ human_ranks.size ] = Round( random_normal_distribution( 45, 20, 0, level.maxRank ) );
human_avg = array_average( human_ranks );
while ( bot_ranks.size + human_ranks.size < 5 )
else if (rank_dvar == 0)
{
// add some random ranks for better random number distribution
rank = human_avg + RandomIntRange( -10, 10 );
human_ranks[ human_ranks.size ] = rank;
rank = Round( random_normal_distribution( 45, 20, 0, level.maxRank ) );
}
else
{
rank = Round( random_normal_distribution( rank_dvar, 5, 0, level.maxRank ) );
}
ranks = array_combine( human_ranks, bot_ranks );
avg = array_average( ranks );
s = array_std_deviation( ranks, avg );
rank = Round( random_normal_distribution( avg, s, 0, level.maxRank ) );
return maps\mp\gametypes\_rank::getRankInfoMinXP( rank );
}