Events are written in a form procedure EVENT_NAME(EVENT_PARAMETERS);
like so:
procedure OnHouseBuilt(aHouseID: Integer);
begin
// code
end;
Version column description:
"-" Means this event was added from the start.
"5678" Means this event was introduced in revision 5678.
"-5678" Means this event was removed in revision 5678.
- OnCampaignMenu
- OnGroupBeforeDied
- OnGroupDied
- OnHouseBuilt
- OnHouseDamaged
- OnHouseDestroyed
- OnHousePlanPlaced
- OnMapObjectClick
- OnMissionStart
- OnPlayerDefeated
- OnPlayerVictory
- OnScriptButtonClick
- OnScriptMarkerClick
- OnTerrainTrigger
- OnTick
- OnUnitBeforeDied
- OnUnitDied
- OnUnitGiven
- OnUnitOwnerChanged
- OnUnitOwnerChanging
- OnUnitTrained
- OnUnitWagonEnteredHouse
- OnUnitWoundedByHouse
- OnUnitWoundedByUnit
- OnWarriorEquipped
Ver sion |
Event description | Parameters and types |
---|---|---|
8250 | OnCampaignMenu A campaign menu has been opened. Campaign-only action! |
|
10626 | OnGroupBeforeDied Group will cease to exist in a moment (last current member will die). The process is irreversible Most of the group properties can still be accessed Note that groups can be rearranged, split and joined. Single warrior is a group too. |
aGroup: Integer; |
10626 | OnGroupDied Group has ceased to exist (all current members have died). The process is irreversible Most of the group properties can no longer be accessed Note that groups can be rearranged, split and joined. Single warrior is a group too. |
aGroup: Integer; |
- | OnHouseBuilt A house has finished construction |
aHouse: Integer; |
7820 | OnHouseDamaged A house got damaged |
aHouse: Integer; aAttacker: Integer; // UID of the attacked, can be a house, a unit or noone (e.g. if damage was applied from script) |
- | OnHouseDestroyed Occurs right before house gets destroyed |
aHouse: Integer; aDestroyerIndex: Integer; |
- | OnHousePlanPlaced HouseFace added in r10532 |
aPlayer: Integer; aX, aY: Word; aType: TKMHouseType; aFace: TKMHouseFace; // house facing direction |
14230 | OnMapObjectClick | aPlayer: Integer; // player who clicked the object aX, aY: Word; aCoord: Byte; aEngName: AnsiString; // object name as it was when it was clicked (note, due to multiplayer lag it could have been different than right now) |
- | OnMissionStart Happens right before OnTick(1) |
|
- | OnPlayerDefeated Happens when player gets defeated |
aPlayer: Integer; |
- | OnPlayerVictory Event is fired right before victory gets registered. It's a good time to set the mission highscore or passing campaign data |
aPlayer: Integer; |
7996 | OnScriptButtonClick Occurs when player clicks on a button in the message. Note that click events may come in late and/or repeated. |
aPlayer: Integer; // Player who clicked the button aTag: Integer; // Tag of the button |
12950 | OnScriptMarkerClick Occurs when player clicks on an interaction marker Note that click events may come in late and/or repeated. |
aPlayer: Integer; // Player who clicked the marker aMarkerId: Integer; |
5102 | OnTerrainTrigger Happens when a unit enters terrain trigger area (or gets spawned in to it, or exits a house) |
aTriggerId: Integer; aUnit: Integer; aX, aY: Word; |
- | OnTick Happens right after OnMissionStart First tick is '1' |
aTick: Integer; |
10626 | OnUnitBeforeDied Unit will cease to exist in a moment. The process is irreversible Most of the unit properties can still be accessed |
aUnit: Integer; aKillerOwner: Integer; |
- | OnUnitDied Unit has died. The process is irreversible Most of unit properties can no longer be accessed |
aUnit: Integer; aKillerOwner: Integer; |
7023 | OnUnitGiven | aUnit: Integer; |
10630 | OnUnitOwnerChanged Occurs after a unit changes owner. When a unit changes its owner it actually get silently killed and a new unit gets spawned for a new owner in its place. |
aOldUnit: Integer; // UID of the unit that was killed (since it is already dead, it can't be used in any States or Actions). aNewUnit: Integer; // UID of the new unit that was spawned (-1 if it failed) |
14474 | OnUnitOwnerChanging Occurs right before unit changes owner. When a unit changes its owner it actually get silently killed and a new unit gets spawned for a new owner in its place. |
aUnit: Integer; // UID of the unit that will be silently killed (since it is doomed, it must not be used in any Actions). aNewOwner: Integer; // Player who will get the new identical unit |
- | OnUnitTrained | aUnit: Integer; |
12050 | OnUnitWagonEnteredHouse Occurs when wagon has successfully entered a house. Right before wares get transferred and the wagon is gone |
aUnit: Integer; aHouse: Integer; |
4349 | OnUnitWoundedByHouse A unit was attacked by an enemy house (surely a Tower) |
aUnit: Integer; aAttackerHouse: Integer; |
4349 | OnUnitWoundedByUnit A unit was attacked by an enemy unit |
aUnit: Integer; aAttackerUnit: Integer; |
- | OnWarriorEquipped | aUnit: Integer; aGroup: Integer; |