From 0d163cff3dd1e4199af693c83687b9a297256184 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Sun, 20 Dec 2020 21:31:04 -0600 Subject: [PATCH] prestige --- README.md | 2 ++ main_shared/maps/mp/bots/_bot.gsc | 2 ++ main_shared/maps/mp/bots/_bot_script.gsc | 38 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/README.md b/README.md index 512b2fb..88d13f0 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,8 @@ Pressing the menu button again closes menus. - 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_loadout_prestige - an integer number, bots will be this prestige, -1 is the same as player, -2 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 diff --git a/main_shared/maps/mp/bots/_bot.gsc b/main_shared/maps/mp/bots/_bot.gsc index 43e095a..b390e29 100644 --- a/main_shared/maps/mp/bots/_bot.gsc +++ b/main_shared/maps/mp/bots/_bot.gsc @@ -62,6 +62,8 @@ init() 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_loadout_prestige") == "")// what pretige the bots will be, -1 is the players, -2 is random + setDvar("bots_loadout_prestige", -1); if(getDvar("bots_play_move") == "")//bots move setDvar("bots_play_move", true); diff --git a/main_shared/maps/mp/bots/_bot_script.gsc b/main_shared/maps/mp/bots/_bot_script.gsc index 5167c20..a48c400 100644 --- a/main_shared/maps/mp/bots/_bot_script.gsc +++ b/main_shared/maps/mp/bots/_bot_script.gsc @@ -12,6 +12,8 @@ added() rankxp = self bot_get_rank(); self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, "rankxp", 0 )), rankxp ); + + self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, "plevel", 0 )), self bot_get_prestige() ); self set_diff(); @@ -810,6 +812,42 @@ get_random_weapon(groups, rank) } } +/* + Gets the prestige +*/ +bot_get_prestige() +{ + p_dvar = getDvarInt("bots_loadout_prestige"); + p = 0; + + if (p_dvar == -1) + { + for (i = 0; i < level.players.size; i++) + { + player = level.players[i]; + + if (!isDefined(player.team)) + continue; + + if (player is_bot()) + continue; + + p = player getStat( int(tableLookup( "mp/playerStatsTable.csv", 1, "plevel", 0 )) ); + break; + } + } + else if (p_dvar == -2) + { + p = randomInt(12); + } + else + { + p = p_dvar; + } + + return p; +} + /* Gets an exp amount for the bot that is nearish the host's xp. */