Always snap to grid

Legacy:Creating An Interaction From A HUD

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 15:53, 25 January 2004 by Cache3-winn.server.ntli.net (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.