I will provide a test map instead of showing pictures for each part of the triggers, cause its simpler and less cluttered.
Here are the steps to set it up:
1.First go to the variables list in the trigger editor, and add the following variables:
- Spoiler:
2. Place a region somewhere on your path, making sure it is fully on the path:
- Spoiler:
3. Create a Variables trigger, where at map initialization you do 3 things:
- Add all of your hero units to the unit group Units.
- Set your BugDistance variable to whatever # you want (could be done when creating the variable if preferred).
- Set your PathTerrain variable to the region you placed in step #2, identifying what the path terrain-type will be.
- Spoiler:
4. Create the Terrain Kill trigger, which runs every 0.05 seconds and kills the hero if it is more than BugDistance away from the path:
- Spoiler:
5. Things to note:
- If your path changes terrain-type during the maze, be sure to add a region on the new path terrain and set PathTerrain accordingly.
- Since this is based on checking the terrain of the
path only, your death terrains can change without affecting the triggers.
- If the picture quality is very bad, just open the map below. Triggers are all in it.
Here is the test map, run it and you can set the BugDistance in the game itself. Instructions on doing so are in the loading screen.
http://www.epicwar.com/maps/96198/