Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

Difference between revisions of "Open Source/ScoreAwardTrigger"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(Marked For Deletion (Old License Complications))
m (added delete reason - is any Admin still active? oO)
Line 1: Line 1:
{{delete|no delete reason given initially; it is a close duplicate of [[Legacy:ScoreAwardTrigger]]}}

Latest revision as of 18:55, 22 September 2016


A trigger that, when triggered, will add points to a player's score.



int ScorePointsAdded 
Amount of points to add.
sound TriggeredSound 
Sound played when triggered.

Source Code[edit]

/* Written by Jon Steadman */
class ScoreAwardTrigger extends Trigger;
var() int ScorePointsAdded;
var() sound TriggeredSound;
function PostBeginPlay()
   ReplaceText( Message , "%p", string( ScorePointsAdded ) );
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 );
	Message="%p points awarded!"

Related Topics[edit]