I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX
UE2:IncrementalTrigger
From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 22:15, 6 April 2008 by DalinSeivewright (Talk | contribs) (Open Source/IncrementalTrigger moved to UE2:IncrementalTrigger: Restructuring.)
About
This trigger is similar to the Round Robin class but instead of triggering all of the events in its array when it itself is triggered, it will only fire the first event. When it is triggered again, it will fire the second. The third time it is triggered, it will fire the third, and so on and so fourth until the last event has been triggered.
Properties
Visible
- name Targets[16]
- An array of names. These names will be used to trigger events.
Hidden
- int iCurrentArray
- The position in the array of names.
- bool bTriggered
- Set internally. True if this actor has been triggered.
- bool bDisabled
- True when the trigger has triggered all events.
Methods
- PostBeginPlay()
- Starts the timer.
- Timer()
- Controls array event triggering;
- Trigger(Actor Other, Pawn EventInstigator)
- Called when this actor has been triggered.
Source Code
class IncrementalTrigger extends Actor placeable; var() name Targets[16]; //The things you wish to trigger var int iCurrentArray< SEMI > //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=false; bTriggered=false; } } } simulated function Trigger( Actor Other, Pawn EventInstigator ) { bTriggered = true; } DefaultProperties { bHidden=true }