Edit scene entities
scene_editAdd, update, delete or duplicate entities in Mount & Blade II: Bannerlord scenes, editing scene.xscene files or the live Modding Kit editor with undoable, schema-safe changes.
Instructions
Adds, updates, deletes or duplicates entities. File mode edits scene.xscene of a writable module (formatting preserved, undoable). live=true edits the scene open in the Modding Kit editor through the bridge (then save with Ctrl+S in the editor); live also supports select, focus and snap_to_ground. add: place a prefab (prefab=…) or a mesh (mesh=…, physics=bo_…) or raw <game_entity> XML, count+offset make rows. update: position/move_by, rotation/rotate_by (degrees unless rotation_unit=rad), scale, name (exact for every target unless number_names), add_tags/remove_tags, attributes, script+variables, levels (file mode). Live targets: #handles from scene_entities live (valid until the scene is reopened) or names (child entities included). Siege spawner names are protected: the editor derives their prefab from the name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | add (file mode): a complete <game_entity> element. | |
| live | No | Edit the scene open in the running editor instead of the file (default false). | |
| mesh | No | add: meta mesh name (see asset_search kind=mesh). | |
| name | No | Name of new entities / new name for update. Siege spawners (BallistaSpawner, MangonelSpawner…) must keep '<prefab>_spawner' names — the editor derives their prefab from the name; other names are refused. | |
| count | No | add/duplicate: number of copies (default 1). | |
| scale | No | [x, y, z] scale (a single number scales uniformly). | |
| scene | No | Scene name, Module/scene or path (file mode). | |
| action | Yes | What to do. | |
| levels | No | update (file mode): the scene levels the entities belong to, e.g. ["siege"] ([] = every level). Define levels with scene_settings add_levels. | |
| module | No | Module to look in when the scene name is ambiguous. | |
| offset | No | add/duplicate: step between copies [dx, dy, dz] (duplicate default [1,0,0]). | |
| parent | No | add (file mode): handle or name of the parent entity. | |
| prefab | No | add: prefab name (see prefab_search). | |
| script | No | update (file mode): script component name whose variables to set (created if missing). | |
| move_by | No | update: relative move [dx, dy, dz]. | |
| physics | No | add (file mode, with mesh): physics shape such as bo_… | |
| visible | No | live update: show/hide the entities. | |
| add_tags | No | Tags to add. | |
| entities | No | Targets: handles ([12], 12/0 in files; #id numbers live), names, 'guid:{…}' or '@selected' (live). | |
| position | No | [x, y, z] position (add: placement; update: absolute). | |
| rotation | No | [x, y, z] euler rotation (degrees unless rotation_unit=rad). | |
| rotate_by | No | update: relative rotation [dx, dy, dz] (degrees by default). | |
| variables | No | update (file mode): script variables, e.g. {"SoundName": "event:/…"}. Values are strings. | |
| attributes | No | update (file mode): attributes to set on <game_entity>, e.g. {"mobility": "1"}. Values are strings. | |
| remove_tags | No | Tags to remove. | |
| number_names | No | Append _1, _2 … to `name`: default true when add makes several entities (never for siege spawners), false for update (every target gets exactly `name`). | |
| rotation_unit | No | Unit of rotation / rotate_by (default deg). | |
| snap_to_ground | No | live: drop new/moved entities onto terrain or geometry below. | |
| add_to_selection | No | live select: keep the current selection. | |
| remove_attributes | No | update (file mode): attributes to remove. |