Weapon item spawn: Difference between revisions
Jump to navigation
Jump to search
Note:Similarly to info_null, this entity is removed immediately as it spawns with the difference that in this case it first spawns a randomly chosen
No edit summary |
(Miscellaneous improvements) |
||
| Line 1: | Line 1: | ||
{{LanguageBar}} | {{LanguageBar}} | ||
{{CD|CMultiSpawner}} | {{CD|CMultiSpawner}} | ||
{{this is a|point entity|name=weapon_item_spawn|game=Left 4 Dead 2}} It is a spawn point for any available item, except [[upgrade_spawn|weapon upgrades]]. | {{this is a|point entity|name=weapon_item_spawn|game=Left 4 Dead 2}} It is a spawn point for any available item, except [[upgrade_spawn|weapon upgrades]]. The spawned item is automatically placed on the ground below. | ||
{{ | {{Note|Similarly to {{ent|info_null}}, this entity is removed immediately as it spawns with the difference that in this case it first spawns a randomly chosen {{code|weapon_*_spawn}} entity based on how its keyvalues were setup.}} | ||
__NOTOC__ | __NOTOC__ | ||
== Keyvalues == | == Keyvalues == | ||
{{KV Targetname}} | {{KV Targetname}} | ||
:{{ | :{{Important|If you want to use this item position only in a specific gamemode, for example coop, then you must use {{ent|point_template}} and fire ForceSpawn to it from {{ent|info_gamemode}}'s OnCoop output. Attempting to do it the other way around, like sending the Kill input to this entity in OnVersus, won't work because this entity is, upon spawning, immediately converted to one of the specific weapon_*_spawn entities that were picked and targetname isn't transferred.}} | ||
{{KV Angles|Angles of the spawned weapon | {{KV Angles|Angles of the spawned item/weapon.}} | ||
{{KV|Weapon Skin|intn=weaponskin|integer|Some weapons have multiple versions of their textures, called skins. Set this to a number other than -1 to make the given weapon use that skin instead of the default.}} | |||
{{KV|Glow Range|intn=glowrange|float|Set a custom glow range for this spawner. 0 means use the default range.}} | |||
{{ColumnBox|count=2| | {{ColumnBox|count=2|{{KV|Ammo pile|intn=item1|bool}} | ||
{{KV|Ammo pile|intn=item1|bool}} | |||
{{KV|First aid kit|intn=item2|bool}} | {{KV|First aid kit|intn=item2|bool}} | ||
{{KV|Molotov Cocktail|intn=item3|bool}} | {{KV|Molotov Cocktail|intn=item3|bool}} | ||
{{KV|Pain Pills | {{KV|Pain Pills|intn=item4|bool}} | ||
{{KV|Pipe Bomb | {{KV|Pipe Bomb|intn=item5|bool}} | ||
{{KV|Oxygen Tank | {{KV|Oxygen Tank|intn=item6|bool}} | ||
{{KV|Propane Tank | {{KV|Propane Tank|intn=item7|bool}} | ||
{{KV|Gasoline Can | {{KV|Gasoline Can|intn=item8|bool}} | ||
{{KV|Adrenaline | {{KV|Adrenaline|intn=item11|bool}} | ||
{{KV|Defibrillator | {{KV|Defibrillator|intn=item12|bool}} | ||
{{KV|Boomer Bile | {{KV|Boomer Bile|intn=item13|bool}} | ||
{{KV|Chainsaw | {{KV|Chainsaw|intn=item16|bool}} | ||
{{KV|Grenade Launcher|intn=item17|bool}} | {{KV|Grenade Launcher|intn=item17|bool}} | ||
{{KV|M60 Machinegun | {{KV|M60 Machinegun|intn=item18|bool}}}} | ||
}} | |||
:Random item from all booleans set to 1 is considered for spawn. | :Random item from all booleans set to 1 is considered for spawn. | ||
{{KV|Melee Weapon|intn=melee_weapon|string|If empty, the director won't consider spawning a melee in this place. If potentially spawning is desired, use the names listed below, like in the {{ent|weapon_melee_spawn}} entity: | |||
{{KV|Melee Weapon | |||
{{ColumnBox|count=2| | {{ColumnBox|count=2| | ||
:* | :* {{code|baseball_bat}} | ||
:* | :* {{code|cricket_bat}} | ||
:* | :* {{code|crowbar}} | ||
:* | :* {{code|electric_guitar}} | ||
:* | :* {{code|fireaxe}} | ||
:* | :* {{code|frying_pan}} | ||
:* | :* {{code|golfclub}} | ||
:* | :* {{code|katana}} | ||
:* | :* {{code|knife}} | ||
:* | :* {{code|machete}} | ||
:* | :* {{code|pitchfork}} | ||
:* | :* {{code|shovel}} | ||
:* | :* {{code|tonfa}} | ||
:* {{code|Any}} – director will place any available melee weapon | |||
:You may also list multiple specific melee weapons separated by a comma, and the director will select from among that subset of weapons: | }} | ||
:You may also list multiple specific melee weapons separated by a comma, and the director will select from among that subset of weapons: {{code|crowbar,fireaxe,machete}}.}} | |||
== Flags == | == Flags == | ||
{{ | {{Fl|1|Enable Physics on spawned item}} | ||
{{ | {{Fl|2|Spawned Item Must Exist}} | ||
{{ | {{Fl|8|Infinite Items}} | ||
== Editing the [[FGD]] (Optional) == | == Editing the [[FGD]] (Optional) == | ||
| Line 95: | Line 92: | ||
* {{ent|weapon_adrenaline_spawn}} | * {{ent|weapon_adrenaline_spawn}} | ||
* {{ent|weapon_defibrillator_spawn}} | * {{ent|weapon_defibrillator_spawn}} | ||
* {{ent|weapon_vomitjar_spawn}} | |||
* {{ent|weapon_chainsaw_spawn}} | * {{ent|weapon_chainsaw_spawn}} | ||
* {{ent|weapon_grenade_launcher_spawn}} | * {{ent|weapon_grenade_launcher_spawn}} | ||
* {{ent|weapon_rifle_m60_spawn}} | * {{ent|weapon_rifle_m60_spawn}} | ||
* {{ent|weapon_melee_spawn}} | * {{ent|weapon_melee_spawn}} | ||
Revision as of 16:37, 3 November 2025
| CMultiSpawner |
weapon_item_spawn is a point entity available in
Left 4 Dead 2. It is a spawn point for any available item, except weapon upgrades. The spawned item is automatically placed on the ground below.
weapon_*_spawn entity based on how its keyvalues were setup.Keyvalues
- Name (targetname) <string>
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentnameortarget).
Also displayed in Hammer's 2D views and Entity Report. - See also: Generic Keyvalues, Inputs and Outputs available to all entities
Important:If you want to use this item position only in a specific gamemode, for example coop, then you must use point_template and fire ForceSpawn to it from info_gamemode's OnCoop output. Attempting to do it the other way around, like sending the Kill input to this entity in OnVersus, won't work because this entity is, upon spawning, immediately converted to one of the specific weapon_*_spawn entities that were picked and targetname isn't transferred.
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
- Angles of the spawned item/weapon.
- Weapon Skin (weaponskin) <integer>
- Some weapons have multiple versions of their textures, called skins. Set this to a number other than -1 to make the given weapon use that skin instead of the default.
- Glow Range (glowrange) <float>
- Set a custom glow range for this spawner. 0 means use the default range.
- Ammo pile (item1) <boolean>
- First aid kit (item2) <boolean>
- Molotov Cocktail (item3) <boolean>
- Pain Pills (item4) <boolean>
- Pipe Bomb (item5) <boolean>
- Oxygen Tank (item6) <boolean>
- Propane Tank (item7) <boolean>
- Gasoline Can (item8) <boolean>
- Adrenaline (item11) <boolean>
- Defibrillator (item12) <boolean>
- Boomer Bile (item13) <boolean>
- Chainsaw (item16) <boolean>
- Grenade Launcher (item17) <boolean>
- M60 Machinegun (item18) <boolean>
- Random item from all booleans set to 1 is considered for spawn.
- Melee Weapon (melee_weapon) <string>
- If empty, the director won't consider spawning a melee in this place. If potentially spawning is desired, use the names listed below, like in the weapon_melee_spawn entity:
baseball_batcricket_batcrowbarelectric_guitarfireaxefrying_pangolfclubkatanaknifemachetepitchforkshoveltonfaAny– director will place any available melee weapon
- You may also list multiple specific melee weapons separated by a comma, and the director will select from among that subset of weapons:
crowbar,fireaxe,machete.
Flags
- Enable Physics on spawned item : [1]
- Spawned Item Must Exist : [2]
- Infinite Items : [8]
Editing the FGD (Optional)
Helper ModelUnfortunately, this entity lacks any sort of helper model to make it easier to position the item realistically, so here is a quick guide on how to add the option for a helper model:
Then, if you have Hammer already open while making these changes, save whatever you were doing, close Hammer, and once you launch it you will see this option Default ValuesSome Keyvalues are automatically set to 1 on this entity, which can be tedious to set back to 0 if you don't want that item. To change this, go to the same FGD as above, but this time, look for this line and change the desired default values to 0:item1(integer) : "Ammo pile" : 1 item2(integer) : "First aid kit" : 0 item3(integer) : "Molotov Cocktail" : 1 item4(integer) : "Pain Pills" : 1 item5(integer) : "Pipe Bomb" : 1 item6(integer) : "Oxygen Tank" : 0 item7(integer) : "Propane Tank" : 0 item8(integer) : "Gasoline Can" : 0 //item9(integer) : "" : 0 //item10(integer) : "" : 0 item11(integer) : "Adrenaline" : 1 item12(integer) : "Defibrillator" : 0 item13(integer) : "Boomer Bile" : 0 //item14(integer) : "" : 0 //item15(integer) : "" : 0 item16(integer) : "Chainsaw" : 0 item17(integer) : "Grenade Launcher" : 0 item18(integer) : "M60 Machinegun" : 0 |
See Also
- weapon_ammo_spawn
- weapon_first_aid_kit_spawn
- weapon_molotov_spawn
- weapon_pain_pills_spawn
- weapon_pipe_bomb_spawn
- weapon_oxygentank
- weapon_propanetank
- weapon_gascan_spawn
- weapon_adrenaline_spawn
- weapon_defibrillator_spawn
- weapon_vomitjar_spawn
- weapon_chainsaw_spawn
- weapon_grenade_launcher_spawn
- weapon_rifle_m60_spawn
- weapon_melee_spawn