Changes between Initial Version and Version 1 of Ticket #52, comment 6
- Timestamp:
- Feb 3, 2014, 6:30:13 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #52, comment 6
initial v1 1 1 One important note before anything else: 2 2 To implement the triggers, we need a way to serialize and deserialize js functions; something not present in out current engine. For the patch to work, I've made a temporary hack so that it doesn't crash the game but save games will be broken. So, to really implement this, we should first fix the serializer. 3 3 4 4 5 This patch is work in progress. It implements a basic trigger system. … … 6 7 To create a trigger, an "action" function must be made. Then, a trigger is registered using RegisterTrigger function, which binds the "action" to an "event". During the game, when those "events" occur, the "action" functions are called. 7 8 Currently these are the implemented events: 9 10 8 11 OnEntityTookDamage 12 9 13 OnEntityKilled 14 10 15 OnStructureBuilt 16 11 17 OnConstructionStarted 18 12 19 OnTrainingFinished 20 13 21 OnTrainingQueued 22 14 23 OnResearchFinished 24 15 25 OnResearchQueued 26 16 27 Always (Special case, describes bellow) 28 17 29 OnUnitRangeFromEntity 30 18 31 19 32 Always event occurs every "updateInterval" defined by the creator of the triggers. It is an integer which describes the miliseconds interval by which the "Always" event occurs. As this could be performance heavy, it is disabled by default, so if a map maker really needs to check for something (for eg.) each second, it should enable this event manually. If his/her work is done with it, it can be disabled again. 20 33 21 34 OnUnitRangeFromEntity is another special case. For one, it "needs" to be updated. So for this to work, the update interval should be set. 35 22 36 It handles three closely related "events": 37 23 38 "OnUnitEnteredRangeFromEntity" which occurs when an entity moves into a radius from a specific entity. 39 24 40 "OnUnitLeftRangeFromEntity" which occurs when an entity that moves out of a radius from a specific entity. 41 25 42 "OnUnitMovedInsideRangeFromEntity" which occurs when an entity that moves inside of a radius from a specific entity. (doesn't leave it, but has already entered it). 43 26 44 27 45 One of the other important events to implement would be an "OnUnitRangeFromPoint" event that uses a point instead of an entity as the center of the radius.