Would it be possible to get some way to disable an area (eg. disableArea() or an extra param on resetArea())?
For example, I might only want certain areas to trigger events if some other area has been triggered beforehand. This would allow AIs to make more erudite decisions based on enemy unit movements around the map as they could enable/disable area events based on how the enemy is moving around the map.
Example: I might have areas defined at two ends of a valley, and in the middle, but only want the middle area to trigger an event if the northern area was entered beforehand.
Also, looking at the C++ code, does resetArea() reset that area for all script environments or just the environment associated with "me"? In other words, if eventAreaFOO() is triggered and player 1 resets that area but player 2 doesn't, the next time a droid enters will player 2 still get the event notification because player 1 had reset that area? It looks like the trigger states (l.id) are currently stored centrally and shared for all environments...?
eventArea<LABEL>
Would it be possible to pass in the label name as a parameter? That way it will be easier to use a single function for all area events and have them reset, etc.
Example:
Code: Select all
areaHandler = function(droid, labelname) {
// reset trigger
resetArea(labelname);
// call some other function that processes the event
if (!allianceExistsBetween(me, droid.player) {
dealWithEnemyEnteringArea(droid, labelname);
}
}
// now use that function to handle three different area events...
this.eventAreaFOO = areaHandler;
this.eventAreaBAR = areaHandler;
this.eventAreaBAZ = areaHandler;
Maybe it would be better to just have eventEntered(areaName, droid)?
(sorry for only realising this just now and not back when the event naming was first proposed)