Engine
Class SpecialEvent

source: e:\games\UnrealTournament\Engine\Classes\SpecialEvent.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Triggers
         |
         +--Engine.SpecialEvent
Direct Known Subclasses:None

class SpecialEvent
extends Engine.Triggers

//============================================================================= // SpecialEvent: Receives trigger messages and does some "special event" // depending on the state. //=============================================================================
Variables
 int Damage
           For DamagePlayer state.
 string DamageString
           For DamagePlayer state.
 name DamageType
           For DamagePlayer state.
 string Message
           For all states.
 sound Sound
           For PlaySoundEffect state.
 bool bBroadcast
           To broadcast the message to all players.
 bool bPlayerViewRot
           Whether player can rotate the view while pathing.


Function Summary
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.
 void Trigger(Actor Other, Pawn EventInstigator)
     
// Send the player on a spline path through the level.



Source Code


00001	//=============================================================================
00002	// SpecialEvent: Receives trigger messages and does some "special event"
00003	// depending on the state.
00004	//=============================================================================
00005	class SpecialEvent extends Triggers;
00006	
00007	#exec Texture Import File=Textures\TrigSpcl.pcx Name=S_SpecialEvent Mips=Off Flags=2
00008	
00009	//-----------------------------------------------------------------------------
00010	// Variables.
00011	
00012	var() int        Damage;         // For DamagePlayer state.
00013	var() name		 DamageType;
00014	var() localized  string DamageString;
00015	var() sound      Sound;          // For PlaySoundEffect state.
00016	var() localized  string Message; // For all states.
00017	var() bool       bBroadcast;     // To broadcast the message to all players.
00018	var() bool       bPlayerViewRot; // Whether player can rotate the view while pathing.
00019	
00020	//-----------------------------------------------------------------------------
00021	// Functions.
00022	
00023	function Trigger( actor Other, pawn EventInstigator )
00024	{
00025		local pawn P;
00026		if( bBroadcast )
00027			BroadcastMessage(Message, true, 'CriticalEvent'); // Broadcast message to all players.
00028		else if( EventInstigator!=None && len(Message)!=0 )
00029		{
00030			// Send message to instigator only.
00031			EventInstigator.ClientMessage( Message );
00032		}
00033	}
00034	
00035	//-----------------------------------------------------------------------------
00036	// States.
00037	
00038	// Just display the message.
00039	state() DisplayMessage
00040	{
00041	}
00042	
00043	// Damage the instigator who caused this event.
00044	state() DamageInstigator
00045	{
00046		function Trigger( actor Other, pawn EventInstigator )
00047		{
00048			Global.Trigger( Self, EventInstigator );
00049			if ( Other.IsA('PlayerPawn') )
00050				Level.Game.SpecialDamageString = DamageString;
00051			Other.TakeDamage( Damage, EventInstigator, EventInstigator.Location, Vect(0,0,0), DamageType);
00052		}
00053	}
00054	
00055	// Kill the instigator who caused this event.
00056	state() KillInstigator
00057	{
00058		function Trigger( actor Other, pawn EventInstigator )
00059		{
00060			Global.Trigger( Self, EventInstigator );
00061			if ( Other.IsA('PlayerPawn') )
00062				Level.Game.SpecialDamageString = DamageString;
00063			if( EventInstigator != None )
00064				EventInstigator.Died( None, DamageType, EventInstigator.Location );
00065		}
00066	}
00067	
00068	// Play a sound.
00069	state() PlaySoundEffect
00070	{
00071		function Trigger( actor Other, pawn EventInstigator )
00072		{
00073			Global.Trigger( Self, EventInstigator );
00074			PlaySound( Sound );
00075		}
00076	}
00077	
00078	// Play a sound.
00079	state() PlayersPlaySoundEffect
00080	{
00081		function Trigger( actor Other, pawn EventInstigator )
00082		{
00083			local pawn P;
00084	
00085			Global.Trigger( Self, EventInstigator );
00086	
00087			for ( P=Level.PawnList; P!=None; P=P.NextPawn )
00088				if ( P.bIsPlayer && P.IsA('PlayerPawn') )
00089					PlayerPawn(P).ClientPlaySound(Sound);
00090		}
00091	}
00092	
00093	// Place Ambient sound effect on player
00094	state() PlayAmbientSoundEffect
00095	{
00096		function Trigger( actor Other, pawn EventInstigator )
00097		{
00098			Global.Trigger( Self, EventInstigator );
00099			EventInstigator.AmbientSound = AmbientSound;
00100		}
00101	}
00102	
00103	
00104	// Send the player on a spline path through the level.
00105	state() PlayerPath
00106	{
00107		function Trigger( actor Other, pawn EventInstigator )
00108		{
00109			local InterpolationPoint i;
00110			Global.Trigger( Self, EventInstigator );
00111			if( EventInstigator!=None && EventInstigator.bIsPlayer && (Level.NetMode == NM_Standalone) )
00112			{
00113				foreach AllActors( class 'InterpolationPoint', i, Event )
00114				{
00115					if( i.Position == 0 )
00116					{
00117						EventInstigator.GotoState('');
00118						EventInstigator.SetCollision(True,false,false);
00119						EventInstigator.bCollideWorld = False;
00120						EventInstigator.Target = i;
00121						EventInstigator.SetPhysics(PHYS_Interpolating);
00122						EventInstigator.PhysRate = 1.0;
00123						EventInstigator.PhysAlpha = 0.0;
00124						EventInstigator.bInterpolating = true;
00125						EventInstigator.AmbientSound = AmbientSound;
00126					}
00127				}
00128			}
00129		}
00130	}
00131	
00132	defaultproperties
00133	{
00134	     Texture=Texture'Engine.S_SpecialEvent'
00135	}

End Source Code