Difference between revisions of "Weapon spawn"

From Valve Developer Community
Jump to: navigation, search
m (now.... that model warning only appears for this page... as it should been)
(added note about physics)
 
Line 1: Line 1:
 
{{l4d2 point|weapon_spawn}} It is a configurable spawner for any non-melee weapon.
 
{{l4d2 point|weapon_spawn}} It is a configurable spawner for any non-melee weapon.
 +
{{note|Because this entity uses [[WeaponSpawnSingle]] as a base, it has the ''Enable Physics'' Flag. However, all weapons will automatically spawn with physics enabled, no matter if the flag is used or not.}}
  
 
== Keyvalues ==
 
== Keyvalues ==

Latest revision as of 13:24, 27 July 2021

Left 4 Dead 2 weapon_spawn is a point entity available in Left 4 Dead 2 . It is a configurable spawner for any non-melee weapon.

Note.png Note: Because this entity uses WeaponSpawnSingle as a base, it has the Enable Physics Flag. However, all weapons will automatically spawn with physics enabled, no matter if the flag is used or not.

Keyvalues

Selection <choices>
Spawn the selected weapon or weapon category
Value Description
any Any primary or secondary weapon
any_pistol Any Pistol
weapon_pistol Pistol
weapon_pistol_magnum Magnum Pistol
any_primary Any Primary Weapon
tier1_any Any tier 1 primary
tier2_any Any tier 2 primary
any_smg Any tier 1 SMG
any_rifle Any tier 2 Rifle
any_sniper_rifle Any tier 2 Sniper Rifle
any_shotgun Any Shotgun
tier1_shotgun Any tier 1 Shotgun
tier2_shotgun Any tier 2 Shotgun
weapon_smg SMG
weapon_smg_silenced Silenced SMG
weapon_pumpshotgun Pump Shotgun
weapon_shotgun_chrome Chrome Shotgun
weapon_autoshotgun Auto Shotgun
weapon_shotgun_spas SPAS Shotgun
weapon_rifle M4 Rifle
weapon_rifle_desert Desert Rifle
weapon_rifle_ak47 AK47
weapon_hunting_rifle Hunting Rifle
weapon_sniper_military Sniper Military
weapon_smg_mp5 MP5
weapon_rifle_sg552 SG552
weapon_sniper_awp Sniper AWP
weapon_sniper_scout Sniper Scout
Spawn instantly without director <boolean>
Bypass the proximity checks that make nearby weapons be the same tier / not the same weapon
No CS Weapons <boolean>
When selecting 'any' weapon, set this to true if you do not want CS weapons.

WeaponSpawn:

Count (count) <integer>
Max number of weapons given before disappearing.

WeaponSpawnSingle:

Weapon Skin (weapon_skin) <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.
Collisions (solid) <choices>
Collision box type.
  • 0 : Not Solid
  • 2 : Use Bounding Box
  • 6 : Use VPhysics

Model:

Glow Backface Multiple (glowbackfacemult) <float> (only in Left 4 Dead 2) !FGD
If this object has a glow effect, multiply the effect by this much on the sides of the object that are facing away from the viewer.



Base:

Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.png Tip: Entities transition to the next map with their parents
Tip.png Tip: phys_constraintcan be used as a workaround if parenting fails.
Global Entity Name (globalname) <string>
When the player transitions to a new map, entities in the new map with matching globalnames will have their previous map's states copied over to it.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.png Note: Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
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.
Note.png Note: This works on brush entities, although Hammer doesn't show the new angles.
Response Contexts (ResponseContext) <string>
Pre-defined response system contexts; Format is [key]:[value],[key]:[value],...and so on.
Tip.png Tip: Can also be filtered for or against!
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Tip.png Tip: Changing classnames using theAddOutputinput can still influence the game's code, like making the classname match one element in the S_PreserveEnts list will make the entity persists on new rounds!
Flags (spawnflags) <integer> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <integer> !FGD
Combination of effect flags to use.
Hammer ID (hammerid) <integer> !FGD
The entity's unique Hammer ID that's auto-generated on map compiles. Mainly used by plugins or debugging commands (like theent_keyvaluecommand). Run-time spawned entities don't have a Hammer ID.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Disable for Xbox 360 (disableX360) <boolean> (in all games since Left 4 Dead 2) !FGD
If this entity should automatically be given the 'Disable' input on the Xbox 360 version of Source.


Flags

  • 16 : Constrain to spawn position (don't drop to the ground)

WeaponSpawn:

  • 4 : Absorb any dropped weapon type (only in Left 4 Dead 2)
  • 131072 : Don't cluster with similar items (only in Left 4 Dead) To do: What is this for? Weapons already have their own density settings, and does this work?

WeaponSpawnSingle:

  • 1 : Enable Physics
  • 2 : Must Exist
  • 8 : Infinite items (overrides count) (only in Left 4 Dead 2)