This article relates to the game "Mapbase". Click here for more information.

Hl2 gamerules: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Language subpage}}
{{LanguageBar}}
Proxy entity for HL2 Gamerules.
{{Ent not in fgd|except={{mapbase}}|nolink=1|smalltext=}}
{{clr-left}}
{{Mapbase topicon}}
[[File:Icon HL2 full.png|left|link=]]
{{CD|CHalfLife2Proxy|file1=1}}
{{This is a|logical entity|name=hl2_gamerules|game=Half-Life 2 series|game1=Portal series|game2=Mapbase}} Proxy entity for HL2 Gamerules.
{{note|While this entity exists in stock {{hl2}} and {{portal}}, it is mostly used by the engine internally and doesn't have any uses for mapmakers. In {{mapbase}}, the developers expanded its functionality by taking inspiration from more modern versions of Source.}}


==Keyvalues==
==Keyvalues==
{{KV|Name|intn=targetname|target_source|The name that other entities refer to this entity by.}}
{{KV Targetname}}
{{KV|Entity Scripts|intn=vscripts|string|Name(s) of script files that are executed after all entities have spawned.}}
 
{{KV|Script think function|intn=thinkfunction|string|Name of a function in this entity's script scope which will be called automatically.}}
===Only {{mapbase|4}}===
{{KV|Default Citizen Type|intn=DefaultCitizenType|choices|Overrides the default citizen type.}}
{{KV|Default Citizen Type|intn=DefaultCitizenType|choices|Overrides the default citizen type.
*None
:*0 : "None"
*Downtrodden
:*1 : "Downtrodden"
*Refugee
:*2 : "Refugee"
*Rebel
:*3 : "Rebel"
*Unique
:*4 : "Unique"
{{KV|Player Squad Autosummon Allowed|intn=SetPlayerSquadAutosummon|choices|Sets whether citizens are allowed to automatically follow the player again when they're at a command point and left alone for a while.}}
}}
{{KV|Legacy Flashlight|intn=SetLegacyFlashlight|choices|Sets whether to use the original ''HL2'' and ''Episode One'' flashlight instead of ''Episode Two'''s. 'Default' doesn't change anything.}}
{{KV|Player Squad Autosummon Allowed|intn=SetPlayerSquadAutosummon|boolean|Sets whether citizens are allowed to automatically follow the player again when they're at a command point and left alone for a while.}}
{{KV|Stunstick Pickup Behavior|intn=SetStunstickPickupBehavior|choices|Controls how stunsticks should react to being touched by the player.}}
{{KV|Legacy Flashlight|intn=SetLegacyFlashlight|choices|Sets whether to use the original ''HL2'' and ''Episode One'' flashlight instead of ''Episode Two'''s. 'Default' doesn't change anything.
{{KV|Allow SP respawn|intn=SetAllowSPRespawn|choices|Allows players to respawn in singleplayer instead of being forced to reload the last save upon dying. Use OnPlayerSpawn in logic_playerproxy to fire an output each time the player respawns.}}
:*"" : "Default"
:*0 : "No"
:*1 : "Yes"
}}
{{KV|Stunstick Pickup Behavior|intn=SetStunstickPickupBehavior|choices|Controls how stunsticks should react to being touched by the player.
:*0 : "Only apply energy and disappear (default)"
:*1 : "Allow pickup, apply energy if already owned"
:*2 : "Don't apply energy and don't allow pickup"
:*3 : "Allow pickup, but never apply energy"
}}
{{KV|Allow SP respawn|intn=SetAllowSPRespawn|boolean|Allows players to respawn in singleplayer instead of being forced to reload the last save upon dying. Use OnPlayerSpawn in logic_playerproxy to fire an output each time the player respawns.}}


==Inputs==
==Inputs==
{{IO|RunScriptFile|param=string|Execute a game script file from disk.}}
===Only {{mapbase|4}}===
{{IO|RunScriptCode|param=string|Execute a string of script source code.}}
{{I|DefaultCitizenType|param=integer|Sets the default citizen type.}}
{{IO|RunScriptCodeQuotable|param=string|Execute a string of script source code which converts double apostrophes ('') to quotation marks for strings.}}
{{I|SetPlayerSquadAutosummon|param=bool|Sets player squad autosummon.}}
{{IO|CallScriptFunction|param=string|Call a named function from this entity's Activation Script.}}
{{I|SetLegacyFlashlight|param=bool|Sets legacy flashlight.}}
{{IO|RunScriptFile|param=string|Execute a game script file from disk.}}
{{I|SetStunstickPickupBehavior|param=bool|Sets stunstick pickup behavior.}}
{{IO|ClearScriptScope|Clears this entity's script scope.}}
{{I|SetAllowSPRespawn|param=bool|Sets SP respawning.}}
{{IO|Kill|Removes this entity from the world.}}
{{IO|KillHierarchy|Removes this entity and all its children from the world.}}
{{IO|KillIfNotVisible|Removes this entity if it is not in a player's viewcone.}}
{{IO|KillWhenNotVisible|param=float|Removes this entity when it is not in a player's viewcone. You can pass a time for when this should start.}}
{{IO|AddOutput|param=string|Adds an entity I/O connection or a keyvalue to this entity. Format: '<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>'. You could also use it on regular keyvalues: '<key name> <key value>'. Very dangerous, use with care.}}
{{IO|ChangeVariable|param=string|Similar to AddOutput, except it changes an internal variable similar to logic_datadesc_accessor instead. Very dangerous, use with care.}}
{{IO|PassUser1|param=string|Causes this entity's OutUser1 output to be fired. Can pass any parameter.}}
{{IO|PassUser2|param=string|Causes this entity's OutUser2 output to be fired. Can pass any parameter.}}
{{IO|PassUser3|param=string|Causes this entity's OutUser3 output to be fired. Can pass any parameter.}}
{{IO|PassUser4|param=string|Causes this entity's OutUser4 output to be fired. Can pass any parameter.}}
{{IO|FireRandomUser|Fires OnUser1, OnUser2, OnUser3, or OnUser4 with a 25% chance of each.}}
{{IO|PassRandomUser|param=string|Fires OutUser1, OutUser2, OutUser3, or OutUser4 with a 25% chance of each. Can pass any parameter.}}
{{IO|FireOutput|param=string|Fires the named output on this entity. Format: '<output name>:<activator>:<caller>:<parameter>:<delay>' (OnDeath:hl3cardgame:gaben). Everything beyond the output name is optional.}}
{{IO|RemoveOutput|param=string|Removes all instances of the named output on this entity. Wildcards are supported, meaning you could just pass '*' to wipe all outputs from this entity.}}
{{IO|AcceptInput|param=string|Fires the named input on this entity. Format: '<input name>:<parameter>:<activator>:<caller>:<output ID>' (SetTarget:cheese). Everything beyond the input name is optional. Mind the fact this is arranged differently from FireOutput, having the parameter right after the input name.}}
{{IO|CancelPending|Cancels any events fired by this entity that are currently pending in the I/O event queue.}}
{{IO|SetLocalOrigin|param=vector|Sets this entity's origin in local space, relative to its parent if one exists. Otherwise relative to the world.}}
{{IO|SetAbsOrigin|param=vector|Sets this entity's origin in the map, always relative to the world origin.}}
{{IO|SetLocalVelocity|param=vector|Sets this entity's current velocity.}}
{{IO|SetLocalAngularVelocity|param=vector|Sets this entity's current angular velocity.}}
{{IO|AddSpawnFlags|param=integer|Adds spawnflag(s) to this entity. Many spawnflags have their respective numbers suffixed in this FGD.}}
{{IO|RemoveSpawnFlags|param=integer|Removes spawnflag(s) from this entity. Many spawnflags have their respective numbers suffixed in this FGD.}}
{{IO|AddSolidFlags|param=integer|Adds solid flags to this entity.}}
{{IO|RemoveSolidFlags|param=integer|Removes solid flags from this entity.}}
{{IO|SetHealth|param=integer|Sets this entity's health.}}
{{IO|AddHealth|param=integer|Adds to this entity's health.}}
{{IO|RemoveHealth|param=integer|Removes from this entity's health.}}
{{IO|SetMaxHealth|param=integer|Sets this entity's max health.}}
{{IO|SetEntityName|param=target_destination|Sets this entity's name that other entities should refer to it by.}}
{{IO|SetTarget|param=target_destination|Sets this entity's target. This is specific to certain entities, particularly logic entities that involve a target.}}
{{IO|SetOwnerEntity|param=target_destination|Sets this entity's owner entity. This has nothing to do with parenting and has more to do with collision and kill credits.}}
{{IO|SetThinkNull|Sets this entity's general think function to null. Behavior varies from entity to entity.}}
{{IO|Use|More or less replicates the player interacting with an entity. (+USE)}}
{{IO|Touch|param=target_destination|Simulates this entity touching the specified entity.}}
{{IO|DefaultCitizenType|param=integer|Sets the default citizen type.}}
{{IO|SetPlayerSquadAutosummon|param=bool|Sets player squad autosummon.}}
{{IO|SetLegacyFlashlight|param=bool|Sets legacy flashlight.}}
{{IO|SetStunstickPickupBehavior|param=bool|Sets stunstick pickup behavior.}}
{{IO|SetAllowSPRespawn|param=bool|Sets SP respawning.}}


==Outputs==
==See also==
{{IO|OnKilled|Fires when this entity is removed with the 'Kill' input.}}
* [https://github.com/mapbase-source/source-sdk-2013/blob/7976a21b51aee121c3944c85a7d94571a56fe45a/sp/src/game/shared/hl2/hl2_gamerules.cpp Mapbase definition]
{{IO|OnUser1|Fires in response to FireUser1 input.}}
{{IO|OnUser2|Fires in response to FireUser2 input.}}
{{IO|OnUser3|Fires in response to FireUser3 input.}}
{{IO|OnUser4|Fires in response to FireUser4 input.}}
{{IO|OutUser1|param=string|Fires in response to PassUser1 input. Can pass any parameter.}}
{{IO|OutUser2|param=string|Fires in response to PassUser2 input. Can pass any parameter.}}
{{IO|OutUser3|param=string|Fires in response to PassUser3 input. Can pass any parameter.}}
{{IO|OutUser4|param=string|Fires in response to PassUser4 input. Can pass any parameter.}}

Latest revision as of 03:11, 14 August 2025

English (en)Translate (Translate)
Icon-NotInFGD.png
This entity is not in the FGD by default, except in Mapbase.

Icon HL2 full.png
C++ Class hierarchy
CHalfLife2Proxy
CGameRulesProxy
CBaseEntity
C++ hl2_gamerules.cpp

hl2_gamerules is a logical entity available in Half-Life 2 series Half-Life 2 series, Portal series Portal series, and Mapbase Mapbase. Proxy entity for HL2 Gamerules.

Note.pngNote:While this entity exists in stock Half-Life 2 and Portal, it is mostly used by the engine internally and doesn't have any uses for mapmakers. In Mapbase, the developers expanded its functionality by taking inspiration from more modern versions of Source.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Only Mapbase Mapbase

Default Citizen Type (DefaultCitizenType) <choices>
Overrides the default citizen type.
  • 0 : "None"
  • 1 : "Downtrodden"
  • 2 : "Refugee"
  • 3 : "Rebel"
  • 4 : "Unique"
Player Squad Autosummon Allowed (SetPlayerSquadAutosummon) <boolean>
Sets whether citizens are allowed to automatically follow the player again when they're at a command point and left alone for a while.
Legacy Flashlight (SetLegacyFlashlight) <choices>
Sets whether to use the original HL2 and Episode One flashlight instead of Episode Two's. 'Default' doesn't change anything.
  • "" : "Default"
  • 0 : "No"
  • 1 : "Yes"
Stunstick Pickup Behavior (SetStunstickPickupBehavior) <choices>
Controls how stunsticks should react to being touched by the player.
  • 0 : "Only apply energy and disappear (default)"
  • 1 : "Allow pickup, apply energy if already owned"
  • 2 : "Don't apply energy and don't allow pickup"
  • 3 : "Allow pickup, but never apply energy"
Allow SP respawn (SetAllowSPRespawn) <boolean>
Allows players to respawn in singleplayer instead of being forced to reload the last save upon dying. Use OnPlayerSpawn in logic_playerproxy to fire an output each time the player respawns.

Inputs

Only Mapbase Mapbase

DefaultCitizenType <integerRedirectInput/integer>
Sets the default citizen type.
SetPlayerSquadAutosummon <booleanRedirectInput/boolean>
Sets player squad autosummon.
SetLegacyFlashlight <booleanRedirectInput/boolean>
Sets legacy flashlight.
SetStunstickPickupBehavior <booleanRedirectInput/boolean>
Sets stunstick pickup behavior.
SetAllowSPRespawn <booleanRedirectInput/boolean>
Sets SP respawning.

See also