Renaming bots? (In the debugger)

Ask questions, discuss ideas, get answers
Post Reply
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Renaming bots? (In the debugger)

Post 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.".
Last edited by Skull Kid on Sat Jun 09, 2018 6:34 pm, edited 1 time in total.
Regards,

Skull Kid
russ
Posts: 73
Joined: Sun Oct 29, 2017 8:12 am

Re: Renaming bots? (In the debugger)

Post 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
freddy
Posts: 1258
Joined: Sun Oct 18, 2009 4:58 pm

Re: Renaming bots? (In the debugger)

Post 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
russ
Posts: 73
Joined: Sun Oct 29, 2017 8:12 am

Re: Renaming bots? (In the debugger)

Post by russ »

BTW, what is "the debugger"?
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Renaming bots? (In the debugger)

Post 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.
Regards,

Skull Kid
russ
Posts: 73
Joined: Sun Oct 29, 2017 8:12 am

Re: Renaming bots? (In the debugger)

Post 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.
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Renaming bots? (In the debugger)

Post 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.
Regards,

Skull Kid
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Renaming bots? (In the debugger)

Post by Skull Kid »

This is the error I get when I type the following game.createAiPlayer "Boris Borisenkov" 2 Assault
Attachments
2018-06-09.png
2018-06-09.png (6.73 KiB) Viewed 12465 times
Regards,

Skull Kid
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Renaming bots? (In the debugger)

Post 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.
Regards,

Skull Kid
Skull Kid
Posts: 165
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Renaming bots? (In the debugger)

Post 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.
Regards,

Skull Kid
Post Reply