Page 1 of 1

Change Bots Names

Posted: Thu Aug 28, 2003 3:01 pm
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?

Posted: Thu Aug 28, 2003 4:45 pm
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

Posted: Thu Aug 28, 2003 6:22 pm
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.

Posted: Thu Aug 28, 2003 10:29 pm
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 ;)

Posted: Fri Aug 29, 2003 12:54 am
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?

Posted: Sat Aug 30, 2003 6:39 am
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

Posted: Sat Aug 30, 2003 2:43 pm
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