Create or replace objects (XML)
write_objectWrite or patch Mount & Blade II Bannerlord module XML objects like items, NPCs, or factions, then validate them against the game's XSD schema.
Instructions
Writes one or more objects (e.g. , , , , , , , ) into a writable module. Replaces an object with the same tag+id in that module, otherwise appends it to the module's file for that data type (creating ModuleData/_.xml and registering it in SubModule.xml). Runs the game's XSD check afterwards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | One or more object elements (a wrapping container like <Items>…</Items> is accepted). Use {=stringId}Text for names. | |
| file | No | Optional target file under ModuleData, e.g. mymod_weapons.xml (created and registered if needed). | |
| mode | No | upsert (default), create (fail if exists), replace (fail if missing). | |
| module | Yes | Writable module id. | |
| xml_id | No | Optional XmlName id when it cannot be inferred from the tag (e.g. Items, NPCCharacters). | |
| validate | No | Run XSD validation after writing (default true). |