Page 1 of 1

Renaming bots? (In the debugger)

Posted: Thu Jun 07, 2018 6:13 pm
by Skull Kid
Alright, I searched the forums for this, but couldn't find anything related to renaming bots. I've successfully been able to spawn vehicles in the debugger, reassigning bots from Axis to Allies, and vice-versa. But I have yet to find out how to rename bots.

I tried in the console with the "player.name" command. It doesn't seem to work though… as it says "property is readable only.".

Re: Renaming bots? (In the debugger)

Posted: Fri Jun 08, 2018 5:10 pm
by russ
The Player.name method is read-only, there's no way to get around that. game.changePlayerName initially looked promising, but is unimplemented. The Object.name method cannot be used because a BFPlayer is not part of the object system.

game.addFirstNameOnTeam/game.addSecondNameOnTeam can of course be used for randomly generated names (along with setRandomNames)

Normally bots are created automatically, but you should be able to also create them with game.createAIPlayer game.createUnspawnedAIPlayer. These might let you set whatever names you want.

http://www.battlefieldsingleplayer.com/ ... t3527.html
http://bfmods.com/mdt/scripting/Game/Pr ... layer.html
http://bfmods.com/mdt/scripting/Game/Pr ... layer.html

Re: Renaming bots? (In the debugger)

Posted: Fri Jun 08, 2018 8:18 pm
by freddy
There is some command to spawn a bot, forgot the exact command but something like ai.spawnbot "value" "value" "value" (team, name, class i think)

But if you only want to change the bot name once and for all you can use this method directly in your map.

Code: Select all

game.addFirstNameOnTeam 1 -BOT-
game.addSecondNameOnTeam 1 SUM_DUM_FUK
game.addSecondNameOnTeam 1 SUK_MI_WONG
game.addSecondNameOnTeam 1 NEEPO_ZEEPO
game.addSecondNameOnTeam 1 BOOZE_LEE
game.addSecondNameOnTeam 1 YAMA_MORAN
game.addSecondNameOnTeam 1 SUKEE_FUKEE
game.addSecondNameOnTeam 1 MEE_WON_NOOB

Re: Renaming bots? (In the debugger)

Posted: Fri Jun 08, 2018 10:24 pm
by russ
BTW, what is "the debugger"?

Re: Renaming bots? (In the debugger)

Posted: Sat Jun 09, 2018 12:36 am
by Skull Kid
russ wrote:BTW, what is "the debugger"?
It is an exe called "BF1942_r" as far as I know.

EDIT: Now I am facing a new problem, how I remove bots.

Re: Renaming bots? (In the debugger)

Posted: Sat Jun 09, 2018 8:36 am
by russ
Can you be more specific on the removing? What goal are you trying to accomplish? I don't think removing bots from a running round is possible. The only way I've seen it happening is when a bot dies, a check is made to see if the number of players is greater than the max number of players. If so, and the bot is on the team with more players, the bot is removed. You might be able to script this into happening, but it'd be very racey.

Bots can be deactivated, but I'm not sure what that state means.

Re: Renaming bots? (In the debugger)

Posted: Sat Jun 09, 2018 8:54 am
by Skull Kid
Well... my goal was to spawn an enemy bot on a local server that would battle against me, with me deciding the kit, and the name.

Re: Renaming bots? (In the debugger)

Posted: Sat Jun 09, 2018 5:26 pm
by Skull Kid
This is the error I get when I type the following game.createAiPlayer "Boris Borisenkov" 2 Assault

Re: Renaming bots? (In the debugger)

Posted: Sat Jun 09, 2018 6:33 pm
by Skull Kid
Okay... I don't have a clue what I did… but now it just worked. I must have changed from Conquest to Cooperative… that was the issue then. My bad.

Re: Renaming bots? (In the debugger)

Posted: Sun Nov 20, 2022 9:46 pm
by Skull Kid
I'm actually now facing the problem that the bots will spawn alright, but they won't move.

EDIT: Solved now.

Enter in the following order in the game console (don't know if this works in the vanilla executable, but if it doesn't use the debugger):

1.

Code: Select all

game.createAIPlayer ">>Bot name here<<" >>1 or 2<<
"for Axis or Allied"

2.

Code: Select all

ai.addUnspawnedBot ">>Bot name here<<" >>1 or 2<< (1 = Axis 2 = Allied) default StandardWeights
IMPORTANT, the word "StandardWeights" MUST be entered with capital S and W, at least I think so. Also, make sure the bot count is enough for the extra bot to spawn.