|
Game Scripting (AMX, Small, etc.) Where game engines and interpreters allow you to mess under the hood
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
26-10-2005
ok,
the messages scope is correct now, by looping the MSG_ONE_UNRELIABLE.
You're right, I'll try checking podbot source.
Also, csbots answers to podbot radio messages...
thanks.
|
|
|
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
26-10-2005
maybe I'm wrong, but I guess podbots fake the radio-menus instead of writing the radio messages. From bot.cpp:
Code:
if (pBot->iRadioSelect < 10)
FakeClientCommand (pBot->pEdict, "radio1;menuselect %d\n", pBot->iRadioSelect);
else if (pBot->iRadioSelect < 20)
FakeClientCommand (pBot->pEdict, "radio2;menuselect %d\n", pBot->iRadioSelect - 10);
else
FakeClientCommand (pBot->pEdict, "radio3;menuselect %d\n", pBot->iRadioSelect - 20);
I guess it would work in amx, but i was trying to make the messages more customizable (sounds, etc).
I'd forgotten the other part: podbots don't answer to csbots.
Last edited by commonbullet; 26-10-2005 at 07:32..
|
|
|
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
26-10-2005
Now trying to find how bots read users radio messages.
This is from dll.cpp.
I need a help to read this - I guess it's also checking the selected item from the radio-menu of the sender.
Code:
// Check Radio Commands (fix): do it here since metamod won't call our own ClientCommand()
iClientIndex = ENTINDEX (pFakeClient) - 1;
if (clients[iClientIndex].IsAlive && (iRadioSelect[iClientIndex] != 0) && (strncmp (g_argv, "menuselect", 10) == 0))
{
iRadioCommand = atoi (g_argv + 11);
if (iRadioCommand != 0)
{
iRadioCommand += 10 * (iRadioSelect[iClientIndex] - 1);
if ((iRadioCommand != RADIO_AFFIRMATIVE)
&& (iRadioCommand != RADIO_NEGATIVE)
&& (iRadioCommand != RADIO_REPORTINGIN))
{
for (i = 0; i < gpGlobals->maxClients; i++)
{
if (bots[i].is_used && (bots[i].bot_team == clients[iClientIndex].iTeam)
&& (pFakeClient != bots[i].pEdict))
{
if (bots[i].iRadioOrder == 0)
{
bots[i].iRadioOrder = iRadioCommand;
bots[i].pRadioEntity = pFakeClient;
}
}
}
}
g_rgfLastRadioTime[clients[iClientIndex].iTeam - 1] = gpGlobals->time;
}
iRadioSelect[iClientIndex] = 0;
}
else if (strncmp (g_argv, "radio", 5) == 0)
iRadioSelect[iClientIndex] = atoi (g_argv + 5);
// End Radio Commands
|
|
|
|
|
Roi de France
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
|
Re: help - radio emulation -
27-10-2005
You're looking in the wrong place. Don't look at how the bots send radio messages, look at how the bots CATCH radio messages. It's in bot_client.cpp, where all of the network message hooking is done.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
|
|
|
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
29-10-2005
sorry, I've tried that but my poor c++ knowledge is not enough for finding it inside bot_client.cpp.
I'll keep up trying and I'll tell you if I make some progress.
Thanks.
|
|
|
|
|
Developer of PODBot mm
Status: Offline
Posts: 3,425
Join Date: Apr 2004
|
Re: help - radio emulation -
29-10-2005
Well - I'm not a C++ coder, but try to look into bot.cpp and find this function
void BotCheckMessageQueue (bot_t *pBot)
but You need to find also the function BotGetMessageQueue (it exists in the same file) to understand the first one. Hope it help You.
|
|
|
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
02-11-2005
Thank you.
I couldn't get bots to work with it yet, but I'm still trying.
btw, I've written this very stupid plugin while messing with those radio messages.
http://www.amxmodx.org/forums/viewtopic.php?p=177886
|
|
|
|
|
Member
Status: Offline
Posts: 49
Join Date: Nov 2004
|
Re: help - radio emulation -
02-11-2005
I was trying it with PM_tools.
There's one thrown message whenever radio is activated that I didn't handle. It's type 23, signed as "tempentity?"
I've checked and my script doesn't send such message.
I couldn't guess what are the values for.
I've added one csbot to test that and there's the result. The type of message nor the player position seems to affect this values.
Quote:
PMTOOLS (HUD): Entity #1 (commonbullet) SENDS MESSAGE type 23 ("tempentity?") in 1 ("MSG_ONE") from NULL
PMTOOLS (console): MESSAGE_BEGIN (MSG_ONE, tempentity?, NULL, Entity #1 (commonbullet))
PMTOOLS (console): WRITE_BYTE (124 [0x7c])
PMTOOLS (console): WRITE_BYTE (1 [0x1])
PMTOOLS (console): WRITE_COORD (35.00)
PMTOOLS (console): WRITE_SHORT (185)
PMTOOLS (console): WRITE_SHORT (15)
PMTOOLS (console): MESSAGE_END ()
PMTOOLS (HUD): Entity #2 (Hank) SENDS MESSAGE type 23 ("tempentity?") in 1 ("MSG_ONE") from NULL
PMTOOLS (console): MESSAGE_BEGIN (MSG_ONE, tempentity?, NULL, Entity #2 (Hank))
PMTOOLS (console): WRITE_BYTE (124 [0x7c])
PMTOOLS (console): WRITE_BYTE (1 [0x1])
PMTOOLS (console): WRITE_COORD (35.00)
PMTOOLS (console): WRITE_SHORT (185)
PMTOOLS (console): WRITE_SHORT (15)
PMTOOLS (console): MESSAGE_END ()
|
|
|
|
|
|
Roi de France
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
|
Re: help - radio emulation -
02-11-2005
lol @ the plugin
Anyway. Here's how my bots (RACC) catch radio messages in Counter-Strike. Don't be confused by the syntax, the typedefs and the variable types as this is part of an engine-independent layer.
Code:
void HLEngine_NetworkMessage_TextMsg (void)
{
// this message tells a client that his player received a radio message, to enable him to
// play the appropriate radio sound sample file.
player_t *pPlayer;
char sound_file[256];
sound_t *radio_sound;
int i;
if (!((message[0].packet_type == PACKET_STRING)
&& (strcmp (message[0].szValuePassed, "#Game_radio") == 0)))
return; // cancel if message is NOT a radio message
pPlayer = &players[message_header.player_index]; // quick access to player
// is the player receiving this message a bot AND is it a radio message ?
if (pPlayer->is_racc_bot)
{
// identify the radio sample and choose the sound file that will be played at the bot's
// first radio menu
if (strcmp ("#Cover_me", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_coverme.wav", sizeof (sound_file)); // 'Cover me' radio message
else if (strcmp ("#You_take_the_point", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/takepoint.wav", sizeof (sound_file)); // 'You take the point' radio message
else if (strcmp ("#Hold_this_position", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/position.wav", sizeof (sound_file)); // 'Hold this position' radio message
else if (strcmp ("#Regroup_team", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/regroup.wav", sizeof (sound_file)); // 'Regroup team' radio message
else if (strcmp ("#Follow_me", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/followme.wav", sizeof (sound_file)); // 'Follow me' radio message
else if (strcmp ("#Taking_fire", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/fireassis.wav", sizeof (sound_file)); // 'Taking fire, need backup' radio message
// second radio menu
else if (strcmp ("#Go_go_go", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/com_go.wav", sizeof (sound_file)); // 'Go Go Go' radio message
else if (strcmp ("#Team_fall_back", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/fallback.wav", sizeof (sound_file)); // 'Team fall back' radio message
else if (strcmp ("#Stick_together_team", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/sticktog.wav", sizeof (sound_file)); // 'Stick together team' radio message
else if (strcmp ("#Get_in_position_and_wait", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/com_getinpos.wav", sizeof (sound_file)); // 'Stay in position and wait for my go' radio message
else if (strcmp ("#Storm_the_front", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/stormfront.wav", sizeof (sound_file)); // 'Storm The Front' radio message
else if (strcmp ("#Report_in_team", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/com_reportin.wav", sizeof (sound_file)); // 'Report In' radio message
// third radio menu
else if (strcmp ("#Affirmative", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_affirm.wav", sizeof (sound_file)); // 'Affirmative' radio message
else if (strcmp ("#Enemy_spotted", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_enemys.wav", sizeof (sound_file)); // 'Enemy spotted' radio message
else if (strcmp ("#Need_backup", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_backup.wav", sizeof (sound_file)); // 'Need backup' radio message
else if (strcmp ("#Sector_clear", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/clear.wav", sizeof (sound_file)); // 'Sector clear' radio message
else if (strcmp ("#In_position", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_inpos.wav", sizeof (sound_file)); // 'I'm in position' radio message
else if (strcmp ("#Reporting_in", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ct_reportingin.wav", sizeof (sound_file)); // 'Reporting in' radio message
else if (strcmp ("#Get_out_of_there", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/blow.wav", sizeof (sound_file)); // 'Get outta here' radio message
else if (strcmp ("#Negative", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/negative.wav", sizeof (sound_file)); // 'Negative' radio message
else if (strcmp ("#Enemy_down", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/enemydown.wav", sizeof (sound_file)); // 'Negative' radio message
// client-side radio messages
// I miss "A hostage has been rescued", dunno how to catch it (if you do, lemme know)
else if (strcmp ("#Bomb_Planted", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/bombpl.wav", sizeof (sound_file)); // 'Bomb planted' radio message
else if (strcmp ("#Bomb_Defused", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/bombdef.wav", sizeof (sound_file)); // 'Bomb defused' radio message
else if (strcmp ("#Round_Draw", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/rounddraw.wav", sizeof (sound_file)); // 'Round draw' radio message
else if (strcmp ("#Terrorists_Win", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/terwin.wav", sizeof (sound_file)); // 'Terrorists win' radio message
else if (strcmp ("#CTs_Win", message[2].szValuePassed) == 0)
SAFE_strncpy (sound_file, "radio/ctwin.wav", sizeof (sound_file)); // 'Counter-terrorists win' radio message
// find the sound we want in the global list
for (i = 0; i < GameConfig.sound_count; i++)
if (strcmp (GameConfig.sounds[i].file_path, sound_file) == 0)
radio_sound = &GameConfig.sounds[i]; // link a pointer to this sound's info slot
// have we found the sound we want to play ?
if (radio_sound != NULL)
BotFeedEar (pPlayer, radio_sound, &pPlayer->pEntity->v_eyeposition, 1.0); // bot will hear this radio sound
}
return;
}
Basically all you need to remember is that when a radio message is received by a player, it's under the form of a TextMsg, the first string that is passed (text message type) is '#Game_Radio' and the message string that is passed is a short identifier for the message starting with '#'.
Hook TextMsgs, check for the presence of a Game_Radio message, and determine which type of message it is by strcmp'ing it.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Powered by vBulletin® Version 3.8.2 Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
|
|