home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / Gameplay / Classes / SpecialEventTrigger.uc < prev    next >
Text File  |  2003-12-11  |  4KB  |  121 lines

  1. //=============================================================================
  2. // SpecialEventTrigger: Receives trigger messages and does some "special event"
  3. // some combination of a message, sound playing, damage, and/or death to the instigator
  4. // if the event of this actor is set, will try to send player on the interpolation path
  5. // with tag matching this event.
  6. //=============================================================================
  7. class SpecialEventTrigger extends Triggers
  8.     notplaceable;
  9.  
  10. #exec Texture Import File=..\engine\Textures\TrigSpcl.pcx Name=S_SpecialEvent Mips=Off MASKED=1
  11.  
  12. //-----------------------------------------------------------------------------
  13. // Variables.
  14.  
  15. var() int        Damage;         // how much to damage triggering actor
  16. var() class<DamageType>         DamageType;
  17. var() sound      Sound;          // if not none, this sound effect will be played
  18. var() localized  string Message; // message to display
  19. var() bool       bBroadcast;     // To broadcast the message to all players.
  20. var() bool         bPlayerJumpToInterpolation;    // if true, player is teleported to start of interpolation path
  21. var() bool         bPlayersPlaySoundEffect;        // if true, have sound effect played at players' location
  22. var() bool         bKillInstigator;    // if true, kill the instigator
  23. var() bool         bViewTargetInterpolatedActor;    // if true, playercontroller viewtargets the interpolated actor
  24. var() bool         bThirdPersonViewTarget;        // if true, playercontroller third person views the interpolated actor
  25. var() name         InterpolatedActorTag;    // tag of actor to send on interpolation path (if none, then instigator is used)
  26. var() name         PlayerScriptTag;        // tag of scripted sequence to put player's pawn while player is viewtargeting another actor
  27.  
  28. //-----------------------------------------------------------------------------
  29. // Functions.
  30.  
  31. function Trigger( actor Other, pawn EventInstigator )
  32. {
  33.     local PlayerController P;
  34.     local ScriptedSequence S;
  35.     local Actor A;
  36.  
  37.     if ( Len(Message) != 0 )
  38.     {
  39.         if( bBroadcast )
  40.             Level.Game.Broadcast(EventInstigator, Message, 'CriticalEvent'); // Broadcast message to all players.
  41.         else if( (len(Message)!=0) && (EventInstigator != None) )
  42.             EventInstigator.ClientMessage( Message ); // Send message to instigator only.
  43.     }
  44.  
  45.     if ( Sound != None )
  46.     {
  47.         if ( bPlayersPlaySoundEffect )
  48.         {
  49.             ForEach DynamicActors(class'PlayerController', P)
  50.                 P.ClientPlaySound(Sound);
  51.         }
  52.         else
  53.             PlaySound( Sound );
  54.     }
  55.  
  56.     if ( Damage > 0 )
  57.         Other.TakeDamage( Damage, EventInstigator, EventInstigator.Location, Vect(0,0,0), DamageType);
  58.  
  59.     if ( EventInstigator == None )
  60.         return;
  61.  
  62.     if ( AmbientSound != None )
  63.         EventInstigator.AmbientSound = AmbientSound;
  64.  
  65.     if ( bKillInstigator )
  66.         EventInstigator.Died( None, DamageType, EventInstigator.Location );
  67.  
  68.     if( (Event != 'None') && (Event != '') && (Level.NetMode == NM_Standalone) )
  69.     {
  70.         if ( (InterpolatedActorTag == 'None') || (InterpolatedActorTag == '') )
  71.         {
  72.             if ( EventInstigator.IsPlayerPawn() )
  73.             {
  74.                 A = EventInstigator;
  75.                 if ( A.bInterpolating )
  76.                     return;
  77.             }
  78.             else
  79.                 return;
  80.         }
  81.         else
  82.         {
  83.             ForEach DynamicActors( class'Actor', A, InterpolatedActorTag )
  84.                 break;
  85.             if ( (A == None) || A.bInterpolating )
  86.                 return;
  87.             if ( bViewTargetInterpolatedActor && EventInstigator.IsHumanControlled() )
  88.             {
  89.                 PlayerController(EventInstigator.Controller).SetViewTarget(A);
  90.                 PlayerController(EventInstigator.Controller).bBehindView = bThirdPersonViewTarget;
  91.                 if ( PlayerScriptTag != 'None' )
  92.                 {
  93.                     ForEach DynamicActors( class'ScriptedSequence', S, PlayerScriptTag )
  94.                         break;
  95.                     if ( S != None )
  96.                     {
  97.                         EventInstigator.Controller.Pawn = None;
  98.                         PlayerController(EventInstigator.Controller).GotoState('Spectating');
  99.                         S.TakeOver(EventInstigator);
  100.                     }
  101.                 }
  102.             }                
  103.         }
  104.         //*WDM*
  105.         //ForEach AllActors( class 'InterpolationPoint',i, Event )
  106.         //    if( i.Position == 0 )
  107.         //    {
  108.         //        A.StartInterpolation(i.next, bPlayerJumpToInterpolation);
  109.         //        if ( AmbientSound != None )
  110.         //            A.AmbientSound = AmbientSound;
  111.         //        break;
  112.         //    }
  113.     }
  114. }
  115.  
  116. defaultproperties
  117. {
  118.      bObsolete=true
  119.      Texture=Texture'S_SpecialEvent'
  120.      bPlayerJumpToInterpolation=true
  121. }