## XIII
Class ClueTrigger

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Triggers
             |
             +--XIII.ClueTrigger

Direct Known Subclasses:None

class ClueTrigger
extends Engine.Triggers

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

Variables
`Pickup` | `MyPickup`
`float` | `TriggerDistance`

States
CheckForPickup, WaitForBeingSeen

State CheckForPickup Function Summary

State WaitForBeingSeen Function Summary

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class ClueTrigger extends Triggers;
    00005
    00006	var() float TriggerDistance;
    00007	var() pickup MyPickup;
    00008
    00009	//____________________________________________________________________
    00010	auto state WaitForBeingSeen
    00011	{
    00012	    event BeginState()
    00013	    {
    00014	      SetTimer(1.0, false);
    00015	    }
    00016
    00017	    event Timer()
    00018	    { // Only called in solo mode
    00019	      local float fTime, fDist;
    00020	      local XIIIPlayerPawn XPP;
    00021
    00022	      if ( (Level.Game == none) || (XIIIGameInfo(Level.Game).MapInfo == none) || (XIIIGameInfo(Level.Game).MapInfo.XIIIPawn == none) )
    00023	      {
    00024	        SetTimer(2.0, false);
    00025	        return;
    00026	      }
    00027	      XPP = XIIIPlayerPawn(XIIIGameInfo(Level.Game).MapInfo.XIIIPawn);
    00028	      if ( (XPP == none) || (XPP.Controller == none) || (XPP.SSSk == none) || !XPP.SSSk.bImOn )
    00029	      {
    00030	        SetTimer(2.0, false);
    00031	        return;
    00032	      }
    00033
    00034	      fDist = vSize(XPP.Location - Location);
    00035
    00036	      if ( (fDist < TriggerDistance) && FastTrace(Location, XPP.Location) && ((Location - XPP.Location) dot vector(XPP.Controller.Rotation) > 0.707) )
    00037	      { // if player see me send clue
    00038	        bHidden = false;
    00039	        bDelayDisplay = true;
    00040	        LifeSpan = 2.5;
    00041	        SetTimer(0.1, true);
    00042	        if ( MyPickup != none )
    00043	          GotoState('CheckForPickup');
    00044	      }
    00045	      else
    00046	      { // still wait w/ eval of how long it will take for the player to come
    00047	        fTime = (fDist-TriggerDistance) / XPP.GroundSpeed;
    00048	        fTime *= 0.666; // security factor
    00049	        fTime = fMax(0.5, fTime); // wait a min time
    00050	        SetTimer(fTime, false);
    00051	      }
    00052	    }
    00053	}
    00054
    00055	//____________________________________________________________________
    00056	state CheckForPickup
    00057	{
    00058	    event Timer()
    00059	    {
    00060	      if ( (MyPickup == none) || MyPickup.bDeleteMe )
    00061	        Destroy();
    00062	    }
    00063	}
    00064
    00065
    00066	defaultproperties
    00067	{
    00068	     TriggerDistance=800.000000
    00069	     bCollideActors=False
    00070	     Texture=Texture'XIIICine.effets.indice'
    00071	}

End Source Code