Difference between revisions of "Give"

From Valve Developer Community
Jump to: navigation, search
(Rewrote the entire article, removing the stupid weapon lists.)
(adding ent_create at the bottom)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
A [[Developer Console|console]] command that gives the player (or, rather, spawns beneath its feet) the entity that is given as the commands parameter (typically of a ''weapon_'', an ''item_'' or an ''item_ammo_'' type).
+
'''<code>give</code>''' is a console command that gives the player (or, rather, spawns beneath their feet) any specified entity.
  
'''Examples:'''
+
This command requires <code>[[sv_cheats]] 1</code> in some games. Valve did not mark this as a cheat in Portal 2, and it allows for some very clever uses in challenge mode.
*In [[Half-Life 2]], "give [[item_suit]]" will give the player the HEV suit.
 
*In [[Counter-Strike: Source]], "give [[weapon_m3]]" will give the player an M3 shotgun.
 
  
The entities available differs greatly depending on the game engine which the command is used in.
+
{{note|Some entities will not work properly with this command because they need to be set up through Hammer.}}
  
This command is a [[sv_cheats|cheat]].
+
{{tip|Using a {{ent|point_servercommand}} entity to <code>give</code> the player something, is usually more reliable than the <code>[[point_template]] ForceSpawn</code> seen in the [[Newgame_spawn]] [[prefab]], because the <code>give</code> command is not bound to a physical place, whereas the <code>point_template</code> will dump entities at the original spawnpoint when {{ent|buildcubemaps}} is fired.{{confirm|This just sounds a little weird?}}}}
  
{{tip|Using a [[point_servercommand]] entity to "''give''" the player something, is usually more reliable than the [[point_template]] ''ForceSpawn'' seen in the [[Newgame_spawn]] [[prefab]], because the ''give'' command is not bound to a physical place, whereas the ''point_template'' will dump entities at the original spawnpoint upon a ''buildcubemaps'' command.}}
+
==Syntax==
 +
<pre>give ENTITY</pre>
  
== See also ==
+
In Half-Life 2, <code>give [[weapon_rpg]]</code> will spawn a rocket launcher under the player (which they will usually immediately pick up).
 
 
* [[:Category:Weapons]] - A list of [[Half-Life 2]] weapons.
 
* [[:Category:Items]] - A list of [[Half-Life 2]] items and ammo.
 
* [[:Category:Counter-Strike:_Source_Entities]] - A list of mostly [[Counter-Strike: Source]] weapons and ammo.
 
  
 +
==See Also==
 +
*{{ent|ent_create}}, a command like <code>give</code>, but things spawn where the player is looking.
 +
*[[:Category:Weapons]] - A list of [[Half-Life 2]] weapons.
 +
*[[:Category:Items]] - A list of [[Half-Life 2]] items and ammo.
 +
*[[:Category:Counter-Strike:_Source_Entities]] - A list of mostly [[Counter-Strike: Source]] weapons and ammo.
  
 
[[Category: Console Commands]]
 
[[Category: Console Commands]]

Latest revision as of 13:26, 14 July 2018

give is a console command that gives the player (or, rather, spawns beneath their feet) any specified entity.

This command requires sv_cheats 1 in some games. Valve did not mark this as a cheat in Portal 2, and it allows for some very clever uses in challenge mode.

Note:Some entities will not work properly with this command because they need to be set up through Hammer.
Tip:Using a point_servercommand entity to give the player something, is usually more reliable than the point_template ForceSpawn seen in the Newgame_spawn prefab, because the give command is not bound to a physical place, whereas the point_template will dump entities at the original spawnpoint when buildcubemaps is fired.
Confirm:This just sounds a little weird?

Syntax

give ENTITY

In Half-Life 2, give weapon_rpg will spawn a rocket launcher under the player (which they will usually immediately pick up).

See Also