effect · set_entity_scale
Definition
- Supported scope:
any - Supported target:
any
Description
sets the scale of existing entity
set_entity_scale = {
id = 123 # id of entity
scale = 5.0
}
set_entity_scaleanyanysets the scale of existing entity
set_entity_scale = {
id = 123 # id of entity
scale = 5.0
}
Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
set_entity_scale is primarily used in mod scenarios requiring dynamic visual resizing of map entities, such as scaling building models, landmarks, or visual effect entities in response to game events to create visual feedback (for example, a capital building that grows larger as the nation becomes more powerful). Before using it, you must first generate the entity via create_entity and record its id, after which you can execute scaling operations on the entity with the specified id.
# Create entity first and save the id, then scale it
create_entity = {
model = "my_landmark_entity"
id = 123
position = { x = 500 y = 0 z = 300 }
}
set_entity_scale = {
id = 123
scale = 2.5
}
[create_entity](/wiki/effect/create_entity): A prerequisite dependency for set_entity_scale. You must create the entity first before you have an operable id. These two commands almost always appear together.[set_entity_position](/wiki/effect/set_entity_position): When scaling an entity, you typically need to adjust its position as well to ensure the visual anchor point of the enlarged entity remains at the intended coordinates.[set_entity_rotation](/wiki/effect/set_entity_rotation): Visual adjustments are usually composite operations. Scaling followed by rotation completes a full entity transformation pipeline.[destroy_entity](/wiki/effect/destroy_entity): When the visual effect driven by scaling concludes, pair it with entity destruction to clean up and avoid leaving unused entities on the map.id in set_entity_scale must exactly match the id specified when calling create_entity. If the ids differ or the entity has not yet been created, the command fails silently without error messages, making it difficult for newcomers to detect.scale to 0 makes the entity visually disappear while still remaining in memory. Setting it to a negative value produces undefined behavior. The correct approach is to use destroy_entity to remove unwanted entities rather than using zero scaling as a substitute for deletion.