| Home Page | Recent Changes | Preferences

ScoreAwardTrigger

UT2003 :: Actor >> Triggers >> Trigger >> ScoreAwardTrigger (custom)

About

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

/* 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


Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In