![]() |
Beginner question: Getting bots to spawn
Hi everyone,
I'm attempting to write a metamod CounterStrike bot "from scratch" (but using HPB as a reference) for Steam CS 1.6, but I'm having some trouble getting it to actually appear in world. My bot connects to the server just fine (in an almost indentical manner to HPB), but I never actually see it. I'm assuming this is because the bot is stuck at a team/model/... selection menu (does this sound right?), but the code I wrote to handle those messages never seems to get called. I'm overriding pfnMessageBegin and, since my menu selections didn't seem to be happening properly, just logged the message ids that were sent to my bot when it was created. I got the following IDs: 111 84 98 101 Interestingly, 84 seems to be sent more times for each additional bot I add to the world: the first bot gets it once, the second twice, etc. I know that there were some weirdnesses introduced by the move to steam, but can someone clarify what might be going on here, and maybe offer some advice on how to get my bots to appear? Thanks a lot for the help! -JB |
Re: Beginner question: Getting bots to spawn
Don't use the message IDs like botman does in the HPB_bot: metamod provides very handy facilities to handle network messages by name :
GET_USER_MSG_ID (PLID, "MessageName", NULL) will return the ID for the message MessageName, and GET_USER_MSG_NAME (PLID, id, NULL) will return the name in all letters for a particular message id. :) Here's a typical metamod pfnMessageBegin function: Code:
if (mod_id == VALVE_DLL) |
Re: Beginner question: Getting bots to spawn
Thanks for the reply Pierre-Marie. I'm actually basing my code on the metamod port of the HPB bot, so I'm already doing something almost identical to the code you posted here. I didn't know about GET_USER_MSG_NAME(..) though, which is very useful!
I tried printing the actual names of the messages being sent when I add my bot, and got the following: NVGToggle ScoreAttrib ScreenFade RoundTime ... still no VGUI. Does this look like what you'd expect for a newly added bot that has no menu-handling capabilities? Where are the menu messages? Help! -JB |
Re: Beginner question: Getting bots to spawn
Could you post your pfnMessageBegin function here ?
|
Re: Beginner question: Getting bots to spawn
Sure, here it is:
Code:
void pfnMessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { Thanks again. -JB |
Re: Beginner question: Getting bots to spawn
Oops, one more question: is there a comprehensive list of the message strings that can be sent in counterstrike?
-JB |
Re: Beginner question: Getting bots to spawn
All network messages are registered by the game DLL to the engine when the game starts. The function to catch to get a list of the registered network messages if pfnRegUserMsg.
Here's a list of network messages in CS 1.5 (I keep them in a config file for my bot): Code:
# RACC - Engine messages configuration file instead of doing if (ed), try doing if (!FNullEnt (ed))... but it should work nonetheless... |
Re: Beginner question: Getting bots to spawn
Thanks for the list. Any ideas on why my bot isn't actually getting any VGUI messages? I added a LOG_CONSOLE statement to the HPB bot, and noticed that it seems to be getting many more messages (and more appropriate ones like VGUI as well) than mine do. I know it's tough to debug based on so little info, but if you have any ideas I'd love to hear them. What should happen after my bot has connected to the server?
|
Re: Beginner question: Getting bots to spawn
with this line
Code:
LOG_CONSOLE(PLID, "Message \"%s\"sent to ID %d.", GET_USER_MSG_NAME(PLID, msg_type, NULL), msg_dest); |
All times are GMT +2. The time now is 17:13. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.