Legacy:RotationalTriggering

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search

Rotational Trigger

UT2004 :: Actor >> RotationalTrigger

About

This actor was coded to fire off a certain amount of events. When you trigger it, it will fire the first event in the array. When you trigger it again, it will fire the second event in the array and so on and so fourth. Once it has triggered the last event, it will disable itself.

The Script

<uscript> /*Written By Dalin 'MythOpus' Seivewright. A simple trigger that will trigger events sequentially. Example: First time it is triggered will fire event 1. The second time it is triggered it will fire even 2 and so on and so fourth. Just fill as many Events in the Target's array as you need, Then set up a trigger to trigger this actor */

class RotationalTrigger extends Actor placeable;

var() name Targets[16]; //The things you wish to trigger var int iCurrentArray; //The position of the to-be triggered event in the array

var bool bTriggered; //Internally Set Bool (Ignore It) var bool bDisabled;

function PostBeginPlay() {

 SetTimer(1.0, True);

}

simulated function Timer() {

       if((bTriggered)) //If we've been triggered and...
       {
           if(!bDisabled) //If this isn't disabled...
           {
                       TriggerEvent(Targets[iCurrentArray], self, None); //Triggering The First Item In The Array
         
                       
                       //if iCurrentArray number is smaller or equal to the arrays length..
                       if(iCurrentArray != (ArrayCount(Targets) - 1))
                       //then increase the CurrentArray count by 1 so it will trigger the next array item
                       iCurrentArray++;
                       else //if the CurrentArray count is bigger than the Array's length, Disable this actor.
                       bDisabled=True;
                       bTriggered=FALSE;
           }
       }

}

simulated function Trigger( Actor Other, Pawn EventInstigator ) {

      bTriggered = TRUE;

}

DefaultProperties {

 bHidden=TRUE

} </uscript>