Skip to content

logic_case

Entity I/O / logic_case

Compares an input to up to 32 preset values. If the input value is the same as any of the preset values, an output corresponding to that value is fired.<br><br>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.<br><br>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.

  • FGD @PointClass in game/core/base.fgd, bases Targetname.
  • cs_script type: Entity, what FindEntitiesByClass("logic_case") returns.
  • Native class: CLogicCase (curated pairing).

CS2 build 27045800 · Steam date 2026-11-30 · platform windows-x86_64 · schema format 2.2

Inputs (19)

NameParameterFromDescription
RunScriptFilestringVScriptLoad and execute a script file
RunScriptCodestringVScriptExecute a fragment of script code
CallScriptFunctionstringVScriptCall a script function
CallPrivateScriptFunctionstringVScriptCalls a script function from this entity's private script scope.
CallGlobalScriptFunctionstringVScriptCalls a script function in the global script scope.
KillGameEntityRemoves this entity from the world.
KillHierarchyGameEntityRemoves this entity and all its children from the world.
KillConstrainedGameEntityRemoves this entity, all its children, and anything constrained to it, from the world.
AddOutputstringGameEntityAdds an entity I/O connection to this entity. Parameter format: outputname>targetname>inputname>parameter>delay>max times to fire (-1 == infinite). Very dangerous, use with care.
FireUser1GameEntityCauses this entity's OnUser1 output to be fired.
FireUser2GameEntityCauses this entity's OnUser2 output to be fired.
FireUser3GameEntityCauses this entity's OnUser3 output to be fired.
FireUser4GameEntityCauses this entity's OnUser4 output to be fired.
EnableAutoSleepingGameEntityEnable automatic sleeping on this entity's physics bodies. When enabled, physics bodies go to sleep when at rest.
DisableAutoSleepingGameEntityDisable automatic sleeping on this entity's physics bodies. Bodies remain awake until explicitly put to sleep.
InValuestringCompares the Input value to the case values, and fires the appropriate output, if any.
PickRandomFires a random OnCase output with at least one connection.
PickRandomShuffleFires 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.
ResetShuffleStarts the shuffle over so that the next PickRandomShuffle can select from all cases.

Outputs (38)

NameParameterFromDescription
OnUser1GameEntityFired in response to FireUser1 input.
OnUser2GameEntityFired in response to FireUser2 input.
OnUser3GameEntityFired in response to FireUser3 input.
OnUser4GameEntityFired in response to FireUser4 input.
OnKilledGameEntityFired when the entity is killed and removed from the game. Parameter is the inflictor.
OnDefaultFired when the input value does not equal any of the Case values.
OnCase01Fired when the input value equals the Case01 value.
OnCase02Fired when the input value equals the Case02 value.
OnCase03Fired when the input value equals the Case03 value.
OnCase04Fired when the input value equals the Case04 value.
OnCase05Fired when the input value equals the Case05 value.
OnCase06Fired when the input value equals the Case06 value.
OnCase07Fired when the input value equals the Case07 value.
OnCase08Fired when the input value equals the Case08 value.
OnCase09Fired when the input value equals the Case09 value.
OnCase10Fired when the input value equals the Case10 value.
OnCase11Fired when the input value equals the Case11 value.
OnCase12Fired when the input value equals the Case12 value.
OnCase13Fired when the input value equals the Case13 value.
OnCase14Fired when the input value equals the Case14 value.
OnCase15Fired when the input value equals the Case15 value.
OnCase16Fired when the input value equals the Case16 value.
OnCase17Fired when the input value equals the Case17 value.
OnCase18Fired when the input value equals the Case18 value.
OnCase19Fired when the input value equals the Case19 value.
OnCase20Fired when the input value equals the Case20 value.
OnCase21Fired when the input value equals the Case21 value.
OnCase22Fired when the input value equals the Case22 value.
OnCase23Fired when the input value equals the Case23 value.
OnCase24Fired when the input value equals the Case24 value.
OnCase25Fired when the input value equals the Case25 value.
OnCase26Fired when the input value equals the Case26 value.
OnCase27Fired when the input value equals the Case27 value.
OnCase28Fired when the input value equals the Case28 value.
OnCase29Fired when the input value equals the Case29 value.
OnCase30Fired when the input value equals the Case30 value.
OnCase31Fired when the input value equals the Case31 value.
OnCase32Fired when the input value equals the Case32 value.

Keyvalues (34)

The names Hammer saves and the KeyValue input and AddOutput take at run time. An entity reads some keys only when it spawns, so changing one later may do nothing. Integer keys such as movetype take engine numbers, not the renumbered cs_script enum values.

KeyTypeDefaultFromDescription
vscripts
Entity Scripts
scriptlistVScriptName(s) of script files that are executed after all entities have spawned.
targetname
Name
target_sourceTargetnameThe name that other entities refer to this entity by.
Case01
Case 01
string
Case02
Case 02
string
Case03
Case 03
string
Case04
Case 04
string
Case05
Case 05
string
Case06
Case 06
string
Case07
Case 07
string
Case08
Case 08
string
Case09
Case 09
string
Case10
Case 10
string
Case11
Case 11
string
Case12
Case 12
string
Case13
Case 13
string
Case14
Case 14
string
Case15
Case 15
string
Case16
Case 16
string
Case17
Case 17
string
Case18
Case 18
string
Case19
Case 19
string
Case20
Case 20
string
Case21
Case 21
string
Case22
Case 22
string
Case23
Case 23
string
Case24
Case 24
string
Case25
Case 25
string
Case26
Case 26
string
Case27
Case 27
string
Case28
Case 28
string
Case29
Case 29
string
Case30
Case 30
string
Case31
Case 31
string
Case32
Case 32
string