Engine
Class SpecialEvent

source: c:\runehov\Engine\Classes\SpecialEvent.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Triggers
         |
         +--Engine.SpecialEvent
Direct Known Subclasses:SpecialEventRune

class SpecialEvent
extends Engine.Triggers

//============================================================================= // SpecialEvent: Receives trigger messages and does some "special event" // depending on the state. //=============================================================================
Variables
 int Damage
           For DamagePlayer state.
 int DamageJoint
           For DamagePlayer state.
 string DamageString
           For DamagePlayer state.
 name DamageType
           For DamagePlayer state.
 string Message
           For all states.
 name ObjectTag
           Tag of object
 name ScriptTag
           Tag of script object for 'OrderObject'
 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)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 void Trigger(Actor Other, Pawn EventInstigator)
 
simulated
debug(Canvas Canvas, int mode)
     
//============================================================
//
// Debug
//
//============================================================



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() int		 DamageJoint;
00015	var() localized  string DamageString;
00016	var() sound      Sound;          // For PlaySoundEffect state.
00017	var() localized  string Message; // For all states.
00018	var() bool       bBroadcast;     // To broadcast the message to all players.
00019	var() bool       bPlayerViewRot; // Whether player can rotate the view while pathing.
00020	var() name       ObjectTag;      // Tag of object
00021	var() name       ScriptTag;      // Tag of script object for 'OrderObject'
00022	
00023	//-----------------------------------------------------------------------------
00024	// Functions.
00025	
00026	function Trigger( actor Other, pawn EventInstigator )
00027	{
00028		local pawn P;
00029		if( bBroadcast )
00030			BroadcastMessage(Message, true, 'CriticalEvent'); // Broadcast message to all players.
00031		else if( EventInstigator!=None && len(Message)!=0 )
00032		{
00033			// Send message to instigator only.
00034			EventInstigator.ClientMessage( Message );
00035		}
00036	}
00037	
00038	//-----------------------------------------------------------------------------
00039	// States.
00040	
00041	// Just display the message.
00042	state() DisplayMessage
00043	{
00044	}
00045	
00046	// Damage the object referenced by ObjectTag
00047	state() DamageObject
00048	{
00049		function Trigger( actor Other, pawn EventInstigator )
00050		{
00051			local actor A;
00052		
00053			Global.Trigger( Self, EventInstigator );
00054			if ( Other.IsA('PlayerPawn') )
00055				Level.Game.SpecialDamageString = DamageString;
00056			foreach AllActors(class'Actor', A, ObjectTag)
00057				A.JointDamaged( Damage, EventInstigator, A.Location, Vect(0,0,0), DamageType, DamageJoint);
00058		}
00059	}
00060	
00061	// Damage the instigator who caused this event.
00062	state() DamageInstigator
00063	{
00064		function Trigger( actor Other, pawn EventInstigator )
00065		{
00066			Global.Trigger( Self, EventInstigator );
00067			if ( Other.IsA('PlayerPawn') )
00068				Level.Game.SpecialDamageString = DamageString;
00069			Other.JointDamaged( Damage, EventInstigator, EventInstigator.Location, Vect(0,0,0), DamageType, DamageJoint);
00070		}
00071	}
00072	
00073	// Kill the pawn referenced by ObjectTag
00074	state() KillObject
00075	{
00076		function Trigger( actor Other, pawn EventInstigator )
00077		{
00078			local Pawn A;
00079		
00080			Global.Trigger( Self, EventInstigator );
00081			if ( Other.IsA('PlayerPawn') )
00082				Level.Game.SpecialDamageString = DamageString;
00083			foreach AllActors(class'Pawn', A, ObjectTag)
00084				A.Died( None, DamageType, A.Location );
00085		}
00086	}
00087	
00088	// Kill the instigator who caused this event.
00089	state() KillInstigator
00090	{
00091		function Trigger( actor Other, pawn EventInstigator )
00092		{
00093			Global.Trigger( Self, EventInstigator );
00094			if ( Other.IsA('PlayerPawn') )
00095				Level.Game.SpecialDamageString = DamageString;
00096			if( EventInstigator != None )
00097				EventInstigator.Died( None, DamageType, EventInstigator.Location );
00098		}
00099	}
00100	
00101	// Play a sound.
00102	state() PlaySoundEffect
00103	{
00104		function Trigger( actor Other, pawn EventInstigator )
00105		{
00106			Global.Trigger( Self, EventInstigator );
00107			PlaySound( Sound );
00108		}
00109	}
00110	
00111	// Play a sound.
00112	state() PlayersPlaySoundEffect
00113	{
00114		function Trigger( actor Other, pawn EventInstigator )
00115		{
00116			local pawn P;
00117	
00118			Global.Trigger( Self, EventInstigator );
00119	
00120			for ( P=Level.PawnList; P!=None; P=P.NextPawn )
00121				if ( P.bIsPlayer && P.IsA('PlayerPawn') )
00122					PlayerPawn(P).ClientPlaySound(Sound);
00123		}
00124	}
00125	
00126	// Place Ambient sound effect on player
00127	state() PlayAmbientSoundEffect
00128	{
00129		function Trigger( actor Other, pawn EventInstigator )
00130		{
00131			Global.Trigger( Self, EventInstigator );
00132			EventInstigator.AmbientSound = AmbientSound;
00133		}
00134	}
00135	
00136	
00137	// Send the player on a spline path through the level.
00138	state() PlayerPath
00139	{
00140		function Trigger( actor Other, pawn EventInstigator )
00141		{
00142			local InterpolationPoint i;
00143			Global.Trigger( Self, EventInstigator );
00144			if( EventInstigator!=None && EventInstigator.bIsPlayer && (Level.NetMode == NM_Standalone) )
00145			{
00146				foreach AllActors( class 'InterpolationPoint', i, Event )
00147				{
00148					if( i.Position == 0 )
00149					{
00150						EventInstigator.GotoState('');
00151						EventInstigator.SetCollision(True,false,false);
00152						EventInstigator.bCollideWorld = False;
00153						EventInstigator.Target = i;
00154						EventInstigator.SetPhysics(PHYS_Interpolating);
00155						EventInstigator.PhysRate = 1.0;
00156						EventInstigator.PhysAlpha = 0.0;
00157						EventInstigator.bInterpolating = true;
00158						EventInstigator.AmbientSound = AmbientSound;
00159					}
00160				}
00161			}
00162		}
00163	}
00164	
00165	state() OrderObject
00166	{
00167		function Trigger( actor Other, pawn EventInstigator )
00168		{
00169			local Pawn P;
00170	
00171			Global.Trigger( Self, EventInstigator );
00172	
00173			if( ObjectTag != '' && ScriptTag != '' )
00174			{
00175				foreach AllActors( class 'Pawn', P, ObjectTag )
00176				{
00177					P.FollowOrders('Scripting', ScriptTag);
00178				}
00179			}
00180		}
00181	}
00182	
00183	
00184	state() HideObject
00185	{
00186		function Trigger( actor Other, pawn EventInstigator )
00187		{
00188			local Actor A;
00189	
00190			Global.Trigger( Self, EventInstigator );
00191	
00192			if( ObjectTag != '' )
00193			{
00194				foreach AllActors( class 'actor', A, ObjectTag )
00195				{
00196					A.bHidden = true;
00197				}
00198			}
00199		}
00200	}
00201	
00202	
00203	state() ShowObject
00204	{
00205		function Trigger( actor Other, pawn EventInstigator )
00206		{
00207			local Actor A;
00208	
00209			Global.Trigger( Self, EventInstigator );
00210	
00211			if( ObjectTag != '' )
00212			{
00213				foreach AllActors( class 'actor', A, ObjectTag )
00214				{
00215					A.bHidden = false;
00216				}
00217			}
00218		}
00219	}
00220	
00221	state() DestroyObject
00222	{
00223		function Trigger( actor Other, pawn EventInstigator )
00224		{
00225			local Actor A;
00226	
00227			Global.Trigger( Self, EventInstigator );
00228	
00229			if( ObjectTag != '' )
00230			{
00231				foreach AllActors( class 'actor', A, ObjectTag )
00232				{
00233					// RUNE:  Issue a warning if an inventory item is designer-destroyed.  This
00234					// should never happen, as it causes undefined behavior if the player is currently
00235					// carrying that inventory item.
00236					if(A.IsA('Inventory'))
00237					{
00238	//					slog("WARNING:  Attempted to Destroy Inventory: "$A);
00239						continue;
00240					}
00241	
00242					A.Destroy();
00243				}
00244			}
00245		}
00246	}
00247	
00248	
00249	//============================================================
00250	//
00251	// Debug
00252	//
00253	//============================================================
00254	simulated function debug(canvas Canvas, int mode)
00255	{
00256		local int ix;
00257		local actor A;
00258	
00259		// put text here
00260	
00261		Super.Debug(Canvas, mode);	// Draws actor name
00262	
00263		// Draw graphics
00264		if (ObjectTag != '')
00265			foreach AllActors(class'Actor', A, ObjectTag)
00266				Canvas.DrawLine3D(Location, A.Location, 255, 255, 0);
00267	}
00268	
00269	defaultproperties
00270	{
00271	     bBroadcast=True
00272	     Texture=Texture'Engine.S_SpecialEvent'
00273	     bCollideActors=False
00274	}

End Source Code