Put a file where the engine will load it
import_assetCopies a file into an RPG Maker MZ asset folder, validates its extension and case, records a backup for undo, and returns the data-field name to reference it.
Instructions
MZ has no importer and no per-asset metadata: the folder and the base name are the whole registration. This copies a file into one of the folders the engine's own loaders read (img/characters, img/faces, img/sv_actors, img/sv_enemies, img/enemies, img/battlebacks1/2, img/titles1/2, img/tilesets, img/parallaxes, img/pictures, img/animations, img/system, audio/bgm, audio/bgs, audio/me, audio/se, movies), checks the extension belongs there, refuses a name that differs from an existing file only by case (the filesystem folds those together and the second one would never load), and writes through the same backup journal as every other write, so undo_writes takes it back — including deleting a file that did not exist before. The reply gives the value to put in the data field (the name without extension) and which fields already name it, which is the half of check_assets that was missing a file. Overwriting needs overwrite: true; the bytes being replaced stay recoverable in the backup list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Asset name without extension (default: the source file's own base name) | |
| folder | Yes | Target folder, with or without its img/ or audio/ prefix | |
| source | Yes | File to bring in: an absolute path, or project-relative when moving between folders | |
| overwrite | No | Replace the file that is already there |