Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

U2.SpeakerTrigger


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
//=============================================================================
// SpeakerTrigger.uc
// Created By: Mike Fox
// Created On: 8/01/00
// $Author: Mfox $
// $Date: 1/29/03 4:24p $
// $Revision: 4 $
//=============================================================================

class SpeakerTrigger extends Trigger;

/*-----------------------------------------------------------------------------
Used to change an actor's speaker string when triggered. e.g. if the first NPC
of a group walks through a certain spot in the level we could give him a speaker
string causing him to carry out specific dialog.

If more than one speaker string given, subsequent triggers will iterate through the list.
The player's speaker string should NOT be changed
-----------------------------------------------------------------------------*/

var() array<string> SpeakerStrings;

var() enum ETargetType
{
	TT_TargetInstigator,	// target is instigator (must be a U2NPCBase)
//	TT_TargetNamed,			// target is NPC with Name=TargetName
	TT_TargetNearest,		// target is nearest U2NPCBase of specified class
	TT_TargetTagged,		// target is NPC with Tag=TargetName
} TargetType;

var() string TargetClassString;
var() name TargetName;

var private int CurrentSpeaker;

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

function bool IsUsable( Actor Other ) { return !bDeleteMe; }

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

protected function TriggerActors( 
	Actor TriggerSrc,
	class<Actor> TriggerClass, 
	Actor Other, 
	Pawn Instigator, 
	name TriggerEvent,
	bool bTriggerNPCs )
{
	// find the target actor and set its speaker string
	local actor TargetActor;
	local class<Actor> TargetClass;

	if( TargetType == TT_TargetInstigator )
	{
		TargetActor = Instigator;
	}
	else if( TargetType == TT_TargetNearest )
	{
		TargetClass = class<Actor>(DynamicLoadObject( TargetClassString, class'Class' ));
		if( TargetClass != None )
			TargetActor = class'UtilGame'.static.GetClosestActor( Self, TargetClass );
	}
	else if( TargetType == TT_TargetTagged )
	{
		if( TargetName != '' )
			foreach AllActors( class'Actor', TargetActor, TargetName )
				break;
	}

	// FIX Add a trigger type for non-player pawn proximity?
	if( TargetActor != None && TargetActor.Speaker != "Player" )
	{
		TargetActor.Speaker = SpeakerStrings[CurrentSpeaker];
		if( CurrentSpeaker + 1 < SpeakerStrings.Length )
			CurrentSpeaker++;
		else
			CurrentSpeaker = 0;		// wrap
	}
	// mdf-tbd: didn't do anything -- make sure trigger still active?
	// Its not trivial to do this without refactoring teh trigger code even further
}

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

defaultproperties
{
	TargetClassString="Engine.Pawn"
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:41.796 - Created with UnCodeX