Cogito, ergo sum

Legacy:Message Interactions

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Message mutators pick up all messages that are displayed on screen: Who killed who, who picked up the flag, who took the ball in bombing run, etc. What it will NOT pick up on though, is when you use the SAY command or the TeamSay command.

I suppose a reporter bot could be made using one of these.

First off, you need to make your mutator class that will create your interaction. See Creating An Interaction From A Mutator for this.

Done that? Good...

So thats the mutator part done. Next is the easy part! :)

A simple interaction:

Class MyInteraction extends Interaction;
 
Function Initialize()
{
    Log("Interaction Initialized");
}

Dont forget to add

bActive=True

Under defaultproperties (else this interaction wont do anything).

Now, how to pick up the messages? Add this function:

function Message( coerce string Msg, float MsgLife)
{
//Do stuff here
}

"Msg", as you could guess, is the message itself. MsgLife is how long it is diplayed on screen for.

That is all there is to it.

If you wanted to log everything that appeared on screen, your Interaction class would look like this:

Class MyInteraction extends Interaction;
 
Function Initialize()
{
    Log("Interaction Initialized");
}
 
function Message( coerce string Msg, float MsgLife)
{
    Log("Message:" @ Msg);
}
 
DefaultProperties
{
bActive=True
}

Thats it. :)


Will: Any problems understanding this? Anything I could do to make it clearer? If so: tell me, or do it yourself ;)

Daid: Is it possible to change the message with this code?

Will: Afraid not. All it allows you to do is see the messages, log them, whatever. It's a very basic function, and rather crap.

Tyoma: So message mutators are dead?

Wormbo: Yes, they are. The only class that is still allowed to modify messages is the BroadcastHandler which is spawned as a per-GameInfo actor.

Bob242: So if I wanted to make a reporter mutator for every type of message, including say and teamsay commands, it would have to be client-side, right?

Wormbo: No, in UT2004 you can subclass BroadcastHandler and register it. See your UnrealScript source files for details. (Someone should update the BroadcastHandler page with the UT2004 features...)

Bob242: Well, I'm working on writing a simple mutator for a game using the same Engine as UT2003. So I would be kind of stuck in this regard, correct? The best I can think of is to make a server side mutator that uses an interaction that reads all of the messages placed in the HUD... Sorry, I'm kind of new to UScript. Does this sound plausible? I'm trying to read everything that goes into all clients' consoles.