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?
Change Bots Names
Moderator: Moderators
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:
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
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Thanks, jv.
Se if I got:
Hmm..I need the "add your stuff here" part...I'm lost.
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.nameHmm..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:
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.nameThis 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
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
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?
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?
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
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
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
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
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

