Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Gameplay.Trigger

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

    class Trigger extends Engine.Actor
    	hidecategories(Events)
    	hidecategories(Force)
    	hidecategories(Karma)
    	hidecategories(Lighting)
    	hidecategories(LightColor)
    	hidecategories(Movement)
    	hidecategories(Sound)
    	abstract;

    var() string debugLogString;
    var() array<name> triggeredByFilter;
    var() bool bCanDeadTrigger				"Dead characters will not cause a trigger unless this variable is set to true.";
    var() bool bCanDeadTriggerExit			"Dead characters will not cause a trigger on exiting unless this variable is set to true.";

    function bool canTrigger(Actor testActor, optional bool exiting)
    {
    	local int index;
    	local bool bDeadTrigger;

    	if (exiting)
    		bDeadTrigger = bCanDeadTriggerExit;
    	else
    		bDeadTrigger = bCanDeadTrigger;

    	// dead rooks will not trigger unless otherwise specified
    	if (!bDeadTrigger && Rook(testActor) != None && !Rook(testActor).isAlive())
    		return false;

    	// if no actor is specified then all actors can trigger
    	if (triggeredByFilter.length == 0)
    		return true;

    	for (index = 0; index < triggeredByFilter.length; ++index)
    	{
    		if (triggeredByFilter[index] == testActor.label)
    			return true;
    	}
    	return false;
    }

    // dispatchMessage
    function dispatchMessage(Message msg)
    {
    	log(self$".dispatchMessage: Use the 'dispatchTrigger' function to send messages from trigger classes.");
    }

    // dispatchTrigger
    function bool dispatchTrigger(Actor instigator, MessageTrigger msg)
    {
    	local Pawn P;
    	local PlayerController C;

    	// debug log
    	if (debugLogString != "")
    	{
    		P = Pawn(instigator);
    		if (P != None)
    		{
    			C = PlayerController(P.Controller);
    			if (C != None)
    				C.ClientMessage("TRIGGER "$label$": "$debugLogString);
    		}
    	}

    	super.dispatchMessage(msg);

    	return true;
    }

    defaultproperties
    {
        bHidden=True
        bCollideActors=True
    	Texture=Texture'Engine_res.S_Trigger'
    	bProjTarget = false
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 15:53:28.000 - Creation time: st 23.5.2018 00:10:49.156 - Created with UnCodeX