There are a number of ways you could display something on the player's HUD when they touch a trigger in the level. Using Kismet only is one possible approach, but not really the best choice.
One way I would approach it would be to create a custom trigger object in UnrealScript (which you can place in the level) that fires off a function in the touching player's PlayerController class. This function would in turn fire off a function in the HUD class, which will then update the player's HUD.
You'll need to make a new class that extends Trigger (C:\UDK\UDK-2011-09\Development\Src\Engine\Classes\Trigger.uc)
Here's an example implementation:
Trigger Class
MyPlayerController should be replaced with the name of your PlayerController class.
PlayerController Class
Your PlayerController next fires off a function in the HUD. There are two ways to do this.
Version 1
In version 1, simply make a direct call to the HUD's functions with this format:
MyHUDWrapper should be replaced with the name of your HUD Wrapper class (which extends UTHUDBase)
HudMovie should be replaced with the name of the instantiated HUD, as created by the HUD Wrapper.
Version 2
In version 2, we first add a function to register the HUD in the PlayerController:
Now, you can add the function to call in your PlayerController, when the trigger is touched:
HUD Class
(Version 2 only) In your HUD class, call the function registerHUD() in the Init()/Start() function:
And finally, your HUD would have the function to do something visibly:
One way I would approach it would be to create a custom trigger object in UnrealScript (which you can place in the level) that fires off a function in the touching player's PlayerController class. This function would in turn fire off a function in the HUD class, which will then update the player's HUD.
You'll need to make a new class that extends Trigger (C:\UDK\UDK-2011-09\Development\Src\Engine\Classes\Trigger.uc)
Here's an example implementation:
Trigger Class
Code:
class MyTrigger extends Trigger placeable ClassGroup(Common); event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal) { local Pawn TouchingPawn; local MyPlayerController PC; TouchingPawn = Pawn(Other); PC = MyPlayerController(TouchingPawn.Controller); `log(Self$" was touched!"); `log("Touched by: " @ Other); // logs the pawn that touched it `log(Other @ " is possessed by: " @ PC); // logs the player controller that possesses the pawn. PC.TriggerTouched(); // this executes the TriggerTouched() function in the PlayerController class. }
PlayerController Class
Your PlayerController next fires off a function in the HUD. There are two ways to do this.
Version 1
In version 1, simply make a direct call to the HUD's functions with this format:
Code:
function TriggerTouched() { MyHUDWrapper(myHUD).HudMovie.DoSomething(); }
HudMovie should be replaced with the name of the instantiated HUD, as created by the HUD Wrapper.
Version 2
In version 2, we first add a function to register the HUD in the PlayerController:
Code:
var MyHudClass MyHud; function registerHUD(MyHudClass hud) { RegisteredHud = hud; }
Code:
function TriggerTouched() { RegisteredHud.DoSomething(); }
HUD Class
(Version 2 only) In your HUD class, call the function registerHUD() in the Init()/Start() function:
Code:
var MyPlayerController PC; PC = MyPlayerController(GetPC()); PC.registerHUD(self);
Code:
function DoSomething() { \\ do something in the HUD... }
Comment