## XIII
Class XIIIGoalTrigger

source: C:\XIII\XIII\Classes\XIIIGoalTrigger.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Triggers
             |
             +--XIII.XIIITriggers
                |
                +--XIII.XIIIGoalTrigger

Direct Known Subclasses:None

class XIIIGoalTrigger
extends XIII.XIIITriggers

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Variables
`int` | `GoalNumber`
`float` | `TimeBeforeTrigger`

Function Summary
`void` | `CauseGoal()`
    //____________________________________________________________________
`void` | `Trigger(Actor Other, Pawn EventInstigator)`
    //____________________________________________________________________
    // If triggered then my goal is ok

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIGoalTrigger extends XIIITriggers;
    00005
    00006	var() int GoalNumber;
    00007	var() float TimeBeforeTrigger;
    00008
    00009	//____________________________________________________________________
    00010	// If triggered then my goal is ok
    00011	function Trigger( actor Other, pawn EventInstigator )
    00012	{
    00013	    Log(self$" trigger w/ other="$Other$" EventInstigator="$EventInstigator$" GoalNumber="$GoalNumber);
    00014	    Instigator = EventInstigator;
    00015	    // EventInstigator should be player
    00016	    if ( XIIIGameInfo(Level.Game).MapInfo != none )
    00017	    {
    00018	      if ( (EventInstigator != none) && EventInstigator.bIsDead )
    00019	      {
    00020	        //Log("Can't trigger a goal when touched by a dead");
    00021	        return;
    00022	      }
    00023	//      Log(self$" other.IsDead="$XIIIPawn(Other).bIsDead$" Other.HitDamageType="$Pawn(Other).HitDamageType);
    00024	      if ( (XIIIPawn(Other) == none) || ( !XIIIPawn(Other).bIsDead || ((XIIIPawn(Other).HitDamageType != class'DTStunned') && (XIIIPawn(Other).HitDamageType != class'DTSureStunned'))) )
    00025	      {
    00026	        if ( TimeBeforeTrigger > 0.0 )
    00027	        {
    00028	          SetTimer(TimeBeforeTrigger, false);
    00029	          return;
    00030	        }
    00031	        else
    00032	          CauseGoal();
    00033	      }
    00034	    }
    00035	    else
    00036	    {
    00037	      //Log("PB on "$self$", can't trigger my goal, setting a wait of 0.2 to check again if the mapinfo was not initialized");
    00038	      SetTimer2(0.2, false);
    00039	    }
    00040	}
    00041
    00042	//____________________________________________________________________
    00043	event Timer2()
    00044	{
    00045	    if ( XIIIGameInfo(Level.Game).MapInfo != none )
    00046	      CauseGoal();
    00047	//    else
    00048	      //Log("PB on "$self$" GOAL "$GoalNumber$" CAN'T BE TRIGGERED BECAUSE NO MAPINFO");
    00049	}
    00050
    00051	//____________________________________________________________________
    00052	event Timer()
    00053	{
    00054	    CauseGoal();
    00055	}
    00056
    00057	//____________________________________________________________________
    00058	function CauseGoal()
    00059	{
    00060	    if ( Level.Game.bGameEnded )
    00061	    {
    00062	      log("Goal number "$GoalNumber$" not validated, Game Ended.");
    00063	      return;
    00064	    }
    00065
    00066	    TriggerEvent(event, self, Instigator);
    00067	    if (GoalNumber>=90)
    00068	    { // Cheat to activate event that's not in the objectives [used for chronometre && nust-not-kill people]
    00069	      log("Goal number "$GoalNumber$" validated.");
    00070	      XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GoalNumber);
    00071	    }
    00072	    else if ( XIIIGameInfo(Level.Game).MapInfo.Objectif[GoalNumber].bPrimary )
    00073	    {
    00074	      log("Goal number "$GoalNumber$" validated.");
    00075	      XIIIGameInfo(Level.Game).MapInfo.SetGoalComplete(GoalNumber);
    00076	      destroy();
    00077	    }
    00078	    else
    00079	    {
    00080	      log("Goal number "$GoalNumber$" could not be validated, it's not primary.");
    00081	    }
    00082	}
    00083
    00084
    00085
    00086	defaultproperties
    00087	{
    00088	     bInteractive=True
    00089	}

End Source Code