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
}
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
set_entity_scale 主要用于需要动态调整地图实体视觉大小的 mod 场景,例如根据游戏事件让某个建筑模型、标志物或特效实体缩放变化,制造视觉反馈(如首都建筑随国家实力成长而放大)。使用前需通过 create_entity 预先生成实体并记录其 id,之后才能对指定 id 的实体执行缩放。
# 先创建实体并保存 id,再缩放
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):set_entity_scale 的前提依赖,必须先创建实体才有可操作的 id,两者几乎总是成对出现。[set_entity_position](/wiki/effect/set_entity_position):缩放实体的同时往往需要调整其位置,以确保放大后实体的视觉锚点仍在预期坐标。[set_entity_rotation](/wiki/effect/set_entity_rotation):视觉调整通常是组合操作,缩放后再旋转可以完成完整的实体变换流程。[destroy_entity](/wiki/effect/destroy_entity):当缩放驱动的视觉效果结束时,配合销毁实体来做清理,避免地图上遗留无用实体。set_entity_scale 的 id 必须与 create_entity 时指定的 id 完全一致,若两处 id 不同或实体尚未被创建,指令会静默失败且不报错,新手往往难以察觉。scale 设为 0 会让实体从视觉上完全消失但仍然存在于内存中,设为负值行为未定义,正确做法是用 destroy_entity 来移除不需要的实体,而非用零值缩放代替删除。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.