Changes between Version 22 and Version 23 of Triggers
- Timestamp:
- Aug 27, 2014, 3:20:05 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Triggers
v22 v23 6 6 We will try to give a lot of examples, that should be easy to copy-paste and modify where needed. But this isn't meant as an introductory course to JavaScript. For a JavaScript reference, it's best to look at the [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference Mozilla Development Network] (MDN). For creating and editing JavaScript files, it's best to use a decent text editor. Syntax highlighting is a must, so [http://www.notepad-plus-plus.org/ Notepad++] on Windows should be sufficient. 7 7 8 == Examples 9 A good way to learn how triggers work is to check some examples of existing trigger missions in addition the information provided in this article. 10 11 || '''Mission name''' || '''Description''' || '''Files''' || 12 || Treasure Islands || Simple multiplayer trigger mission to collect treasures on a group of islands before your opponent does. || [http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/maps/scenarios/Treasure%20Islands.pmp Treasure Islands.pmp][[BR]][http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/maps/scenarios/Treasure%20Islands.xml Treasure Islands.xml] [[BR]] [http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/maps/scenarios/treasure_islands.js treasure_islands.js] || 13 8 14 == Modifying your map == 9 For now, Atlas isn't very prepared for triggers. So we have no GUI to edit triggers (obviously), but also no GUI to add trigger scripts to your map. This means you need to edit your map data. For scenarios and skirmish maps, this map data is a JSON part in the map.xml file (see [source:ps/trunk/binaries/data/mods/public/maps/skirmishes/Alpine_Valleys_(2).xml#L42 example]). For random maps it's in the map.json file directly (see [source:ps/trunk/binaries/data/mods/public/maps/random/aegean_sea.json example]). (TODO: add link to committed triggers examples).15 For now, Atlas isn't very prepared for triggers. So we have no GUI to edit triggers (obviously), but also no GUI to add trigger scripts to your map. This means you need to edit your map data. For scenarios and skirmish maps, this map data is a JSON part in the map.xml file (see [source:ps/trunk/binaries/data/mods/public/maps/skirmishes/Alpine_Valleys_(2).xml#L42 example]). For random maps it's in the map.json file directly (see [source:ps/trunk/binaries/data/mods/public/maps/random/aegean_sea.json example]). 10 16 11 17 In this JSON part of the data, you define an array of loaded trigger scripts. You can define multiple more general helper scripts, and your custom script(s).