The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall


From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UE2 Actor >> Triggers >> RandomTrigger (custom)

This custom trigger will cause random events to fire from a dynamic list of event names.



array<name> EventList 
A dynamic array of Events to trigger.

Source Code[edit]

// RandomTrigger
// Uses a random value to select from a dynamic array of Events when triggered.
// by SuperApe -- Sept 2005
class RandomTrigger extends Triggers
var()	array<name>	EventList;
event Trigger( Actor Other, Pawn EventInstigator )
	Event = EventList[ FRand() * EventList.length ];
	TriggerEvent( Event, Other, EventInstigator );
//     Texture=Texture'Engine.S_Trigger'


If this actor is compiled inside the Unreal Editor, edit the default property Display -> Texture manually as indicated in the comment at the bottom of the code using the "editdefault class=RandomTrigger" Unreal Editor console command. If you are Compiling with UCC, simply un-comment the defaultProperties block.

Related Topics[edit]