<!-- skill: RPG Maker MZ | version: 1.0.0 | description: MZ maps events quest switches plugins and web exe deploy | category: Games -->
## Instructions
- Use RPG Maker MZ 1.8+; keep project on local SSD, enable autosave backups every 15 minutes.
- Design maps with 3 layers + regions; cap parallax to 816x624 tiles to avoid HTML5 memory spikes.
- Build events with pages conditioned by switches/variables/self-switches; keep page count under 4 per event.
- Model quests as: Control Switches ON start -> Control Variables progress -> Conditional Branch checks -> Reward.
- Name switches/variables with prefix (Q01_, SYS_) and document range 1-50 system, 51+ quests in help file.
- Order plugins: Core/VisuStella Core -> battle/message -> movement -> quest systems -> patches last; never reorder mid-save.
- Test with playtest + $testInfo; clear cache and start New Game after plugin order changes (old saves break).
- Balance damage formula default a.atk*4 - b.def*2; tune variance 15-20% and playtest levels 1, 10, 25.
- Optimize images: PNG-8 for tiles, WebP/OGG for audio; keep total deploy under 500MB for web.
- Localize dialogue in external CSV then paste; avoid special fonts without embedding in fonts/ folder.
- Deploy Web with exclude unused files checked + encryption for commercial; EXE via Enigma/NW.js 64-bit.
- Back up js/plugins.js and data/ before updates; diff after store plugin installs.

## Examples
- Example 1: "fetch quest" -> Event page1 switch Q01_START OFF text, page2 Q01_START ON + variable Q01_KILLS>=5 reward.
- Example 2: "locked door" -> Conditional Branch Key Item owned -> transfer player else buzzer SE + message.
- Example 3: "plugin crash" -> disable bottom half, binary search enable, check console F8 for TypeError stack.

## Workflows
- Map workflow: Sketch on paper -> tileset A/B pick -> draw ground -> walls -> events -> region IDs -> playtest walkability.
- Quest workflow: Write one-line pitch -> define switches/vars -> build giver/mobs/turn-in events -> test full chain -> balance rewards.
- Plugin workflow: Backup -> install via Plugin Manager -> set params -> order check -> New Game test -> mobile/web test.
- Deploy workflow: File -> Deployment -> choose Web/Windows -> exclude unused -> encrypt -> test output folder fresh.

## Templates
- Quest tracker checklist:
  - [ ] Switch Qxx_START / Qxx_DONE named
  - [ ] Variable Qxx_PROG initialized 0
  - [ ] Journal entry common event updated
  - [ ] Reward gold/items/XP balanced
  - [ ] Save-compat tested New + Continue
- Event page template: Page1 Autorun intro (once) -> Self Switch A ON; Page2 Action Button main; Page3 Switch DONE completion.
- Damage formula samples: `a.atk*4 - b.def*2`, mage `a.mat*5 - b.mdf*2 + v[10]`, crit `b.result().critical? x*3 : x`.
- Plugin order list: 1 VisuMZ_0_Core 2 MessageCore 3 BattleCore 4 QuestSystem 5 Patches/Compat.

## Tools
- Core: RPG Maker MZ editor, Plugin Manager, Character Generator, SAKAN tiles DLC.
- Plugins: VisuStella suite, Yanfly ports, Galv, SRDude HUD, Effekseer particles.
- Audio: Audacity loop points, RPG Maker OGG converter, free BGM from Dova-Syndrome.
- Deploy: NW.js, Enigma Virtual Box, itch.io Butler for web uploads.

## Advanced
- Write small plugin snippets with alias injection: `const _alias = Scene_Map.prototype.update; Scene_Map.prototype.update=function(){_alias.call(this); /*hook*/}`.
- Use Control Variables + script `$gameVariables.value(12)+=1` for complex counters without extra pages.
- Implement day/night via tint screen + parallel common event checking $gameVariables time.
- Encrypt with per-build key; rotate if web assets scraped.
- Bridge to custom JS: call `$gameParty.gainItem($dataItems[5],2)` from event Script box safely.
- Add touch UI buttons viaPicture + Get Location Info for mobile deployments without keyboard.
- Optimize parallel events: single controller common event instead of 20 map parallels to save FPS.

## Documentation
- MZ help (in-app F1) + https://www.rpgmakerweb.com/product/rpg-maker-mz
- VisuStella docs: https://visustella.com/
- Forums: https://forums.rpgmakerweb.com/index.php
- Deployment guide: https://www.rpgmakerweb.com/support/products/rpg-maker-mz
- Eventing masterclass: https://forums.rpgmakerweb.com/index.php?forums/tutorials.119/
- NW.js packaging: https://nwjs.io/downloads/
- itch Butler push: https://itch.io/docs/butler/
