Logic case

From Valve Developer Community

This point-based entity is available in all Source games.

Table of contents

Entity description

Compares an input to up to 16 preset values. If the input value is the same as any of the preset values, an output corresponding to that value is fired.

For example: If Case01 is set to 2 and Case02 is set to 5, and the input value is 5, the OnCase02 output will be fired.

This entity can also be used to select from a number of random targets via the PickRandom input. One of the OnCase outputs that is connected to another entity will be picked at random and fired.

Image:note.png Note: This entity with not recognize float values ending in 0 (like 0.50 or 1.00). Simply remove these.
  • The ideal entity for randomized events.
  • Use with logic_timer for extremely random events.

Keyvalues

Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.
  • Case(01-16)
<string>

Inputs

  • Kill
Removes this entity from the world.
Removes this entity and all its children from the world.
  • AddOutput <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>
Causes this entity's OnUser1-4 outputs to be fired. See User Inputs and Outputs.
  • InValue <string>
Compare the Input value to the case values, and fire the appropriate output, if any.
  • PickRandom
Fire a random OnCase output with at least one connection.
  • PickRandomShuffle [Episode One Update]
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

Fired in response to FireUser1-4 inputs. See User Inputs and Outputs.
!activator = activator
  • OnCase(01-16)
Fired when the input value equals the Case(01-16) value.
!activator = activator
  • OnDefault <string>
Fired when the input value does not equal any of the Case values.
!activator = activator