Giving us some AI eventhandlers would greatly help the community to influence the AI behaviour more effectively.
A few simple eventhandlers would open a massive amount of possibilities.
Here is a list of what I would deem useful:
- HandleKnowsAbout (Triggers when the knowledge of a unit is about to change)
- unit: Object
- target: Object
- knowledge: Number
- cause: String - reason for the change of knowledge, could be something like "heard", "seen", "group", "shotby" or whatever the engine offers...
- HandlePathing (triggers when unit tries to move somewhere. Return array of points to define a custom path, empty Array to cancel(fail) the movement or false keep engine behaviour)
- unit: Object
- points: Array
- issuedBy: - what caused the move? (unit, waypoint, script, combatrelated)
- DetectedMine
- unit: Object
- mine: Object
- HandleSuppression (return new suppression value or false for default)
- unit: Object
- suppression: Number
- source: Object - Unit that caused the suppression
- instigator: Object - Person who pulled the trigger
- TargetChanged (triggers when a new target is assigned to the unit)
- unit: Object
- target: Object
- CombatModeChanged
- unit: Object
- combatMode: String
- HandleReload (return magazine name or false)
- unit: Object
- weapon: String
- magazine: String - magazine name it tries to reload or "" if none is found
- HitNear (FiredNear uses the position of the shooter, this uses the position of the impact and parameters similar to HitPart)
- unit: Object
- shooter: Object
- bullet: Object
- position: Position3D
- velocity: Vector3D
- ammo: Array