6.4. macro_brush
A brush entity that creates a copy of its own brushwork for each world brush and brush entity in the selected template. Each copy takes on the textures and entity properties of the associated brush or entity in the template. Useful for adding visual effects to triggers or for adding point entities to brush entities.
The properties of this entity are visible to scripts in the selected template, so each instance can be made unique. This entity is often used together with macro_template, but it can also use other map files as templates.
Properties
-
Name (targetname) -- The name of this entity. Templates can reference this in scripts with
{targetname}
or by using the special function{id()}
, which returns either the name of the instance-creating entity, or the unique numerical ID of the current instance. - Template map path (template_map) -- The relative or absolute path (or paths) of a map file. If no template entity is specified then the entire map is used as a template. In the main map, relative map paths are taken to be relative to the template maps directory. In template maps, they are relative to the current map.
- Template entity (template_name) -- The name (or names) of a macro_template entity in the chosen map, or in the current map if no template map path is specified. If there are multiple templates with the same name, one will be chosen randomly per instance.
-
Random seed (random_seed) -- Random seed value, used for deterministic pseudo-randomness. This affects the
rand
andrandi
functions. Default is0
. -
Point entity anchor position (anchor) -- Point entities in the chosen template will be placed relative to the anchor point of the macro_brush.
-
Bottom center (0) -- The bottom center of the bounding box of the
macro_brush
. -
Center (1) -- The center of the bounding box of the
macro_brush
. -
Top center (2) -- The top center of the bounding box of the
macro_brush
. -
Origin brush (3) -- The center of the origin brush of the
macro_brush
. Uses the bottom center if there is no origin brush.
-
Bottom center (0) -- The bottom center of the bounding box of the
- Point entity offset (instance_offset) -- This offset is added to the anchor point of the macro_brush, which allows for more specific placement of point entities.
Custom properties
Custom properties can be used by MScript expressions in entities inside the selected template. This makes it possible to further customize instances. This is also the mechanism that template entities use for their properties to have any effect.
Notes
- This macro entity only creates a single instance (which may contain multiple copies of the original brushwork), so all properties are evaluated once.
- Brush entities and world brushes inside the selected template must only use a single texture. Otherwise they are ignored, and a warning is logged.
-
If a brush entity in the selected template is covered with the
NULL
texture, then the resulting entity will use the textures of themacro_brush
. -
To randomly select one of several templates, use a comma-separated list of paths or template names:
prop_cactus, prop_rock
will randomly use eitherprop_cactus
orprop_rock
. It's also possible to specify a selection weight:prop_cactus: 1, prop_rock: 4
will selectprop_cactus
20% (1/5) of the time, andprop_rock
80% (4/5) of the time. This also works for template map paths.