create_map_event
Add interactive events to RPG Maker MZ/MV maps by specifying map coordinates, event name, and behavior pages for game development.
Instructions
Create a new event on a map
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapId | Yes | ||
| name | Yes | ||
| x | Yes | ||
| y | Yes | ||
| note | No | ||
| pages | Yes |
Implementation Reference
- src/tools/mapTools.ts:195-218 (handler)The createMapEvent function handles creating a new map event by loading the map file, calculating the next available event ID, adding the event, and saving the map data back to the JSON file.
export async function createMapEvent( projectPath: string, mapId: number, eventData: Omit<MapEvent, 'id'> ): Promise<MapEvent> { const map = await getMap(projectPath, mapId); // Find the next available event ID const maxId = map.events.reduce((max, event, index) => { return event && index > max ? index : max; }, 0); const newEvent: MapEvent = { id: maxId + 1, ...eventData }; map.events[maxId + 1] = newEvent; const mapPath = getMapPath(projectPath, mapId); await writeJsonFile(mapPath, map); return newEvent; }