CWeaponSpawn

From Source Entities
Jump to navigation Jump to search

Code classes:

CWeaponSpawn is a code class in L4d.pngL4d2-small.png which is inherited by all the entities that might spawn an item players can use. Spawner entities give you more control over the spawning of weapons than simply placing a weapon entity, and cut down on the networking load.

Flags[edit | edit source]

  • 1: Enable Physics - Item falls to the ground naturally instead of staying in place.
  • 2: Must Exist - Makes the item always spawn. (Items are randomly chosen to spawn or not spawn.)
  • 4: Absorb any dropped weapon type (only available in L4d2-small.png) - Nearby dropped items of the same type will be erased and replenish the Count by one. Always done regardless of this flag.
  • 8: Infinite items (overrides count) (only available in L4d2-small.png)
  • 65536: Add To Director Scavenge List (only available in L4d.png) - To do: Description.

Keyvalues[edit | edit source]

Count (count) <integer>
How many instances of the item can be taken before the entity disappears forever. Ammo upgrades should always use 4 and only let a player use that entity once. Nearby dropped items of the same type will be erased and replenish the count by one.
Item Skin (weaponskin) <integer> (only available in L4d2-small.png)
Some items have multiple versions of their textures, called skins. Set this to a number other than -1 to make the given item use that skin instead of the default.
Glow Range (glowrange) <float> (only available in L4d2-small.png)
Set a custom glow range for this spawner. 0 means use the default range. To do: What is the default?
Collisions (solid) <choices>
No effect. Always uses VPhysics.

Outputs[edit | edit source]

OnItemSpawn  (only available in L4d.png)
Fires when the weapon was chosen to spawn. Fires even if Must Exist was checked.