Item ammo crate: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(doesn't mean anything for this entity. that is related to npc makers.)
 
(36 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{lang|Item ammo crate}}
{{LanguageBar|title = item_ammo_crate}}
[[File: item_ammo_crate.png | right | 300px]]
{{CD|CItem_AmmoCrate|file1=item_ammo.cpp}}
[[File:item_ammo_crate_smg1.png|200px||thumb|right|Ammo crate model with [[Weapon smg1|SMG1]] ammo for {{hl2|1}}.]]
[[File:item_ammo_crate_bms.png|200px||thumb|right|Ammo crate model with [[item_grenade_rpg|RPG]] ammo for {{bms|1}}.]]  


{{hl2 point|item_ammo_crate}} This entity places a large crate containing an ''unlimited'' supply of a certain type of ammo (specified by '''Ammo Type'''). The player can open it as many times as desired, by pressing the {{ent|+use}} key ({{key|E}} by default), and get a complete refill of the specified ammo type.
{{this is a|model entity|name=item_ammo_crate|game=Half-Life 2 series|game1=Black Mesa}} This entity places a large crate containing an ''unlimited'' supply of a certain type of ammo (specified by '''Ammo Type'''). The {{ent|player}} can open it as many times as desired, by pressing the {{Ent|+use}} key ({{Key|E}} by default), and get a complete refill of the specified ammo type. Most inputs, outputs and properties are same as [[CBaseAnimating]].


{{Placement Tip|This entity should not be placed in areas with many opponents, since this crate provides the player with a big advantage against any opponents in the area.}}
{{ModernPlacementTip|This entity should not be placed in areas with many opponents, since this crate provides the player with a big advantage against any opponents in the area.}}
{{note|It can be used if it received damage and if player holds {{ent|weapon_crowbar}}. This means that a player can open it with the crowbar or with grenades if holding crowbar, distance doesn't matter.}}


{{code class|CItem_AmmoCrate|item_ammo.cpp}}
__NOTOC__
__TOC__
{{clr}}


==Keyvalues==
==Keyvalues==
{{KV|Ammo Type (AmmoType)|choices|Decides which ammo will be inside the crate.}}
{{KV|Model|intn=model|studio|Model to use for this entity.|only=bms}}
:{| class=standard-table
{{KV|Ammo Type|intn=AmmoType|choices|Decides which ammo will be inside the crate.  
! Literal Value || Ammunition || Functions
|-
| 0 || [[item_ammo_pistol]] || No [Yes (Episode 2)]
|-
| 1 || [[item_ammo_smg1]] || Yes
|-
| 2 || [[item_ammo_ar2]] || Yes
|-
| 3 || [[item_rpg_round]] || Yes
|-
| 4 || [[item_box_buckshot]] || No [Yes (Episode 2)]
|-
| 5 || [[weapon_frag]] || Yes
|-
| 6 || [[item_ammo_357]] || No
|-
| 7 || [[item_ammo_crossbow]] || No
|-
| 8 || [[item_ammo_ar2_altfire]] || Yes
|-
| 9 || [[item_ammo_smg1_grenade]] || No [Yes (Episode 2)]
|}
:{{Warning|Some crate models are missing, so only about half of these settings will work. If the game can't find the model, the crate will not work.}}
{{KV BaseAnimating|base=1}}
{{KV BaseEntity|base=1}}


==Inputs==
{{warning|The [[fgd]] defaults to pistol, which are only available in {{hl2ep2|4}}.}}
{{I BaseAnimating}}
 
{{I BaseEntity|base=1|prel4d=1}}
{{important|Used crate model depends on value from here {{not|{{bms}}}}.}}
 
{{expand|title=Half Life 2 series.|
* {{ent|item_ammo_pistol}} (0) - {{hl2ep2|only}}
 
* {{ent|item_ammo_smg1}} (1)
 
* {{ent|item_ammo_ar2}} (2)
 
* {{ent|item_rpg_round}} (3)
 
* {{ent|item_box_buckshot}} (4) - {{hl2ep2|only}}
 
* {{ent|weapon_frag}} (5)
 
* {{ent|item_ammo_357}} (6) - Uses [[weapon_smg1|SMG]] crate, but provides correct ammo. Can confuse players! Fixed in {{mapbase|4}}.
 
* {{ent|item_ammo_crossbow}} (7) -  Uses SMG crate, but provides correct ammo. Can confuse players! Fixed in {{mapbase|4}}.
 
* {{ent|item_ammo_ar2_altfire}} (8) - Exact same crate as regular AR2 ammo. Can confuse players! Fixed in {{mapbase|4}}.
 
* {{ent|item_ammo_smg1_grenade}} (9) - {{hl2ep2|only}} Different crate model, with grenades inside, but icon is still SMG. Can confuse players!
 
* {{ent|weapon_slam}} (10) - {{mapbase|only}}
 
* Empty (11) - {{mapbase|only}}
 
{{bug|tested={{hl2ep2}}|Not using one of these will result instant crash.}}
}}
 
{{expand|title=Black Mesa.|
* [[item_ammo_glock|9mm Rounds]] (9mm) - ammo type used for {{ent|weapon_mp5}} (main ammo), {{ent|weapon_glock}} and {{ent|weapon_assassin_glock}}.
 
* [[Item ammo 357 (Black Mesa)|357]] (357) - ammo type used for {{ent|weapon_357}}.
 
* [[Item ammo crossbow (Black Mesa)|Bolts]] ([[grenade_bolt|bolt]]) - ammo type used for {{ent|weapon_crossbow}}.
 
* [[Item ammo shotgun|Buckshot]] (buckshot) - ammo type used for {{ent|weapon_shotgun}}.
 
* [[Item ammo energy|Energy]] (energy) - ammo type used for {{ent|weapon_gluon}} and {{ent|weapon_tau}}.
 
* [[Item grenade mp5|MP5 Grenade]] ([[grenade_mp5]]) - ammo type used for {{ent|weapon_mp5}} (secondary ammo).
 
* [[Item grenade rpg|RPG]] ([[grenade_rpg]]) - ammo type used for {{ent|weapon_rpg}}.
 
* [[Item weapon frag|Frag Grenades]] ([[grenade_frag]]) - ammo type used for {{ent|weapon_frag}}.
 
* [[Item weapon satchel|Satchels]] ([[grenade_satchel]]) - ammo type used for {{ent|weapon_satchel}}.
 
* [[Item weapon tripmine|Tripmines]] ([[grenade_tripmine]]) - ammo type used for {{ent|weapon_tripmine}}.
 
* [[Item weapon snark|Snark]] ([[npc_snark|snark]]) - not in [[FGD]], ammo type used for {{ent|weapon_snark}}.
 
* [[Item weapon hivehand|Hornet]] ([[grenade_hornet]]) - not in [[FGD]], ammo type used for {{ent|weapon_hivehand}}.
 
* {{w|.50 BMG}} (50cal) - not in [[FGD]], not used for any of the weapons that can be picked up by the player by default.
 
* [[npc_sentry_ground|Sentry]] (sentry) - not in [[FGD]],  not used for any of the weapons that can be picked up by the player by default.
 
* Sniper Round (SniperRound) - not in [[FGD]], not used for any of the weapons that can be picked up by the player by default.
 
* Sniper Penetrated Round (SniperPenetratedRound) - not in [[FGD]], not used for any of the weapons that can be picked up by the player by default.
 
{{note|Not using one of these will result entity disappear.}}
{{bug|hidetested=1|Player will not get a new weapon ({{ent|weapon_tripmine}}, {{ent|weapon_satchel}}, {{ent|weapon_frag}} or {{ent|weapon_snark}}) if didn't pick up it before. Interaction with this entity adds the ammo amount, but not giving anything.}}
}}
 
}}
{{KV|CanMove|intn=isdynamicmoving|bool|Doesn't work. Mentioned only once in ''bm_c4a4a''. It was probably planned to provide movement to the crate for one of the rooms.|only=bms}}
{{KV|Ammo Count|intn=ammocount|integer|Amount of specified ammo to give.|only=bms}}


==Outputs==
==Outputs==
{{IO|OnUsed|Fires when <code>+use</code>d by the player.}}
{{O|OnUsed|activator = the player that used this|Fires when [[+use|used]] by the player.}}
{{O BaseAnimating}}
{{O BaseEntity}}


==See also==
==See also==

Latest revision as of 05:57, 2 August 2025

English (en)Translate (Translate)
C++ Class hierarchy
CItem_AmmoCrate
CBaseAnimating
CBaseEntity
C++ item_ammo.cpp
Ammo crate model with SMG1 ammo for Half-Life 2.
Ammo crate model with RPG ammo for Black Mesa.

item_ammo_crate is a model entity available in Half-Life 2 series Half-Life 2 series and Black Mesa Black Mesa. This entity places a large crate containing an unlimited supply of a certain type of ammo (specified by Ammo Type). The player can open it as many times as desired, by pressing the +use key (E by default), and get a complete refill of the specified ammo type. Most inputs, outputs and properties are same as CBaseAnimating.

PlacementTip.gifPlacement Tip:This entity should not be placed in areas with many opponents, since this crate provides the player with a big advantage against any opponents in the area.
Note.pngNote:It can be used if it received damage and if player holds weapon_crowbar. This means that a player can open it with the crowbar or with grenades if holding crowbar, distance doesn't matter.


Keyvalues

Model (model) <model path> (only in Black Mesa)
Model to use for this entity.
Ammo Type (AmmoType) <choices>
Decides which ammo will be inside the crate.
Warning.pngWarning:The fgd defaults to pistol, which are only available in Half-Life 2: Episode Two Half-Life 2: Episode Two.
Icon-Important.pngImportant:Used crate model depends on value from here (not in Black Mesa).
Half Life 2 series.
  • item_ammo_smg1_grenade (9) - (only in Half-Life 2: Episode Two) Different crate model, with grenades inside, but icon is still SMG. Can confuse players!
  • Empty (11) - (only in Mapbase)
Icon-Bug.pngBug:Not using one of these will result instant crash.  (tested in: Half-Life 2: Episode Two)
Black Mesa.
  • Wikipedia icon .50 BMG (50cal) - not in FGD, not used for any of the weapons that can be picked up by the player by default.
  • Sentry (sentry) - not in FGD, not used for any of the weapons that can be picked up by the player by default.
  • Sniper Round (SniperRound) - not in FGD, not used for any of the weapons that can be picked up by the player by default.
  • Sniper Penetrated Round (SniperPenetratedRound) - not in FGD, not used for any of the weapons that can be picked up by the player by default.
Note.pngNote:Not using one of these will result entity disappear.
Icon-Bug.pngBug:Player will not get a new weapon (weapon_tripmine, weapon_satchel, weapon_frag or weapon_snark) if didn't pick up it before. Interaction with this entity adds the ammo amount, but not giving anything.
CanMove (isdynamicmoving) <boolean> (only in Black Mesa)
Doesn't work. Mentioned only once in bm_c4a4a. It was probably planned to provide movement to the crate for one of the rooms.
Ammo Count (ammocount) <integer> (only in Black Mesa)
Amount of specified ammo to give.

Outputs

OnUsed
!activator = the player that used this
!caller = this entity
Fires when used by the player.

See also