This article's documentation is for anything that uses the Source engine. Click here for more information.

logic_case

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)
... Icon-Important.png
logic_case
Logic case.png
TypePoint entity
EngineSource Source
AvailabilityIn all games
 

logic_case is a point entity available in all Source Source games. It compares an input to up to 16 configured values, firing a corresponding output if there is a match (on InValue), or fires a random output (on PickRandom). Use logic_random_outputs for a weighted random output.

class hierarchy
CLogicCase defined in logicentities.cpp
CLogicalEntity
CServerOnlyEntity
CBaseEntity
Icon-Important.pngImportant:This entity stores values ​​as strings, so if you specify one of the case as "1.50", then when you try to compare float it will not match, because the float will be "1.5", and not "1.50".
Tip.pngTip:Use with logic_timer for extremely random events.

Keyvalues

Case 01 (Case01) to Case 16 (Case16) <string>
The values to test against.

Targetname:
Name (targetname) <string>
The targetname that other entities refer to this entity by.

Inputs

InValue <string>
Compares the Input value to the case values, and fires the appropriate output, if any.
PickRandom
Fires a random OnCase output with at least one connection.
PickRandomShuffle
Fires a random OnCase output with at least one connection, with no repeats until all cases have been picked, at which point the shuffle starts over.

Outputs

OnCase01 to OnCase16
Fired when the input value equals the corresponding Case value.
OnDefault
Fired when the input value does not equal any of the Case values.
OnUsed  (only in Mapbase)
Fired when an input value is received, regardless of whether it matches a case.