Changes between Version 17 and Version 18 of Triggers
- Timestamp:
- Jun 24, 2014, 9:53:11 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Triggers
v17 v18 103 103 }}} 104 104 105 '''Note:''' both the `Trigger` prototype (e.g. `Trigger.prototype.myData`) and the data you add directly to `this` (`this.myData`) can be accessed via `this`. But only the data added directly to `this` will be saved in a saved game (e.g. `this.myVar` will be saved but `Trigger.protoype.myVar` not!). So although it's possible to add other stuff to the prototype than just functions, only do so if it doesn't change throughout the game (i.e. constants like `Trigger.prototype.MIN_UNITS_REQUIRED_FOR_ATTACK = 1;` ). Also note that functions can't be saved in saved games. So in short, functions should always be defined under the prototype, and never change.105 '''Note:''' both the `Trigger` prototype (e.g. `Trigger.prototype.myData`) and the data you add directly to `this` (`this.myData`) can be accessed via `this`. But only the data added directly to `this` will be saved in a saved game (e.g. `this.myVar` will be saved but `Trigger.protoype.myVar` not!). So although it's possible to add other stuff to the prototype than just functions, only do so if it doesn't change throughout the game (i.e. constants like `Trigger.prototype.MIN_UNITS_REQUIRED_FOR_ATTACK = 1;` are fine). Also note that functions can't be saved in saved games. So in short, functions should always be defined under the prototype, and never change. 106 106 107 107 == Registering triggers ==