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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"mapId": "<mapId>",
"name": "<name>",
"x": "<x>",
"y": "<y>",
"pages": "<pages>"
},
"name": "create_map_event"
}
}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; }