Logic case (Source 2): Difference between revisions
Jump to navigation
Jump to search

Important: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".
(Create source 2 logic_case page) |
(Include missing inputs and outputs accessible by every Source 2 entity) |
||
Line 14: | Line 14: | ||
{{IO|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.}} | {{IO|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.}} | ||
{{IO|ResetShuffle|Starts the shuffle over so that the next PickRandomShuffle can select from all cases.}} | {{IO|ResetShuffle|Starts the shuffle over so that the next PickRandomShuffle can select from all cases.}} | ||
{{I BaseEntity (Source 2)}} | |||
== Outputs == | == Outputs == | ||
{{IO|OnCase01|to=OnCase32|Fired when the input value equals the corresponding Case value.}} | {{IO|OnCase01|to=OnCase32|Fired when the input value equals the corresponding Case value.}} | ||
{{IO|OnDefault|Fired when the input value does not equal any of the Case values.}} | {{IO|OnDefault|Fired when the input value does not equal any of the Case values.}} | ||
{{O BaseEntity|s2=1}} | |||
== See Also == | == See Also == | ||
* {{ent|math_counter}} | * {{ent|math_counter}} | ||
[[Category:IO System]] | [[Category:IO System]] |
Revision as of 12:14, 19 June 2024
![]() |
---|
CLogicCase |
![]() |

logic_case
is a point entity available in all Source 2 games. It compares an input to up to 32 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.

Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Case 01 (Case01) to Case 32 (Case32) <string>
- The values to test against.
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.
- ResetShuffle
- Starts the shuffle over so that the next PickRandomShuffle can select from all cases.
Base:
- RunScriptFile
- Load and execute a script file.
- RunScriptCode
- Execute a fragment of script code.
- CallScriptFunction
- Call a script function.
- CallPrivateScriptFunction
- Calls a script function from this entity's private script scope.
- CallGlobalScriptFunction
- Calls a script function in the global script scope.
- Kill
- Removes this entity from the world.
- KillHierarchy
- Removes this entity and all its children from the world.
- AddOutput
- Adds an entity I/O connection to this entity. Parameter format: OutputName→TargetName→InputName→Parameter→Delay→MaxRefires
- FireUser1 to FireUser4
- Fires the respective
OnUser
outputs; see User Inputs and Outputs.
Outputs
- OnCase01 to OnCase32
- Fired when the input value equals the corresponding Case value.
- OnDefault
- Fired when the input value does not equal any of the Case values.