Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel

Legacy:ScoreAwardTrigger

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 12:48, 19 November 2007 by Sweavo (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2003 :: Actor >> Triggers >> Trigger >> ScoreAwardTrigger (custom)

About[edit]

A trigger that adds points to a player's score. I got the idea from DeusEx. When you entered a secret

area you would gain skill points.

Code[edit]

/* Written by Jon Steadman */
 
class ScoreAwardTrigger extends Trigger;
 
var() int ScorePointsAdded;
var() sound TriggeredSound;
 
function PostBeginPlay()
{
   ReplaceText( Message , "%p", string( ScorePointsAdded ) );
   Super.PostBeginPlay();
}
 
simulated event TriggerEvent( Name EventName, Actor Other, Pawn EventInstigator )
{
   if( Role == ROLE_Authority && EventInstigator != None && !Level.Game.bGameEnded )
   {
      if( EventInstigator.PlayerReplicationInfo != None )
         Level.Game.ScoreObjective( EventInstigator.PlayerReplicationInfo,ScorePointsAdded );
      else if( EventInstigator.Controller != None && EventInstigator.Controller.PlayerReplicationInfo != None )
         Level.Game.ScoreObjective( EventInstigator.Controller.PlayerReplicationInfo, ScorePointsAdded );
 
      if( TriggeredSound != None )
         PlaySound( TriggeredSound );
   }
 
   Super.TriggerEvent( EventName, Other, EventInstigator );
}
 
defaultproperties
{
	TriggerType=TT_PawnProximity
	Message="%p points awarded!"
	bTriggerOnceOnly=True
	ScorePointsAdded=2
}

Related Topics[edit]


Discussion[edit]

Sweavo: I tagged this as UT2004. There's no reason it wouldn't work in 2k4 is there?