PDA

View Full Version : some questions about addtestclient() in COD1



lobolmart
29th March 2016, 09:46
hello,

i'm experimenting with COD1 1.4 / COD1:UO 1.51 and the Meatbot v0.2 sources. i've noticed that it's not possible to modify cvars on the test clients (i.e. references obtained via addtestclient()).

for instance the following doesn't work:


// called each time a player spawns
spawnPlayer()
{
// snip
// ... some code here
self thread _TestCommands();
}

_TestCommands()
{
self endon("death");
self endon("disconnect");
self endon("spectate");

self setClientCVar("name", "RandomName" + randomInt(99));

wait 4;
while (1) {
wait 0.5;
self setClientCVar("cl_run", "0"); // ADS
}
}


the above example shows that when a client spawns in the game he is forced in "ADS" (aim down the sight) mode and is given a random name. it works for human players, but not for the bots.

is there a way to set such things for the test clients?
if you don't have the answer, do you know where i can ask the questions that i have?
(the meabot author isn't responding).

cheers

IzNoGoD
29th March 2016, 10:23
For cod2+libcod, theres a renamebot() function. Make something similar for cod1.

I know filthyfreak is using some movement-modifying code for his bots, which sets certain movement bits every client frame

Mitch
29th March 2016, 10:49
For cod2+libcod, theres a renamebot() function. Make something similar for cod1.


Renamebot was renamed to renameclient, because it could be used on players too.
See gsc_player_renameclient in:
https://github.com/kungfooman/libcod/blob/master/gsc_player.cpp

lobolmart
29th March 2016, 11:21
thanks for the responses,

changing the names is a nice-to-have. the ADS is the bigger issue here, since without it the bots are quite useless at aiming. the question is why can't we set cvars for the addtestclient()'s.

i have checked libcod, but i'm on windows. i see that it targets linux binaries and quickly browsing the source reveals dlfcn.h, which is the POSIX way of doing address space mapping.

i'm getting the notion that it's probably not possible to modify the ADS state of the test clients in COD1 via the bundled / exposed GSC API, so i may have to do something similar to what libcod is doing...or i should probably setup a linux server, but then most of the users would not be able to setup the bots locally - i.e. in the lines of "just download and unzip to play".

IzNoGoD
29th March 2016, 11:53
try codextended.

lobolmart
29th March 2016, 13:24
alright, thanks.
i was able to build the 1.5 version of coextended, which is a promising start.

but i may give up due to the involvement of back-porting to 1.4.