Weapon item spawn: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(-added class hierarchy (unsure if it's the correct one just a guess), cleanup, moved fgd edit to bottom)
Line 1: Line 1:
{{CD|CWeaponSpawnConfigurable}}
{{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]]. Spawned item is automatically placed on the ground below.
{{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]]. Spawned item is automatically placed on the ground below.
== Editing the [[FGD]] (Optional) ==
===Helper Model===
Unfortunately, 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:
*Open Left 4 Dead 2\bin\left4dead2.fgd
*Using the find option, search for: <pre>@PointClass base(Targetname,Angles) = weapon_item_spawn</pre>
*Replace that with: '''<pre>@PointClass base(Targetname,Angles,Studiomodel)studioprop() = weapon_item_spawn</pre>'''
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 Values===
Some 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: <pre>
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</pre>
All of those numbers at the end dictate the default value. Change those lines to this to set them all to 0: <pre>
item1(integer) : "Ammo pile" : 0
item2(integer) : "First aid kit" : 0
item3(integer) : "Molotov Cocktail" : 0
item4(integer) : "Pain Pills" : 0
item5(integer) : "Pipe Bomb" : 0
item6(integer) : "Oxygen Tank" : 0
item7(integer) : "Propane Tank" : 0
item8(integer) : "Gasoline Can" : 0
//item9(integer) : "" : 0
//item10(integer) : "" : 0
item11(integer) : "Adrenaline" : 0
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</pre>


== Keyvalues ==
== Keyvalues ==
Line 82: Line 34:


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:
  crowbar,fireaxe,machete
  crowbar,fireaxe,machete
{{KV Targetname}}
{{KV Angles}}
{{KV Angles}}


== Flags ==
== Flags ==
* 1 : Enable Physics on spawned item
{{fl|1|Enable Physics on spawned item}}
* 2 : Spawned Item Must Exist
{{fl|2|Spawned Item Must Exist}}
* 8 : Infinite Items
{{fl|8|Infinite Items}}
 
== Editing the [[FGD]] (Optional) ==
===Helper Model===
Unfortunately, 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:
*Open Left 4 Dead 2\bin\left4dead2.fgd
*Using the find option, search for: <pre>@PointClass base(Targetname,Angles) = weapon_item_spawn</pre>
*Replace that with: '''<pre>@PointClass base(Targetname,Angles,Studiomodel)studioprop() = weapon_item_spawn</pre>'''
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 Values===
Some 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: <pre>
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</pre>

Revision as of 06:19, 23 January 2024

C++ Class hierarchy
CWeaponSpawnConfigurable
CWeaponSpawn
CItem
CBaseAnimating
CBaseEntity

weapon_item_spawn is a point entity available in Left 4 Dead 2 Left 4 Dead 2. It is a spawn point for any available item, except weapon upgrades. Spawned item is automatically placed on the ground below.

Keyvalues

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>
If set to 1, the director considers to spawn this, or any other item with the boolean set to 1
Melee Weapon (melee_weapon) <string>
If empty, the director won't consider to spawn a melee in this place. If you want the director to consider spawning one, use one or multiple names listed below, like in the weapon_melee_spawn entity
  • golfclub
  • fireaxe
  • frying_pan
  • machete
  • baseball_bat
  • crowbar
  • cricket_bat
  • tonfa
  • katana
  • electric_guitar
  • shovel
  • pitchfork
  • 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:

crowbar,fireaxe,machete
Pitch Yaw Roll (Y Z X) (angles) <QAngle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

Flags

Enable Physics on spawned item : [1]
Spawned Item Must Exist : [2]
Infinite Items : [8]

Editing the FGD (Optional)

Helper Model

Unfortunately, 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:

  • Open Left 4 Dead 2\bin\left4dead2.fgd
  • Using the find option, search for:
    @PointClass base(Targetname,Angles) = weapon_item_spawn
  • Replace that with:
    @PointClass base(Targetname,Angles,Studiomodel)studioprop() = weapon_item_spawn

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 Values

Some 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