Hands-On Usage
set_entity_movement is commonly used in cinematic animation mods to make custom entities on the map (aircraft, ships, vehicle models, etc.) interpolate along a specified path. Combined with event chains that advance frame-by-frame, this creates cutscene effects. For example, in a story event showcasing fleet movement, you can simulate an entity gliding from a departure port to a target sea zone by continuously adjusting the ratio value:
# In the immediate block of an event, move the entity to the midpoint between start and target
set_entity_movement = {
id = 101
start = {
province = 11620 # Province of departure port
}
target = {
province = 11634 # Province of target sea zone
}
ratio = 0.5 # Currently positioned halfway along the route
rotation = 1.57 # Rotation adjusted roughly eastward (in radians)
}
Synergy
[create_entity](/wiki/effect/create_entity) — Entities must be created before they can be moved by this command; both typically appear in different stages of the same event chain.
[set_entity_rotation](/wiki/effect/set_entity_rotation) — If you only need to adjust rotation without interpolating position, you can use this separately; it can also be called after movement for final rotation correction.
[set_entity_animation](/wiki/effect/set_entity_animation) — Movement often requires syncing the entity's animation state in parallel. Calling this command alongside movement ensures visual consistency.
[destroy_entity](/wiki/effect/destroy_entity) — Clean up entities no longer needed after the animation finishes, forming a complete lifecycle of "create → move → destroy" with this command.
Common Pitfalls
ratio values outside the 0–1 range don't error but produce undefined behavior: Beginners sometimes pass ratio dynamically via variables. If a variable exceeds 1.0 through accumulation, the entity will interpolate beyond the target position, causing the model to appear off-map at an edge. Always constrain variables to the legal range using [clamp_variable](/wiki/effect/clamp_variable) or [clamp_temp_variable](/wiki/effect/clamp_temp_variable) before assignment.
- The
id must correspond exactly with the id from create_entity: If you reference an entity id that hasn't been created yet or has already been destroyed by destroy_entity, the game won't crash but the command silently fails, making it extremely difficult to debug. It's recommended to clearly annotate the lifecycle of each id in comments within the same file.