Game player equip: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (warning and clarificaiton)
Line 4: Line 4:


==Entity description==
==Entity description==
It spawns one or more [[entity|entities]] at the location of the player. Used in multiplayer games to automatically equip the players with standard gear on map spawn, including a multitude of things like weapons, ammo and items.  In Half-Life 2 single player, this entity must instead be triggered to spawn it's contents with the Use input.  This entity requires a few steps to use properly, first you have to tell it what to equip, and then how.
It spawns one or more [[entity|entities]] at the location of the player. Used in multiplayer games to automatically equip the players with standard gear on map spawn, including a multitude of things like weapons, ammo and items.  In Half-Life 2 single player, this entity must instead be triggered to spawn it's contents with the Use input.  This entity requires a few steps to use properly; first you have to tell it what to equip, and then how.


==== What to equip ====
==== What to equip ====
To properly use the entity, turn [[Hammer_Object_Properties_Dialog#SmartEdit|SmartEdit]] off and add new keyvalues manually. The key name should be the item; the value should be the number of that item to equip. For example, a keyvalue pair of ''[[weapon_ar2]]'' and ''1'' will make the game_player_equip equip the player with 1 Combine assault rifle.
To properly use the entity, turn [[Hammer_Object_Properties_Dialog#SmartEdit|SmartEdit]] off and add new keyvalues manually. The key name should be the item; the value should be the number of that item to equip. For example, a key-value pair of "[[weapon_ar2]]" and "1" will make the game_player_equip equip the player with a pulse rifle.


==== Activation ====
==== Activation ====
In multiplayer, simply having this entity anywhere in a map will automatically activate it every time a player is spawned into the map, for the spawning player. This is not supported in single-player.
In multiplayer, simply having this entity anywhere in a map will automatically activate it every time a player is spawned into the map, for the spawning player. This is not supported in singleplayer.


You can also trigger this entity to spawn with the ''Use'' input, making it spawn at the location of the activating player only. (To prevent a triggerable ''game_player_equip'' from also being activated at player spawn in multiplayer, set the ''Use Only'' flag.) The default .fgd does not contain this input type, so you must manually enter <code>Use</code> into the Input type field instead. Hammer won't register this as a correct input, displaying it in red, but it is correct.
You can also trigger this entity to spawn with the <code>Use</code> input, making it spawn at the location of the activating player only. (To prevent a triggerable game_player_equip from also being activated at player spawn in multiplayer, set the ''Use Only'' flag.) The default .fgd does not contain this input, so you must manually enter <code>Use</code> into the Input field instead. Hammer won't register this as a correct input, displaying it in red, but it is correct.


{{bug|The ''Use'' input has a bug which causes a crash if the activator is NULL. One such situation is when using a ''[[logic_auto]]'' to activate the ''game_player_equip''. For more details see this [http://forums.steampowered.com/forums/showthread.php?p{{=}}15409921#post15409921 forum posting]}}
{{note|Singleplayer games ''only'' support the <code>Use</code> activation method. This makes it only able to be used with entities activated by the player (i.e. the player is the <code>!activator</code> of the I/O chain), such as a [[trigger_once]] or [[func_button]]. Otherwise, the game_player_equip will do nothing.}}
 
{{bug|The <code>Use</code> input has a bug which causes a crash if the activator is NULL. One such situation is when using a [[logic_auto]] to activate the ''game_player_equip''. For more details see this [http://forums.steampowered.com/forums/showthread.php?p{{=}}15409921#post15409921 forum posting]}}


== Keyvalues ==
== Keyvalues ==

Revision as of 21:17, 30 December 2020

game_player_equip

Template:Base point

Entity description

It spawns one or more entities at the location of the player. Used in multiplayer games to automatically equip the players with standard gear on map spawn, including a multitude of things like weapons, ammo and items. In Half-Life 2 single player, this entity must instead be triggered to spawn it's contents with the Use input. This entity requires a few steps to use properly; first you have to tell it what to equip, and then how.

What to equip

To properly use the entity, turn SmartEdit off and add new keyvalues manually. The key name should be the item; the value should be the number of that item to equip. For example, a key-value pair of "weapon_ar2" and "1" will make the game_player_equip equip the player with a pulse rifle.

Activation

In multiplayer, simply having this entity anywhere in a map will automatically activate it every time a player is spawned into the map, for the spawning player. This is not supported in singleplayer.

You can also trigger this entity to spawn with the Use input, making it spawn at the location of the activating player only. (To prevent a triggerable game_player_equip from also being activated at player spawn in multiplayer, set the Use Only flag.) The default .fgd does not contain this input, so you must manually enter Use into the Input field instead. Hammer won't register this as a correct input, displaying it in red, but it is correct.

Note.pngNote:Singleplayer games only support the Use activation method. This makes it only able to be used with entities activated by the player (i.e. the player is the !activator of the I/O chain), such as a trigger_once or func_button. Otherwise, the game_player_equip will do nothing.
Icon-Bug.pngBug:The Use input has a bug which causes a crash if the activator is NULL. One such situation is when using a logic_auto to activate the game_player_equip. For more details see this forum posting  [todo tested in ?]

Keyvalues

Team Master (Obsolete) ([todo internal name (i)]) <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.
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

Flags

  • 1 : Use Only

Template:CSGO add Template:CSGO add

Inputs

TriggerForAllPlayers  (in all games since Counter-Strike: Global Offensive)
Equips all players with weapons specified in keyvalues.
TriggerForActivatedPlayer <classname> (in all games since Counter-Strike: Global Offensive)
This will force the player who activated to equip the specified weapon.
Icon-Bug.pngBug:Spawns the weapon 32x, this can lead to edict crash if used on multiple players at once.  [todo tested in ?]
Note.pngNote:In Insurgency, this input is missing from the entity's code; may have been intentionally removed or not added for some reason.


Outputs

See also