Legacy:Creating An Interaction From A HUD - Unreal Wiki

# Legacy:Creating An Interaction From A HUD

### From Unreal Wiki, The Unreal Engine Documentation Site

Creating an Interaction from a HUD class is probably one of the easiest things you could do.

Just edit your PostBeginPlay() Function.

    simulated function PostBeginPlay()
    {
          Super.PostBeginPlay();
          PlayerOwner.Player.InteractionMaster.AddInteraction("MyMod.MyInteraction", PlayerOwner.Player);
    }

... done. Simple eh?

Interactions can do a whole load of stuff though, so choose a section relating to what you want to do:

HUD Interactions

Keypress Interactions

Message Interactions

the_viking: I think this code is for UT. If you want to use it with UT2003, I think you have to do it so:

    simulated function PostBeginPlay()
    {
        local PlayerController PC;
        PC = PlayerController(Owner);
        PC.Player.InteractionMaster.AddInteraction("MyMod.MyInteraction", PC.Player));
        Super.PostBeginPlay();
    }

Wormbo: There are no Interactions in UT, the above code should work perfectly.

Andrew: Neither of these seem to work for online play. It's because the Player hasn't been assigned to the

playercontroller by the time this gets done. Instead the interaction should be added in somewhere like tick:

    simulated function Tick(float delatTime)
    {
    if (PlayerOwner != None && PlayerOwner.Player != None && PlayerOwner.Player.InteractionMaster != None)
    {
    PlayerOwner.Player.InteractionMaster.AddInteraction("UBSSfowl.TargetReticleInteraction", PlayerOwner.Player);
    disable('Tick');
    }
    }

This might not actually work because it might interfere with things already being done in tick but you get the idea.

##### Views

- Legacy
- Discussion
- Current revision

##### Search