Changes between Version 22 and Version 23 of Triggers


Ignore:
Timestamp:
Aug 27, 2014, 3:20:05 PM (10 years ago)
Author:
Yves
Comment:

Adds section for examples and Treasure Island example

Legend:

Unmodified
Added
Removed
Modified
  • Triggers

    v22 v23  
    66We 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.
    77
     8== Examples
     9A 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
    814== 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).
     15For 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]).
    1016
    1117In 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).