This article's documentation is for anything that uses the Source engine. Click here for more information.

Game player equip: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(its position in the world irrelevant so it's logical entity)
 
(57 intermediate revisions by 27 users not shown)
Line 1: Line 1:
{{wrongtitle|title=game_player_equip}}
{{LanguageBar}}
{{TabsBar|main=gs|base=game_player_equip}}
{{CD|CGamePlayerEquip|file1=1}}
{{this is a|logical entity|name=game_player_equip}}


==Entity Description==
__TOC__
This is the entity used to equip the player with a multitude of things like weapons, ammo, and items. The entity requires a few steps to use properly. First you have to tell it what to equip, and then how.


To properly use the entity you have to turn smart edit off, now you can add a new keyvalue. The name should be the item, say [[weapon_ar2]]. Then the value should be the number of them, say 1. Now the game_player_equip wil equip 1 combine assualt rifle.
== 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 its 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.
{{important|In multiplayer of {{bms|4}} player will spawn with no ammo if this entity is placed on a map.}}


To get the game_player_equip to equip you have 2 ways of doing it. Simply leaving it where you palce it, then it will equip when the player runs over it, like picking it up. Or triggering it, to do this go over to the flags and check Use Only. Now set up a [[trigger_multiple]] to equip it. A problem occurs in that the defualt .fgd does not contain the correct trigger, simply type in '''Use''' instead. Hammer wont like it, but it is correct.
==== 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 key-value pair of "[[weapon_ar2]]" and "1" will make the game_player_equip equip the player with a pulse rifle.
{{bug|Number in value doesn't work in {{bms|4}} via I/O. It works only with player spawn in multiplayer.|hidetested=1}}


==Keyvalues==
==== 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.


* {{kv targetname}}
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.


* '''Team Master(Obsolete)'''
{{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.}}
: <string> Simply included for HL1 support and should be ignored


==Flags==
{{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''.
{{workaround|Using a [[trigger_once]] on the player's spawn position activated by the logic_auto entity negates this issue.}}
}}


* '''Use Only'''
== Keyvalues ==
: Makes it so that the entity is only triggered and cannot be picked up.
{{KV Targetname}}
{{KV|Team Master (Obsolete)|string|intn=master|Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.}}


==Inputs==
== Flags ==
{{fl|1|Use Only}}
{{fl|2|Strip All Weapons First|In {{csgo|4}} also removes armor and [[item_heavyassaultsuit|heavyarmor]]. It doesn't in {{bms|4}}.|since={{csgo}}|also={{bms}}}}
{{fl|4|Strip the player's suit|only={{bms}}}}
{{fl|4|Only Strip Same Weapon Type|since={{csgo}}}}


* '''Kill'''
== Inputs ==
: Removes this entity from the world.  
{{I|TriggerForAllPlayers|Equips all players with weapons specified in keyvalues.|since={{csgo}}|also={{bms}}}}
{{I|TriggerForActivatedPlayer|This will force the player who activated to equip the specified weapon.|param=classname|since={{csgo}}}}
{{bug|Spawns the weapon 32x, this can lead to edict crash if used on multiple players at once.}}
{{Note|In {{insurgency}}, this input is missing from the entity's code; may have been intentionally removed or not added for some reason.}}


* '''KillHierarchy'''
== See also ==
: Removes this entity and all its children from the world.
* [[List of entities#Weapon entities|Weapons]]
 
* [[List of entities#Item entities|Items]]
* '''AddOutput <string>'''
: Adds an entity I/O connection to this entity. Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>. Very dangerous, use with care.
 
* '''FireUser1-4'''
: Causes this entity's OnUser1-4 outputs to be fired. See [[User Inputs and Outputs]].
 
* '''Use'''
: This is used in conjution with the Use Only flag to make it triggered. Its not included in the .fgd and Hammer will tell you its wrong, but its not.
 
==Outputs==
 
* {{o targetname}}
 
==See Also==
 
* [[List of entities#Weapon Entites]]
 
* [[List of entities#Item Entities]]
[[Category:Entities]]

Latest revision as of 05:18, 29 April 2025

English (en)Translate (Translate)
C++ Class hierarchy
CGamePlayerEquip
CRulePointEntity
CRuleEntity
CBaseEntity
C++ maprules.cpp

game_player_equip is a logical entity available in all Source Source games.

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 its 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.

Icon-Important.pngImportant:In multiplayer of Black Mesa Black Mesa player will spawn with no ammo if this entity is placed on a map.

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.

Icon-Bug.pngBug:Number in value doesn't work in Black Mesa Black Mesa via I/O. It works only with player spawn in multiplayer.

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.
PlacementTip.pngWorkaround:Using a trigger_once on the player's spawn position activated by the logic_auto entity negates this issue.
  [todo tested in ?]

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

Team Master (Obsolete) (master) <string>
Legacy support: The name of a master entity. If the master hasn't been activated, this entity will not activate.

Flags

Use Only : [1]
Strip All Weapons First : [2] (in all games since Counter-Strike: Global Offensive) (also in Black Mesa)
In Counter-Strike: Global Offensive Counter-Strike: Global Offensive also removes armor and heavyarmor. It doesn't in Black Mesa Black Mesa.
Strip the player's suit : [4] (only in Black Mesa)
Only Strip Same Weapon Type : [4] (in all games since Counter-Strike: Global Offensive)

Inputs

TriggerForAllPlayers  (in all games since Counter-Strike: Global Offensive) (also in Black Mesa)
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.

See also