From 00cfb8ff55c09ec489b03a1dd1ea8f17668925e8 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Sun, 20 Dec 2020 21:23:33 -0600 Subject: [PATCH] bots_loadout_prestige --- README.md | 2 ++ userraw/maps/mp/bots/_bot.gsc | 2 ++ userraw/maps/mp/bots/_bot_script.gsc | 38 +++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c5af1c..0b75957 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ You can find the ModDB release post [here](https://www.moddb.com/mods/bot-warfar - 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/userraw/maps/mp/bots/_bot.gsc b/userraw/maps/mp/bots/_bot.gsc index 876bf78..94814e5 100644 --- a/userraw/maps/mp/bots/_bot.gsc +++ b/userraw/maps/mp/bots/_bot.gsc @@ -68,6 +68,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/userraw/maps/mp/bots/_bot_script.gsc b/userraw/maps/mp/bots/_bot_script.gsc index 3f3ae8a..d0bb1cf 100644 --- a/userraw/maps/mp/bots/_bot_script.gsc +++ b/userraw/maps/mp/bots/_bot_script.gsc @@ -19,7 +19,7 @@ added() self endon("disconnect"); self setPlayerData("experience", self bot_get_rank()); - self setPlayerData("prestige", 0); + self setPlayerData("prestige", self bot_get_prestige()); self setPlayerData("cardTitle", random(getCardTitles())); self setPlayerData("cardIcon", random(getCardIcons())); @@ -52,6 +52,42 @@ connected() self thread onKillcam(); } +/* + Gets the prestige +*/ +bot_get_prestige() +{ + p_dvar = getDvarInt("bots_loadout_prestige"); + p = 0; + + if (p_dvar == -1) + { + for (i = 0; i < level.players[i]; i++) + { + player = level.players[i]; + + if (!isDefined(player.team)) + continue; + + if (player is_bot()) + continue; + + p = player getPlayerData("prestige"); + 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. */