|
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
|
help - radio emulation -
19-10-2005
hi,
amxmod x , bots stuff.
i was trying to emulate those radio commands like 'taking fire', etc.
i've written messages to BotVoice, SendAudio, TextMsg to 'throw' the parameters, and i managed to make the radio messages sound and display correctly, so it really looks like the "real" radio messages.
but bots won't understand them. (neither csbots nor podbots)
so i wonder if there's another variable must be set. maybe it would work for both bots...???
|
|
|
|
|
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 -
19-10-2005
The bots needs to know the entity sending the message. What is your message sender edict_t * pointing to ?
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 -
19-10-2005
I’m actually not sendind the edict information directly.
The pev list is too big, I can’t guess which is the one for the sender, or I don’t know if it’s implicitly passed by the messages. So here’s a sample code:
Code:
public Radio(id)
{
// BotVoice =135
// SendAudio = 100
// TextMsg = 77
server_print (g_playerLocation[id])
message_begin (MSG_ALL,135) // I don’t know if it should be MSG_ALL…
write_byte (1) // start radio message
write_byte (id) //user id
message_end ()
set_task (3,"clearMsg",id) //delay before clear msg
message_begin(MSG_ALL,100)
write_byte (id) // player id
write_string ("%!MRAD_HITASSIST") // sample taking fire
write_short (100) //voice pitch
message_end ()
new sid[3] // sender id to String
new uname[32] // sender name
format (sid,2,"%d",id)
get_user_name (id,uname,31)
message_begin( MSG_ALL,77)
write_byte (5) // i don't know why "5", i guess it's the message type
write_string (sid) // sender id string, i guess
write_string ("#Game_radio_location")
write_string (uname) //sender name
/* g_playerLocation is a global array that
contains the current user location
and is updated by "Location" event
*/
write_string (g_playerLocation[id])
write_string ("#Taking_fire") //sample taking fire
message_end ()
}
public clearMsg(id){
message_begin(MSG_ALL, 135)
write_byte(0)
write_byte(id)
message_end()
}
Thanks.
|
|
|
|
|
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 -
21-10-2005
Oh, stupid me... you're talking about AMX scripting, not C++ code...
Sorry I can't really help. Perhaps people like KWo or others with a good bit of knowledge in AMX scripting can.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
|
|
|
|
|
Developer of PODBot mm
Status: Offline
Posts: 3,425
Join Date: Apr 2004
|
Re: help - radio emulation -
22-10-2005
To help him, I really need two know a lot of things:
1. How do bot percept my radio command, when I use "Follow me" for example - I need to know what is the most important thing the bots need to receive to intercept is a radio message.
2. Write_byte, write_string, message_begin etc - I believe they are some HL SDK functions used directly from sma scripts without necessity converting them to any C++ HL functions - so any bot coder should be able to say anything more tahn me about them (I don't know HL SDK). I will ask some AMX or AMX X developer if it's true. I used such commands sequence to clear-up buy icon - to prevent people buying any stuff. But for some reason it was not working for bots (for human players it's working great) - probably it's because of metamod preventing to send some messages to bots.
3. Need more knowledge about metamod - what is allowed , what is blocked etc. What is possible to send to another mm plugin - what is not.
I think only Pierre with cooperation with Bailopan (AMX MOD X dev team, metamod maintainer) and T(+)rget (AMX dev team) can really help You. I will ask them to say us something more.
|
|
|
|
|
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 -
23-10-2005
As for point #2, so far the main difference that I saw (but perhaps I haven't seen enough) between AMX scripts and C code is that in AMX scripts, they seem to never use the "edict" type, which is the fundamental entity type we use in HL. Don't know how they manage to do without... and I don't really want to know
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: 5
Join Date: Aug 2004
Location: RI
|
Re: help - radio emulation -
23-10-2005
Edicts are passed around by their entity index. AMX Mod X has the entity_[get|set]_[type] functions for pulling things out of the entvars struct.
Of course, player indices are themselves edict indices, so your statement didn't make much sense.
They don't pass around an edict type because Small is type-generic (it only has one data type, which is integral). That is why it uses entity indices.
|
|
|
|
|
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 -
24-10-2005
I thought Small was a weak-typed language ?
Anyway, like I said, I don't know the AMX Mod X way of doing things at all, but provided there is a possibility to send and hook the same messages than in native code, it should be possible to send "fake" radio messages, and bots should be able to interpret them.
But like I said too, for the bots to interpret them correctly, they need to know the sender of the message, and the sender of the message must be a valid player edict. That's all
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 -
26-10-2005
Which one is the most relevant message event for the radio? (I mean, the one that bots would interpret as someone sending radio message.)
SendAudio? TextMsg? Both?
I don’t know if it has something to do with that - I’m able to send those amx ‘fake messages’ when I’m dead, so maybe they’re not reliable enough for the bots…
Thank you.
Ps.
Just made a test and verified that the radio messages are displayed to both teams (terrorists and cts). I’ve seen no way to limit the message scope except by the destinations constants, but I don’t know how to use it.
Here’s the list from amxmod manual.
Quote:
MSG_BROADCAST 0 //Unreliable message to everyone
MSG_ONE 1 //Reliable message to one client
MSG_ALL 2 //Reliable message to everyone
MSG_INIT 3 //Write to the init string
MSG_PVS 4 //Ents in PVS of origin
MSG_PAS 5 //Ents in PAS of origin
MSG_PVS_R 6 //Reliable to PVS
MSG_PAS_R 7 //Reliable to PAS
MSG_ONE_UNRELIABLE 8 //Unreliable to one client
MSG_SPEC 9 //Send to spectator proxies
|
I’ll be trying them…
Last edited by commonbullet; 26-10-2005 at 04:54..
Reason: more info
|
|
|
|
|
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 -
26-10-2005
No, it has nothing to do with the message scopes. Looping through all the clients and sending a MSG_ONE_UNRELIABLE to those you want to receive the radio message is the only and right way to do.
The messages most bots hook when it comes to radio messages are TextMsg. The discriminative is a string, usually starting with "#". Look in some bot source code (for example, POD-bot mm) to see what are the audio message strings that can be used.
edit: alternative method. Use PMTools to log in a text file (or just to display on the screen) what are the network messages that are sent when you fire a radio message yourself.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
Last edited by Pierre-Marie Baty; 26-10-2005 at 05:02..
|
|
|
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
|
|