Difference between revisions of "Logic playerproxy"

From Valve Developer Community
Jump to: navigation, search
(Inputs: SuppressCrosshair was added in either 2009 or 2013, assuming 2009 until verification)
m (Inputs)
Line 19: Line 19:
 
{{IO|DisableCappedPhysicsDamage|Undo effects of EnableCappedPhysicsDamage|since=EP2}}
 
{{IO|DisableCappedPhysicsDamage|Undo effects of EnableCappedPhysicsDamage|since=EP2}}
 
{{IO|SetLocatorTargetEntity|Set the entity that the HUD locator should track. (Usually a vehicle)|param=string|since=EP2}}
 
{{IO|SetLocatorTargetEntity|Set the entity that the HUD locator should track. (Usually a vehicle)|param=string|since=EP2}}
{{IO|SuppressCrosshair|{{portal}} only. Hides the crosshair. {{note|Unlike the command <code>crosshair 0</code>, the crosshair is enabled again when a new game is started or a save made before firing the input is loaded.}}|nofgd=1|since=2009}}
+
{{IO|SuppressCrosshair|Hides the crosshair. {{portal}} only. {{note|Unlike the command <code>crosshair 0</code>, the crosshair is enabled again when a new game is started or a save made before firing the input is loaded.}}|nofgd=1|since=2009}}
 
{{IO|AddPotatosToPortalgun|Change portalgun bodygroup to show PotatOS.|since=P2}}
 
{{IO|AddPotatosToPortalgun|Change portalgun bodygroup to show PotatOS.|since=P2}}
 
{{IO|RemovePotatosFromPortalgun|Change portalgun bodygroup to not show PotatOS.|since=P2}}
 
{{IO|RemovePotatosFromPortalgun|Change portalgun bodygroup to not show PotatOS.|since=P2}}

Revision as of 18:44, 7 March 2019

logic_playerproxy is a point entity available in all Source games.

Entity description

It is used to relay inputs/outputs to the player and back to the world.

Note:Despite this being a base entity, it's not supported in Counter-Strike: Source.

Keyvalues

Targetname:

Name (targetname) <string>
The targetname that other entities refer to this entity by.
Entity Scripts (vscripts) <scriptlist> (in all games since <Left 4 Dead 2>)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since <Left 4 Dead 2>)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call.
Note:Try to avoid expensive operations in this function, as it may cause performance problems.

DamageFilter:

Damage Filter (damagefilter) <targetname>
Name of the filter_damage_type entity that controls which entities can damage us.

Inputs

RequestPlayerHealth
Requests the current player's health from the proxy. This will fire the PlayerHealth output with the value.
SetFlashlightSlowDrain
Puts the player's flashlight in slow-power-drain mode (for Episodic darkness)
SetFlashlightNormalDrain
Puts the player's flashlight to default power drain
SetPlayerHealth <integer>
Sets the player's health to this value.
RequestAmmoState
Request the ammo state of the player. It will fire PlayerHasAmmo or PlayerHasNoAmmo outputs.
LowerWeapon  (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Lowers the players weapon.
EnableCappedPhysicsDamage  (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Cause player to take less damage from physics objects, and never more than 30 points from any individual strike.
DisableCappedPhysicsDamage  (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Undo effects of EnableCappedPhysicsDamage
SetLocatorTargetEntity <string> (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Set the entity that the HUD locator should track. (Usually a vehicle)
SuppressCrosshair  (in all games since <Source><Source>) !FGD
Hides the crosshair. [Portal] only.
Note:Unlike the command crosshair 0, the crosshair is enabled again when a new game is started or a save made before firing the input is loaded.
AddPotatosToPortalgun  (in all games since [Portal 2])
Change portalgun bodygroup to show PotatOS.
RemovePotatosFromPortalgun  (in all games since [Portal 2])
Change portalgun bodygroup to not show PotatOS.
SetDropEnabled <boolean> (in all games since [Portal 2])
Set wether the player is allowed to drop a carried object.
ForceVMGrabController  (in all games since [Portal 2])
Force the player to use the view model grab controller for all objects that are picked up.
ForcePhysicsGrabController  (in all games since [Portal 2])
Force the player to use the physics grab controller for all objects that are picked up.
ResetGrabControllerBehavior  (in all games since [Portal 2])
Resets the grab controller used by the player to its default behavior.
SetMotionBlurAmount <float> (in all games since [Portal 2])
Forces the motion blur effect on the player. Set to <= 0 to disable this override.

Targetname:

Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and its children from the world.
Note:Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than Kill.
AddOutput <string>
Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
KV Format: <key> <value>
I/O Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything depending on the entity. Can also be invoked by firing an output that does not specify an input.
RunScriptFile <script> (in all games since <Left 4 Dead 2>)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since <Left 4 Dead 2>)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Bug: In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
CallScriptFunction <string> (in all games since <Left 4 Dead 2>) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin <coordinates> (in all games since <Alien Swarm>) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since <Alien Swarm>) !FGD
Set this entity's angles.

DamageFilter:

SetDamageFilter <string>
Sets the entity to use as damage filter. Pass in an empty string (no parameter) to clear the damage filter.

Outputs

OnFlashlightOn <float>
Fired when the player turns on his flashlight. This output has the value of how much energy the player had when this happened [0..1].
OnFlashlightOff <float>
Fired when the player turns off his flashlight. This output has the value of how much energy the player had when this happened [0..1].
PlayerHealth <integer>
The player's current health value.
PlayerHasAmmo
Fired by request if the player has any ammo.
PlayerHasNoAmmo
Fired by request if the player doesn't have any ammo.
PlayerMissedAR2AltFire  (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Player fired an AR2 combine ball that didn't kill any enemies.
PlayerDied  (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Fires when the player dies.
OnStartSlowingTime  (in all games since <Alien Swarm>)
Fired when a Portal player initiates slow time.
OnStopSlowingTime  (in all games since <Alien Swarm>)
Fired when a Portal player stops slowing time.
OnPrimaryPortalPlaced  (in all games since [Portal 2])
Fired when a Portal player successfully places the primary portal.
OnSecondaryPortalPlaced  (in all games since [Portal 2])
Fired when a Portal player successfully places the secondary portal.
OnDuck  (in all games since [Portal 2])
Fired when a player starts to duck.
OnUnDuck  (in all games since [Portal 2])
Fired when a player releases the duck button.
OnJump  (in all games since [Portal 2])
Fired when a player jumps.

Targetname:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (only in <Left 4 Dead><Left 4 Dead 2>)
This output fires when the entity is killed and removed from the game.