Add a script trigger
wc3_add_triggerAdd custom JASS or Lua functions to a Warcraft 3 map script, with optional automatic execution at map initialization. Enables new in-game functionality without GUI triggers.
Instructions
Splice custom JASS/Lua into the map script and optionally wire it to run at map init. code is one or more complete function definitions; set entryFunction to the name of a zero-arg function in code to have it called during initialization. This is the reliable way to make the map DO something new in-game. Note: if the map has a GUI trigger tree and is re-saved in the World Editor, regenerated script may overwrite this; for pure custom-script maps it is fully durable. Saves the map.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapPath | Yes | Absolute path to the .w3x/.w3m map file | |
| code | Yes | Complete JASS/Lua function definition(s) to add | |
| entryFunction | No | Name of a zero-arg function in `code` to call at map init; omit to only append | |
| outPath | No | Output map path. Defaults to "<map>.edited.<ext>" beside the source; pass the source path to overwrite in place. |