Coding Help

Artimos Penguidor

New Member
hey i am doing a bit of coding and i need to know where i can find the bit of code that as to do with the display of the flag messages like "Blank has grabbed the flag". and the other thing i need to know is where the code about where is assigns the little flag symbol above the persons character when the person has the flag. :)
 
I haven't yet checked the part about the icon, but for the flag grab, you'll want to create callback functions for the appropriate message. For example, look in message.cs.
If you're writing it from scratch, it's a good idea to do somehing like this:
Code:
addMessageCallback("MsgPlayerKilled", AWhandleMsgPlayerKilled);
            function AWhandleMsgPlayerKilled( %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13 )
            {

                        ...blabla

            }

the function name can be whatever you like, so long as it's the same in both the name and the callback. the message type (in this case "MsgPlayerKilled") can be figured out by looking at message.cs or by looking at the console when this kind of event happens in game.

You'll find that most of the time not all those variables are needed. If you're unsure as to which ones you need, use This.
To use, download and put it in your autoexec folder. Open it, remove the comment slashes on the callback function, and change insertMsgType to what you're trying to test.

//addMessageCallback("insertMsgType", EchoList);

once you're done, just put the comment lines on the callback back in, that way you can leave it in your game files.

To use this file, you then open the game, and make whatever event you want to happen, Happen. Look in the console, and you'll find it will have listed all the variables that get sent with it.
A certain number will be blank. Those you can remove from your function. (0 does not mean blank). Make sure you do not remove any that are listed Before the variable you wish to use. (i.e. if the only variable you want to use is %a3, don't just make a function like
Code:
function AWhandleMsgPlayerKilled(%a3)
as this will actually use the %msgType variable, which is sent first.
if you only want to use %a3, then you want to send something more like:
Code:
function AWhandleMsgPlayerKilled(%msgType, %msgString, %a1, %a2, %a3)
You can use whatever name you like for the arguments here, as it looks merely at their location in the callback, not their names (so long as you properly reference them below).

(P.S. while i'm sure I went into more detail than you required, this is just a little helper for anyone else who has a question in this regard)
 
Top