ineedbots / iw4_bot_warfare

The Bot Warfare mod for MW2
https://www.moddb.com/mods/bot-warfare
106 stars 25 forks source link

Is there a way to auto add the bots to a new offline local game without having to open the menu and manually add them? #31

Closed phase19 closed 2 years ago

phase19 commented 2 years ago

I was wondering if there is a way to automatically add a preset number of bots to every game that one starts without having to wait for opening the menu once a game is started by hitting the '5' key and selecting manually the amount of bots to add. I was looking at _bot_utility.gsc file and the bots_main_waitForHostTime and bots_main_firstIsHost functions but I am not sure what needs to be changed. In the wiki it also states that bots_main_waitForHostTime default is 10 seconds. I was not able to find where this 10 seconds is being set at. If anyone can help me to add this automatically add bots to a new local LAN game functionality it would be greatly appreciated.

phase19 commented 2 years ago

I was able to find the following values in _bot.gsc and able to edit them.

    if(getDvar("bots_main_GUIDs") == "")
        setDvar("bots_main_GUIDs", "");//guids of players who will be given host powers, comma seperated
    if(getDvar("bots_main_firstIsHost") == "")
        setDvar("bots_main_firstIsHost", true);//first play to connect is a host
    if(getDvar("bots_main_waitForHostTime") == "")
        setDvar("bots_main_waitForHostTime", 1.0);//how long to wait to wait for the host player
phase19 commented 2 years ago

I was able to find a solution to my question by simply editing the following line in _bot.gsc located under mods/bots/z_svr_bots.iwd/maps/mp/bots/_bot.gsc. Simply change the bots_manage_add DVAR to whatever number of preset bots that you want to add to your game excluding yourself. For example, I added 11 bots so that I can automatically get teams of 6 players per team, 11 bots plus myself = 12 players.

if(getDvar("bots_manage_add") == "")
      setDvar("bots_manage_add", 11);//amount of bots to add to the game
Mystical-17 commented 2 years ago

I was able to find a solution to my question by simply editing the following line in _bot.gsc located under mods/bots/z_svr_bots.iwd/maps/mp/bots/_bot.gsc. Simply change the bots_manage_add DVAR to whatever number of preset bots that you want to add to your game excluding yourself. For example, I added 11 bots so that I can automatically get teams of 6 players per team, 11 bots plus myself = 12 players.

if(getDvar("bots_manage_add") == "")
      setDvar("bots_manage_add", 11);//amount of bots to add to the game

After you make the change how to you recompile the iwd file? Every time I try to zip it back and add back to the game the mod no longer works for me.

Elementtair commented 2 years ago

No need to compile; if you want to edit a file in the iwd just open the iwd with 7zip, open your file, edit it, save it and allow 7zip to update the file.

To add bot you don't need to mess with that file; just add the setting to your server cfg file.

Here is, for exemple, the bots control section of my cfg file: 6 players including bots - anytime a player comes in, a bot goes out - if no player comes in there is 6 bots on the map.

//******************************************************************************
// BOTS CONTROL
//******************************************************************************

set bots_main_firstIsHost "0"
set bots_team "autoassign" // autoassign; allies; axis; custom
set bots_team_mode "0" // 0 = bots and player, 1 = only count bots
set bots_manage_fill_mode "0" // 0 = bots and player, 1 = only count bots
set bots_manage_fill "6"   // total of player to maintain on the server
set bots_manage_fill_kick "1"    // kick a bot if a player join
set bots_manage_fill_spec "0"   // does the server count spectator or not
set bots_team_force "1" // if the server should enforce bot team during game
set bots_skill "4" // 0 = mix, 1 - 7, 8 = custom
set bots_loadout_allow_op "1"
set bots_loadout_reasonable "1"
Mystical-17 commented 2 years ago

Thanks I managed to figure it out and got my offline lobbies to autofill. Also added in a bunch of random bot names. Now I can play perpetual Ground War and its great.

ineedbots commented 2 years ago

please use the bots_manage_fill dvar.