Logic case: 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".
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".
 Tip:Use with logic_timer for extremely random events.
Tip:Use with logic_timer for extremely random events.
		
	
| m (Add tabs between source 1 and 2 pages) | m (Substituted IO templates) | ||
| Line 12: | Line 12: | ||
| == Inputs == | == Inputs == | ||
| {{ | {{I|InValue|Compares the Input value to the case values, and fires the appropriate output, if any.|param=string}} | ||
| {{ | {{I|PickRandom|Fires a random OnCase output with at least one connection.}} | ||
| {{ | {{I|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 == | == Outputs == | ||
| {{ | {{O|OnCase01|to=OnCase16|Fired when the input value equals the corresponding Case value.}} | ||
| {{ | {{O|OnDefault|Fired when the input value does not equal any of the Case values.}} | ||
| {{ | {{O|OnUsed|Fired when an input value is received, regardless of whether it matches a case.|only={{mapbase}}}} | ||
| == See Also == | == See Also == | ||
Revision as of 21:21, 19 April 2025
|  Class hierarchy | 
|---|
| CLogicCase | 
|  logicentities.cpp | 

logic_case  is a   point entity  available in all  Source games. It compares an input to up to 16 configured values, firing a corresponding output if there is a match (on
 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.
 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".
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". Tip:Use with logic_timer for extremely random events.
Tip:Use with logic_timer for extremely random events.Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentnameortarget).
 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 16 (Case16) <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.
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.



























