Mostly Harmless


From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 :: Object >> Interactions >> Interaction

Interactions are new to UT2003, and can do a whole lot of stuff. They can perform PostRenders and PreRenders, Intercept key input, and intercept string messages. They can be viewed as a much more advanced replacement for UT's HUD mutators, but with lots of additional functionality. Interactions can use states like Actors after they have been initialized.

Interactions take on two forms, the Global Interaction and the Local Interaction. The GI get to process data before the LI and get render time after the LI, so in essence the GI wraps the LI.

A dynamic array of GIs is stored in the InteractionMaster while each Viewport contains an array of LIs.

Using Interactions[edit]

Depending on which method you wish to use to create an interaction, you need to read one of:

Have the mutator, but just want to know how to make an interaction? Choose a section relating to what you want to do:

While you're at it, you may as well read Problems_With_Interactions. You'll probably need to sooner or later anyway.


bool bActive 
Is this interaction getting input?
bool bVisible 
Is this interaction being displayed?
bool bRequiresTick 
Does this interaction require game TICK?
bool bNativeEvents 
This interaction requests native key events.

These entries get filled out upon creation.

Player ViewportOwner 
Pointer to the ViewPort that "Owns" this interaction or none if it's Global
InteractionMaster Master 
Pointer to the Interaction Master


All functions in the Interaction class (including native ones) are non-final.

= Native Functions[edit]

Initialize ( ) 
Setup the state system and stack frame. Called automatically upon creation.
bool ConsoleCommand (coerce string S) 
Executes a console command. Returns false if the command could not be executed.
vector WorldToScreen (vector Location, optional vector CameraLocation, optional rotator CameraRotation) 
Converts a vector in the world. Returns the X/Y screen coordinates in to a viewport of a given vector in the world.
vector ScreenToWorld(vector Location, optional vector CameraLocation, optional rotator CameraRotation) 
The X/Y components of Location are set to screen X/Y. The return value is a normalized Vector that you trace along to hit something in the world.

Other Functions[edit]

Initialized ( ) 
Called directly after an Interaction Object has been created and Initialized. Should be subclassed.
NotifyLevelChange ( ) 
Build 2164 and later. Called upon level changed. Use this to remove the Interaction to prevent the "Incompatible Game Files" message. (In earlier builds this message was know and feared as "Corrupted Connection detected".)
Message (coerce string Msg, float MsgLife) 
This event allows interactions to receive messages.
bool KeyType (out EInputKey Key, optional string Unicode)
bool KeyEvent (out EInputKey Key, out EInputAction Action, float Delta) 
These two routines are the entry points for input. They both return true if the data has been processed and should now be discarded. Both functions should be handled in a subclass of Interaction. The enums EInputKey and EInputAction are declared in the superclass.
PreRender (Canvas Canvas) 
Called right after the level is rendered but before the HUD, 1st person weapon, etc. are drawn.
PostRender(Canvas Canvas) 
Called after the HUD is drawn.
SetFocus ( ) 
This function cases the Interaction to gain "focus" in the interaction system. Global interactions's focus superceed locals.
Tick (float DeltaTime) 
By default, Interactions do not get ticked, but you can simply turn on bRequiresTick.
NotifyMusicChange ( ) 
Build 2164 and later.

Known Subclasses[edit]


DJPaul: As i've done in bold above, we need to be sure to specify the correct, and show differences, between Interaction and Interactions.

Wormbo: I think this is pretty clear when looking at the class tree. You don't write Trigger(s), do you?

Balu: The first section tells me that Interactions can do a lot of stuff and what they use,... But I still have no idea what they are used for or what they are.

Dyselon There's probably an easy answer to this, and I'm sure I'll feel stupid when I hear it, but what's the easy way to pass a value from a mutator to an interaction. Say there's a mutator that keeps track of the total number of foos that have been collected on a level, and I want to display that to the hud via an interaction... Where would I store that value, and how would I access it?

Mychaeel: You would keep a reference to your Mutator in the Interaction when you create it and then directly read those values from your Mutator object.

Melaneus: I don't think SetFocus() works. It looks like it ends up altering the local array of interactions it created instead of altering the real array of interactions that the player uses.

Fey: I agree with Balu. Someone just recomeded I look here for help on how to do a mod I'm working on, but I don't really understand what these do. From this page, Interactions look very limited, and not a bit helpful unless you want to update a HUD. I'll keep working with them see if I can work it out.