UE3 - UT3 Supressing Bot Spawning

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

hdctambien

New Member
Apr 19, 2008
4
0
0
I am trying to create a gametype that starts the game with no bots. And then at a later time X bots will be spawned.

So far I have a class that extends UTTeamGame. And I'm trying to overwrite the AddInitialBots function so that it doesn't actually load bots initially.

Code:
function AddInitialBots()
{
	`log("Adding Initial Bots");
	return;
}

My log is displaying my comment (many times) so I know it's running my version of AddInitialBots, but bots are still being spawned when my map starts.

I have also tried setting MaxPlayersAllowed=1 in DefaultProperties, but bots are *still* being spawned.

Obviously I can move the slider for NumberOfOpponents to zero in the menu when I'm starting the game, but I don't know how to set the default of that slider to 0 and remove it from the menu, either.

Thanks for any help,
- hdcTambien
 

PredAlien

New Member
Mar 19, 2006
18
0
0
I used numplayers=1 (or something like that) in UT3 shortcut and its only me that loads in the game but thats probably not what you want.

I'm guessing you probably want to control this within the game code itself....
 

Payback

Ive got a big stick
Nov 21, 2002
94
0
0
ahl.action-web.net
Heres how I'd figure out whats going on

By default AddInitialBot calls AddBot() - You've overridden this but something is still spawning bots!

AddBot() can only be calling
Code:
function UTBot AddBot(optional string BotName, optional bool bUseTeamIndex, optional int TeamIndex)

and that calls SpawnBot(). Spawnbot is what starts treating everything as a player, so I'd say this is the point to start figuring out what else is calling it!

So - Override SpawnBot like so
Code:
function UTBot SpawnBot(optional string botName,optional bool bUseTeamIndex, optional int TeamIndex)
{
	ScriptTrace();
	Super.SpawnBot(botName, bUseTeamIndex, TeamIndex);
}
Now everytime something spawns a bot, the call stack used to reach this point will be written out to the log. Look in your log file and you'll see exactly why bots are still getting spawned.
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Set DesiredPlayerCount to 0, or block it from being set during InitGame (a code version of what PredAlien suggests):
Code:
function InitGame(string Options, out string ErrorMessage)
{
	RemoveOption(Options, "NumPlay");

	Options $= "?NumPlay=0";

	Super.InitGame(Options, ErrorMessage);
}