I love the smell of UnrealEd crashing in the morning. – tarquin

Legacy:Counter

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT :: Actor (UT) >> Triggers (UT) >> Counter (Package: Engine)
UT2003 :: Actor >> Triggers (UT2003) >> Counter (Package: Gameplay)

Note: In UT200x, you should use a ScriptedTrigger with ScriptedActions instead.

A counter will need to be triggered n times before it will trigger an event.

Examples of using a counter:

  • several buttons must be pressed before a door opens
  • a monster appears once a player has picked up a particular number of items in a room
  • the secret door in UT's DM-Codex

Because the Counter simply counts how many times it's been triggered, the order in which things trigger it has no relevance – there's no way for the Counter to know. In particular, if the Triggers are set as repeatable, the same Trigger n times will also do it (the door in DM-Codex can be opened by shooting just one light four times).

To avoid this, set Triggers to non-repeatable or with a long delay For something where the order matters, use a CodeMaster system.

Properties[edit]

Main[edit]

byte NumToCount 
Number to count down from.
bool bShowMessage 
Will show CountMessage.
string CountMessage (localized) 
What message needs to be showed each time its triggered. For example: "Only %i more to go..."
string CompleteMessage (localized) 
What message needs to be showed when the count is completed. For example: "Completed!"

Hidden[edit]

byte OriginalNum 
Number to count at startup time.

Functions[edit]

BeginPlay() 
Init for play. Sets OriginalNum = NumToCount.
Reset() 
Reset actor to initial state - used when restarting level without reloading. Sets NumToCount = OriginalNum.
Trigger( Actor Other, Pawn EventInstigator ) 
Counter was triggered. If NumToCount is more than zero, decrements NumToCount. If NumToCount is zero, Triggers all matching actors. Else, if bShowMessage, displays ClientMessage of CountMessage and replaces %i with "one", "two", etc. up to "six". (More than that, it will display the string equivalent of NumToCount. i.e., "7".)

Related Topics[edit]