mirror of
https://github.com/ineedbots/iw3_bot_warfare.git
synced 2025-05-10 22:24:52 +00:00
Added custom bot names
This commit is contained in:
parent
d18a4e6ffd
commit
557bdfefd1
5
.gitignore
vendored
5
.gitignore
vendored
@ -13,3 +13,8 @@
|
|||||||
!/main_shared/maps/mp/gametypes/_callbacksetup.gsx
|
!/main_shared/maps/mp/gametypes/_callbacksetup.gsx
|
||||||
main_shared/maps/mp/gametypes/_globallogic.gsx
|
main_shared/maps/mp/gametypes/_globallogic.gsx
|
||||||
main_shared/maps/mp/gametypes/_hardpoints.gsx
|
main_shared/maps/mp/gametypes/_hardpoints.gsx
|
||||||
|
|
||||||
|
!/main/
|
||||||
|
/main/*
|
||||||
|
!/main/botnames.txt
|
||||||
|
!/main/waypoints/
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
a
|
|
||||||
b
|
|
||||||
c
|
|
||||||
d
|
|
||||||
e
|
|
||||||
f
|
|
26
main/botnames.txt
Normal file
26
main/botnames.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
bota
|
||||||
|
botb
|
||||||
|
botc
|
||||||
|
botd
|
||||||
|
bote
|
||||||
|
botf
|
||||||
|
botg
|
||||||
|
both
|
||||||
|
boti
|
||||||
|
botj
|
||||||
|
botk
|
||||||
|
botl
|
||||||
|
botm
|
||||||
|
botn
|
||||||
|
boto
|
||||||
|
botp
|
||||||
|
botq
|
||||||
|
botr
|
||||||
|
bots
|
||||||
|
bott
|
||||||
|
botu
|
||||||
|
botv
|
||||||
|
botw
|
||||||
|
botx
|
||||||
|
boty
|
||||||
|
botz
|
@ -315,7 +315,14 @@ connected()
|
|||||||
*/
|
*/
|
||||||
add_bot()
|
add_bot()
|
||||||
{
|
{
|
||||||
bot = addtestclient();
|
name = getABotName();
|
||||||
|
|
||||||
|
bot = undefined;
|
||||||
|
|
||||||
|
if (isDefined(name) && name.size >= 3)
|
||||||
|
bot = addtestclient(name);
|
||||||
|
else
|
||||||
|
bot = addtestclient();
|
||||||
|
|
||||||
if (isdefined(bot))
|
if (isdefined(bot))
|
||||||
{
|
{
|
||||||
|
@ -652,6 +652,40 @@ parseTokensIntoWaypoint(tokens)
|
|||||||
return waypoint;
|
return waypoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getABotName()
|
||||||
|
{
|
||||||
|
if (!isDefined(level.bot_names))
|
||||||
|
{
|
||||||
|
level.bot_names = [];
|
||||||
|
level.bot_name_cursor = 0;
|
||||||
|
|
||||||
|
filename = "botnames.txt";
|
||||||
|
|
||||||
|
if (FS_TestFile(filename))
|
||||||
|
{
|
||||||
|
f = FS_FOpen(filename, "read");
|
||||||
|
|
||||||
|
name = FS_ReadLine(f);
|
||||||
|
while (isDefined(name) && name != "")
|
||||||
|
{
|
||||||
|
level.bot_names[level.bot_names.size] = name;
|
||||||
|
|
||||||
|
name = FS_ReadLine(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
FS_FClose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!level.bot_names.size)
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
name = level.bot_names[level.bot_name_cursor % level.bot_names.size];
|
||||||
|
level.bot_name_cursor++;
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
readWpsFromFile(mapname)
|
readWpsFromFile(mapname)
|
||||||
{
|
{
|
||||||
waypoints = [];
|
waypoints = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user