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
m (Nesciuse moved page Hl2 gamerules/en to Hl2 gamerules without leaving a redirect: Move en subpage to basepage)
(-added class hierarchy, cleanup, not sure what this utilized for in hl2 and portal)
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{Ent not in fgd|except={{mapbase}}|nolink=1|smalltext=}}
{{Mapbase topicon}}
{{Mapbase topicon}}
[[File:Icon HL2 full.png|left|link=]]
[[File:Icon HL2 full.png|left|link=]]
{{this is a|point entity|name=hl2_gamerules|game=Mapbase}}
{{CD|CHalfLife2Proxy|file1=1}}
{{This is a|point entity|name=hl2_gamerules|game=Half-Life 2 series|game1=Portal series|game2=Mapbase}} Proxy entity for HL2 Gamerules.
{{confirm|seems unused as an entity in hl2 and portal}}


Proxy entity for HL2 Gamerules.
{{clr-left}}


==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.}}
{{KV|Default Citizen Type|intn=DefaultCitizenType|choices|Overrides the default citizen type.}}
{{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|Stunstick Pickup Behavior|intn=SetStunstickPickupBehavior|choices|Controls how stunsticks should react to being touched by the player.}}
{{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.}}


==Inputs==
=== Only {{mapbase|4}} ===
{{IO|RunScriptFile|param=string|Execute a game script file from disk.}}
{{KV|Default Citizen Type|intn=DefaultCitizenType|choices|Overrides the default citizen type.
{{IO|RunScriptCode|param=string|Execute a string of script source code.}}
:*0 : "None"
{{IO|RunScriptCodeQuotable|param=string|Execute a string of script source code which converts double apostrophes ('') to quotation marks for strings.}}
:*1 : "Downtrodden"
{{IO|CallScriptFunction|param=string|Call a named function from this entity's Activation Script.}}
:*2 : "Refugee"
{{IO|RunScriptFile|param=string|Execute a game script file from disk.}}
:*3 : "Rebel"
{{IO|ClearScriptScope|Clears this entity's script scope.}}
:*4 : "Unique"
{{IO|Kill|Removes this entity from the world.}}
}}
{{IO|KillHierarchy|Removes this entity and all its children from the world.}}
{{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.}}
{{IO|KillIfNotVisible|Removes this entity if it is not in a player's viewcone.}}
{{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.
{{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.}}
:*"" : "Default"
{{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.}}
:*0 : "No"
{{IO|ChangeVariable|param=string|Similar to AddOutput, except it changes an internal variable similar to logic_datadesc_accessor instead. Very dangerous, use with care.}}
:*1 : "Yes"
{{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.}}
{{KV|Stunstick Pickup Behavior|intn=SetStunstickPickupBehavior|choices|Controls how stunsticks should react to being touched by the player.
{{IO|PassUser3|param=string|Causes this entity's OutUser3 output to be fired. Can pass any parameter.}}
:*0 : "Only apply energy and disappear (default)"
{{IO|PassUser4|param=string|Causes this entity's OutUser4 output to be fired. Can pass any parameter.}}
:*1 : "Allow pickup, apply energy if already owned"
{{IO|FireRandomUser|Fires OnUser1, OnUser2, OnUser3, or OnUser4 with a 25% chance of each.}}
:*2 : "Don't apply energy and don't allow pickup"
{{IO|PassRandomUser|param=string|Fires OutUser1, OutUser2, OutUser3, or OutUser4 with a 25% chance of each. Can pass any parameter.}}
:*3 : "Allow pickup, but never apply energy"
{{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.}}
{{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.}}
{{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==
== Inputs ==
{{IO|OnKilled|Fires when this entity is removed with the 'Kill' input.}}
=== Only {{mapbase|4}} ===
{{IO|OnUser1|Fires in response to FireUser1 input.}}
{{I|DefaultCitizenType|param=integer|Sets the default citizen type.}}
{{IO|OnUser2|Fires in response to FireUser2 input.}}
{{I|SetPlayerSquadAutosummon|param=bool|Sets player squad autosummon.}}
{{IO|OnUser3|Fires in response to FireUser3 input.}}
{{I|SetLegacyFlashlight|param=bool|Sets legacy flashlight.}}
{{IO|OnUser4|Fires in response to FireUser4 input.}}
{{I|SetStunstickPickupBehavior|param=bool|Sets stunstick pickup behavior.}}
{{IO|OutUser1|param=string|Fires in response to PassUser1 input. Can pass any parameter.}}
{{I|SetAllowSPRespawn|param=bool|Sets SP respawning.}}
{{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.}}
== See also ==
{{IO|OutUser4|param=string|Fires in response to PassUser4 input. Can pass any parameter.}}__NOTOC__
* [https://github.com/mapbase-source/source-sdk-2013/blob/7976a21b51aee121c3944c85a7d94571a56fe45a/sp/src/game/shared/hl2/hl2_gamerules.cpp Mapbase definition]

Revision as of 13:13, 14 April 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 point entity available in Half-Life 2 series Half-Life 2 series, Portal series Portal series, and Mapbase Mapbase. Proxy entity for HL2 Gamerules.

Confirm:seems unused as an entity in hl2 and portal


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