random_spawner
random_spawner is a point entity available in
No More Room in Hell.
Entity Description
The random_spawner is a point entity that allows mappers to add easy randomisation to the item spawning, by setting a chance for what they want to appear in a location. This allows them to pick a selection of shotguns, or a high tier rifle to appear. One could also roll for different medical items, or ammo boxes. This selection can be further controlled with the random_spawner_controller applying a numerical limit on the items.
As this covers every possible item, KeyValues have been collapsed for speed, with a more descriptive help comment. Just know you can reference the items by their entity name found on the list.
The chance is cumulative, so if all items and categories result to less than 100, there is a chance no item will spawn at all. If the chance is above 100, it gets balanced out and normalised down to 100.
KeyValues
- Name (targetname) <string>
- The name that other entities refer to this entity by.
- Entity Scripts (vscripts) <string>
- Name(s) of script files that are executed after all entities have spawned.
- Script think function (thinkfunction) <string>
- Name of a function in this entity's script scope which will be called automatically.
- Pitch Yaw Roll (Y Z X) (angles) <angles>
- 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.
- any (any) <integer>
- Chance for any weapon to spawn.
- ammo (ammo) <integer>
- Chance for any ammo box to spawn.
- explosive (explosive) <integer>
- Chance for any explosive to spawn.
- firearm (firearm) <integer>
- Chance for any firearm to spawn.
- handgun (handgun) <integer>
- Chance for any handgun to spawn.
- item (item) <integer>
- Chance for any item to spawn.
- machinegun (machinegun) <integer>
- Chance for any machinegun to spawn.
- melee (melee) <integer>
- Chance for any melee to spawn.
- military (military) <integer>
- Chance for any military grade weapon to spawn.
- rifle (rifle) <integer>
- Chance for any rifle to spawn.
- shotgun (shotgun) <integer>
- Chance for any shotgun to spawn.
- Test Model (targetname) <choices>
- Model to test bounds etc. within Hammer.
- Ammo Fill Min (ammo_fill_pct_min) <integer>
- Spawned item, if applicable, will spawn with ammo ammount at least this percent of capacity.
- Ammo Fill Max (targetname) <integer>
- Spawned item, if applicable, will spawn with ammo ammount at most this percent of capacity.
- Ammo 12-Gauge to TOOL Welder (ammobox_12gauge to tool_welder) <integer>
- The chance, in percentage (out of 100) that the selected object will spawn in the stage. 0 means no chance.
Flags
- Disable Item Motion : [1]
- Disables the physics system from acting upon on this item.
- Don't spawn on map start : [2]
- Doesn't spawn this item on map start.
- Toss me about : [4]
- When spawned, apply random velocity and direction instead of dropping down.
Inputs
- InputSpawn
- Trigger this Spawner.
Outputs
- OnItemSpawn
- Fired when an item is spawned, with the activator being the item.
- OnUser1 to OnUser4
- Fired in response to the FireUser inputs.