Change Bots Names

Please use this forum to ask all your MoHAA Bots questions / discussions

Moderator: Moderators

Post Reply
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Change Bots Names

Post by Krane »

I was wondering if it's possible to change (define) the bots names thru script, like setcvar...so you can spawn bots with the names previously in script...

Is that possible?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yeah you can. If you're spawning bots via the console commands you can simply use jvbot_addbot_name to set the name of the next bot spawned.

Otherwise, you can simply modify lib_names.scr to use any name you like or you can even use the jvbot_lib_names cvar to make the bot script use a custom name script, which should have the following layout:

Code: Select all

setup:
   // no setup, but need this thread to prevent errors
end

shutdown:
   // no shutdown
end

getname:   
   // add your stuff here :D, make it set a local.name
end local.name
Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Thanks, jv.

Se if I got:

Code: Select all

setup:
end
shutdown:
end
getname:
set cvar jvbot_lib_names "Cap. Doe" or set cvar jvbot_lib_names_id 1??
local.name = "Cap Doe"???????
end local.name


Hmm..I need the "add your stuff here" part...I'm lost.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Code: Select all

setup:
   level.my_own_bot_names = "Noname"::"Jane Doe"::"Doe-Nut"::"Freak"
end

shutdown:
   // no shutdown
end

getname:
   local.index = randomint(level.my_own_bot_names.size)
   local.name = level.my_own_bot_names[local.index]
end local.name


This will return a random name from the array created in the setup method.
Just add names separated by 2 ':' to bet a larger name-base.

Correct me if I f**ked it up again jv ;)
Admin .MAP Forums
Image
Head above heels.
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Thanks Bjarne BZR.

Let me see...:

This code is a whatever.scr file (notepad), right?

And, in my script, I add the line:

setcvar jvbot_lib_names whatever.scr

or

setcvar jvbot_lib_names "whatever.scr"

so the jvbot_lib_names will look for my whatever.scr instead of looking for jv's lib_names.scr....IS that correct?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes, but you have to put it in the global/jv_bots folder.

Instead of setcvar you can also simply do level.jvbot_libnames = whatever.scr

You need to do either trick before enableing the bots.

Note to Bjarne:
local.index = randomint(level.my_own_bot_names.size)

should be
local.index = randomint level.my_own_bot_names.size + 1
Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Cool...

Yeah, I'm using

setcvar "jvbot_lib_names" "whatever"

without the .scr termination. I'll try level.jvbot_libnames = whatever.scr

It's working good. The only thing is that, if you start another map, the names seems to remain. I had to reload the game to get rid of the names. Probably cauz it sets on the server, dunno...But it's fine for me. Thanks
Post Reply