| Home Page | Recent Changes | Preferences

# Interaction

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 mutator]?s, 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

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

- Creating An Interaction From A Mutator,
- Creating An Interaction From A PlayerController,
- Creating An Interaction From A HUD

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

- HUD Interactions
- Keypress Interactions
- Message Interactions

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

## Properties

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

## Methods

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

### Native Functions

Initialize ( )
  Setup the state system and stack frame. Called automatically upon creation.
bool ConsoleCommand (coerce string S)
  Executes a console command.
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 Vector that you trace along to hit something in the world.

### Other Functions

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

- Console
- BaseGUIController

## Discussion

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.

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In