File Specification
Information for the randomizer map files
You can find pre-made ones for all official maps here https://github.com/Jackzmc/sourcemod-plugins/tree/master/data/randomizer
Example JSON:#
{
"my-scene-name": {
"chance": 0.0 - 1.0,
"variants": [
{
"weight": 1
"entities": [
{}
]
}
]
}
}
Scenes#
Scenes are a collection of props that form a well scene, or a randomized area. This can be a skip/shortcut, a block (forcing others to take alternative routes), decoration, small obstacles, or an entire alternative path.
The name of the scene is purely for organization and development, name it however it helps.
Properties#
{
// REQUIRED The % chance that this scene runs, between 0.0 and 1.0 (decimal value)
"chance": <0.0-1.0>
// REQUIRED The list of variant objects, see below
"variants": [],
// Any scene that is part of a group, only one will
// randomly run, like a variant.
// Except, the % chance of scene still applies afterwards
"group": "..."
// Any entities that will spawn if scene selected,
// regardless of the variant chosen.
"entities": [],
// Any inputs that will be run if scene selected,
// regardless of the variant chosen.
"inputs": []
}
Variants#
Variants are part of scenes, when a scene is selected, one variant at random is chosen and it's entities are spawned and inputs fired. Variants support a weight system, with the number being the number of times added to the random pool, thus higher chance of activating.
Variant's Ids are their index in the list. #0 being the first.
Properties#
{
// Default 1, number of times added to the 'lottery'
"weight":" 1,
//List of entities that will spawn
"entities": [],
// Lit of inputs to run
"inputs": [],
// List of scene ids that, if this variant is selected,
// will be loaded if not already
"forced_scenes": []j
}
Entities#
These objects can be added to either:
- A scene's .entities property, these will be shared with all of the scene's variants
- A variant's .entities property
Supported Entity Types#
prop_dynamic,prop_physics,prop_fuel_barrelenv_fireenv_physics_blocker,env_player_blockerinfodecal(* might not work)hammerid,targetname,classname(updates existing)_car_alarm,_car,_car_physics- randomizes colorlight_dynamic- color[0,1,2] and color[3] is brightness, scale[0] is distance, angles[0] is inner, angles[1] is outer, angles[2] is pitch_gascan- Randomized gascan spawn location
See Entity Types for more information
Entity Properties#
{
// The entity type, which can be a classname or custom types starting with _ (see Entity Types page). Only supported classnames work
"type": "...",
// The model or used as id for "type": "hammerid" or "classname" or "targetname"
"model": "",
// Optional override of the default targetname for entity, which is "randomizer". Will have randomizer_ prefix (this is essential for cleanup)
"targetname": "",
// The origin of the entity, as 3 floats
"origin": [ x.0, y.0, z.0 ],
// The angles of entity, as 3 floats
"angles": [ pitch, yaw, roll ],
// Only for env_*_blocker entities, the scale in the X, Y, Z axis as 3 floats
"scale": [ x.0, y.0, z.0 ],
// Optionally sets the R, G, B, and optionally A of entity. Default alpha (A) is 255. Int array
"color": [ r, g, b, a ],
// Optional extra properties to specify on object
// These are applied on entity when they are spawned. Only one of "float", or "integer" or "string" can be added, and its value must match its type
"properties": [
{
"type": "", // "netprop" "datamap" "keyvalue" "input" or "custom"
"key": "", // The key of the property
// One of these values, with the correct type:
"float": 0.0,
"integer": 0,
"string": "avalue"
}
]
Examples#
New Entity#
{
"model": "...",
"origin": [0, 0, 0],
"angles": [0, 0, 0],
// optional:
"color": [255, 255, 255, 255]
}
Move existing entities#
Type of either hammerid or targetname, put id in model
{
"type": "hammerid" OR "targetname"
"model": "<hammerid>" OR "<targetname>",
"origin": [0, 0, 0],
"angles": [0, 0, 0],
// optional:
"color": [255, 255, 255, 255] // currently does not change color
}
New Entities (with different classnames)#
New entities default to prop_dynamic, if you want to change the classname (for example, invisible walls) enter the classname for type.
Example: Invisible Walls (env_physics_blocker):
{
"type": "env_physics_blocker",
"origin": [0, 0, 0],
"scale": [0, 0, 0]
}
Inputs#
Inputs are source engine inputs run on specific targets
{
// Select an entity with one of these:
"classname": "...", // Selects multiple
"targetname": "...", // Selects multiple
"hammerid": #####, // Selects single
// The input to run, the everything after first space is variant
// example: "color 255 255 255" would do "color" with "255 255 255"
"input": "input variant-data"
}
There are also some special inputs:
_lock- Locks and closes a door_lock_nobreak- Locks, closes and makes door unbreakable_allow_ladder- Allows survivors to climb previously infected-only ladder- If a ladder is selected with /rbuild selector, this input will be autogenerated
Running#
See Command Guide