Syntax | Triggers |
!?AE#; |
Equip/Unequip artifact trigger: !?AE0; Take off an artifact !?AE1; Put on an artifact The current Hero (!!HE-1) is a Hero-owner Comments. |
!?BA#; | This will be called when any battle
occurs. # = 0 Turn on at start of every battle. # = 1 Turn on at end of every battle. # = 50 !?BA50; is the equivalent of !?BA0; but runs only on the defending side in a multiplayer network battle, and runs *instead of !?BA0; on that side (on the defending computer). # = 51 Likewise, !?BA51; runs instead of !?BA1; on the defending computer in a network battle. Network service: !?BG and !?BF work at both sides and if the variables are the same, they will give you the identical effect at both sides. Only user related actions are not synchronous for both sides and BA0/BA50 and BA1/BA51 triggers make a difference. New BA triggers: # = 52 - called at a battle start at both sides # = 53 - called at a battle end at both sides So at a battle start: 1. If it is an attacker's PC (or non MP game) BA0 is called 2. If it is a defender's PC BA50 is called 3. BA52 is called. At battle end: 1. If it is an attacker's PC (or non MP game) BA1 is called 2. If it is a defender's PC BA51 is called 3. BA53 is called. This means that if you want to have an identical code for BA0 and BA50, you just need to make one section with BA52 header. NOTE. If you want to test scripts in MP mode you cannot do it at the first game turn (day 1). You need to pass one day so all players will have an identical environment. To set up a battle, use the BA Receiver. Note:You may use indirect reference to heroes (copies of info): !!HE-10:... apply changes to the copy of attacker hero info. !!HE-20:... apply changes to the copy of defender hero info. |
!?BF; | This
will be called when a battlefield is prepared for a battle prior to the
combat beginning. It may be used in conjunction with the
BF
Receiver to set up a custom battlefield. Suggestion: do not use !!BU:R command in !?BF trigger and before it. |
!?BG; | This
combat trigger occurs at every action taken by any stack or by the hero
(for spell casting, retreating and surrendering). !?BG0 is called before the action occurs. (Same as !?BG) !?BG1 is called after the action occurs. Variable v997 keeps the number of the current turn: 0 - start turn (after Tactics phase) 1 - second turn 2 - third turn ... Comments: You can use this with the BG Receiver to find a monster stack number (BG:N) and use this number to get access to this monster's set up (!!BR...). |
!?BR; | This
trigger occurs every turn of a battle (for the first turn it
occurs twice). Variable v997 keeps the number of the current turn: -1 - start turn (before Tactics phase) 0 - start turn (after Tactics phase) 1 - second turn 2 - third turn ... Comments: 1. The starting turn (-1,0) goes in "darkness" and you will not be able to show any message, though you can take actions. 2. The turn of a battle (v997) may be not the same if a Tactics phase took place. For the full sequence of triggers, see the detailed listing following the Triggers List. Sequence of Combat Triggers |
!?CM#; |
The trigger occurs when you click the mouse button. It sets up an internal ERM structure that can be used with the CM Receiver to get information about the area clicked as well as disabling the standard right-click function. Comments: Data in the structure will not be saved. This means that you can use it in a receiver section of this trigger. |
!?CM0; | Right-mouse click on the adventure map |
!?CM1; | Mouse
manager trigger for town screen. The trigger occurs when you click mouse button You can also use !!CM receivers with the next commands: TSIFAR and cannot use P. The trigger works for left mouse push (subtype=12), left mouse release (subtype=13) and right mouse push (subtype=14) and also has a corresponding bit in flags. |
!?CM2; |
Mouse manager trigger for Hero information screen. The current hero !!HE-1:... is an active one |
!?CM3; | Mouse manager trigger for Heroes meeting screen. |
!?CM4; |
Mouse manager trigger for battle field. Get the number of position on the battle field (and heroes image) |
!?CM5;
![]() |
Left-mouse click on the adventure map It may be used with all CM receiver commands that you use for right-mouse click: T, S, I, F, A, P, R. |
!?CO#; |
Commander !?CO0; is called before opening the Commander Dialog !?CO1; is called after closing the Commander Dialog !?CO2; is called after buying a Commander in a Town !?CO3; is called after reviving a Commander in a Town
Flag 1000 set to 1 only if the owner
of the hero is a human player who sits before the
screen. You can use !!HE-1:... to get the current hero info and !!CO-1:...to get current Commander info. Vars v998,v999,v1000 as usual shows the position of the current hero on the map. |
!?FU#; | Function with # (integer value 1-30000) called within a block of ERM code by an FU Receiver and followed by code that's part of the function. |
!?GE#; |
This is a "global" event with number #. The # must be first in the Event text (the event title doesn't matter). This number WON'T APPEAR later in message text in the game as long as it's used by a trigger. Example: Text "1230There you are!" transforms to "There you are!" with number 1230. To change a global event, use the GE Receiver. |
!?GM#; |
Saving/Loading trigger. # = 0 - is called right after loading a saved game but before showing the map. # = 1 - is called right before saving the game but after choosing the game to save. |
!?HE#; |
This will be called when any hero attacks an
enemy hero or visits/trades with an allied hero having the specified
hero #. (see format H) To change characteristics of a hero, use the HE Receiver. |
!?HL#; |
Will be triggered whenever a hero gains a level. #=number of hero (-1 = all, see format H) If you have !?HL-1 and !?HL5, for example, first will be processed all receivers for all heroes (HL-1) and then a particular hero (HL5). To change the primary and secondary skills available when a hero gains a level, use the HL Receiver. |
!?HM#; | Take control over every step
a hero takes. It is triggered before the hero takes each step
(not after). So if you check v998, v999, v1000, you get a coordinate of the point
the Hero will move to. This movement cannot be cancelled. #=number of hero (-1 = all, see format H) At triggering moment you can find: HE-1 will refer to a hero who moves. v998,v999,v1000 = x,y and level of the point of destination. Also, flag1000 is set to gamer (1) or AI (0) as usual. If you have !?HM-1 and !?HM5 for example, first will be processed all receivers for all heroes (HM-1) and then a particular hero (HM5). Example: !?HM-1; !!IF:M^Moving!^; !?HM0; !!IF:M^Personal Orin's Moving!^; |
!?IP#; |
Multiplayer
support. If one player's hero attacks another player's hero, there will be the next sequence: a) !?BA0 trigger for "A"(attacker) player switches; b) !?IP0; trigger switches for "A" player c) data transferred to "D"(defender) player: - "A" player's Hero info; - "A" player's Hero Commander info (completely); - v vars set v9001-v10000; - all potentially changed monster statistics; d) all sent data received at "D" player side; e) !?IP1; trigger switches for "D" player; f) !?BA0; trigger switches for "D" player; Now the battle takes place. If "A" player wins, no WoG data transferred. if "D" player wins, there will be the next sequence: a) "A" player goes to wait until "D" player gains levels; b) "D" player's Hero and Commander gain levels; c) !?IP2; trigger switches for "D" player; d) data transferred tp "A" player: - "D" player's Hero sec. skills (all 28), level and exp.; - "D" player's Hero Commander info (completely); - v vars set v9001-v10000; e) !?BA1; trigger switches for "D" player; f) "A" player goes from waiting until "D" player gains levels; g) all sent data received at "A" player side; h) !?IP3; trigger switches for "A" player; i) !?BA1; trigger switches for "A" player; As you can see, monsters, heroes and Commanders statistics should be identical now. As a side effect I can say that 10 sec. skills for Hero is a multiplayer safe rule. All 28 sec. skills transferred in both directions if needed. |
An Event on the map can be a Trigger. The contents and features of the Event are not
significant in any way. The event won't be changed. It is used as an Event Trigger
only. #1- X position of the Event on the map #2- Y position on the map, #3- level (0-ground, 1-underground). An Event must exist at that position on the adventure map. You can refer to the exact position of the event in receivers following the trigger: x,y and level will be stored in v998,v999 and v1000 when the trigger activates. Example: ?!LE10/21/0; This will identify an event at the location x=10, y=21 on the surface map level (0) as a trigger. If a hero trips this event, then all ERM statements following the trigger code will be executed. To change the properties of an event, use the LE Receiver. |
|
Post visit LE trigger | |
!?MF1;![]() |
Trigger for a stack taking physical damage(before an action) used with MF Receiver |
!?MG0; !?MG1; ![]() |
Spell
casting on the adventure map !?MG0; - pre trigger !?MG1; - post trigger Sequence: - player clicks the "cast spell" icon - !?MG0; works out (you can adjust current hero spells) - Magic Book appears and a player chooses a spell - Spell casting - !?MG1; works out (the cast spell number is stored in v997) Example: ZVSE !?MG0; !!IF:M^Magic is ready to cast^; !?MG1; !!VRy-10:Sv997; !!IF:M^Magic was cast. Spell number: %Y-10^; Comments: This doesn't work for AI heroes, only human players. |
!?MM; !?MM0; ![]() |
For
control over scroll text during a battle This trigger works when WoG is trying to show hint text in the scroll field (e.g., "fly here").(See MM Receiver) Comments: The !?MM0 trigger only functions prior to an action being chosen. So, for example, if I cast a spell, the display hints that show up while choosing a target don't occur within the !?MM0 trigger at all. Once the target's been chosen and the spell's been cast, it returns to using the !?MM0 trigger until the next action is taken. |
!?MM1;![]() |
Now you can trigger ERM
code when a player moves the mouse pointer inside the town screen.
It will work when you go over a section and when you go off a section. This trigger works out after standard behavior (usually hint text displaying). (See CM Receiver) |
!?MR; !?MR0;![]() |
Stack Resistance ERM control:!?MR0;!?MR1; !?MR0; works out just before calculating a resistance correction for a stack. And !?MR1 works out after calculating. So here is the sequence: - we have a basic damage from a spell (M,S,D); - !?MR0 is called (M,S,D,F[=D]); - WoG calculates a standard resistance correction (S,M, D->F); - !?MR1 is called (M,S,D,F); - end of correction (F). Here M means a monster type, S means a spell number, D means the basic damage, F means the corrected damage. Standard WoG correction function calculated F from D and returned it. For creatures that have no resistance F=D. (See MR Receiver)
!?MR2 Dwarf-style Magic
Resistance |
!?MR1;![]() |
|
!?MR2;![]() |
|
!?MW0; | Trigger for Wandering
Monsters Called when monster reaches a destination point/hero Comments: It will be called a next turn after monster really reached a position or just before attacking a Hero. Called if only a corresponding flag is set. v997 keep a number of WM that is a caller. (See MW Receiver) |
!?MW1; | Trigger for Wandering
Monsters, called when a monster is killed. Comments: It will be called the turn after a monster is really killed. It's only called if the corresponding flag is set. v997 keep the number of the WM that is the caller. (See MW Receiver) |
!?OB#1/#2/#3; |
This trigger works for any object that has an "entrance" (yellow square in editor).
Note: this includes monsters, artifacts, and resource piles too but does not
include other heroes (use the HL trigger for heroes). #1- X position of entrance on the map #2- Y position on the map, #3- level (0-Surface, 1-Underground). Important. The sequence of finding object triggers: |
!?OB#1; | Alternate format for OB trigger. Turns on for any objects of #1 type. See Format OB. |
!?OB#1/#2; | Alternate format 2 for OB trigger. Turns on for any objects of #1 type and #2 subtype. (See Format OB.) |
!$OB#1/#2/#3; | Post visit trigger is added. It works now for objects only yet. Syntax is !$OB... then all as usual. Note: can work with a type format only (no subtype) as well as x/y/l and type/subtype |
!$OB#1/#2; |
Alternate format 2 for Post visit trigger Turns on for any objects of #1 type and #2 subtype. (See Format OB). |
!?PI;
![]() |
Post Instruction.
This trigger works out a bit later than instruction are executed but after the majority of settings are done for the map. The other specific thing here is that this trigger works out ONLY if you start a new game but not if you load a saved game (so the same way as instructions do). Example: ZVSE !#IF:M^Instr^; !?PI; !!IF:M^Post Instr^; If you start this map, you will have two messages: "Instr" and then "Post Instr". When the first message appears, almost no settings are done for the map and when the second message appears, the most settings are done already. If you load a saved game, you will have no messages at all. |
!?SN;![]() |
In-game sound effects trigger This triggers for any sound (WAV or M82, but NOT MP3). It triggers every time the game is trying to produce any sound. There is a corresponding receiver: !!SN. For the sound effects list, please see Format SN. |
!?TM#; | This is the ERM
equivalent of timed events. # - from 1 to 100 - the number of a timer. To set up a timer, use the TM Receiver. |
!?TH#;
![]() |
Two Triggers for Town Hall access. !?TH#; !?TH0; is called when you enter a Town Hall !?TH1; is called when you leave a Town Hall Comments: 1. You could use the TH1 trigger to check for a new building built in a town. 2. You could also use it to reset the build flag with the CA:R command to allow additional building the same day. |
Sequence
of Combat Triggers with and without a Tactics phase:
Also a sequence of triggers is now:
(without tactic)
BA0 (on the map screen)
(in darkness)
BR(-1)
BF0
(show battle field)
BR(0)
(all actions of first round)
BG0-BG1
BG0-BG1
...
BG0-BR(1)-BG1 (second round started)
(all actions of first round)
BG0-BG1
BG0-BG1
...
BG0-BR(2)-BG1 (third round started)
and so on.
BA1 (on the map screen)
(with tactic)
BA0 (on the map screen)
(in darkness)
BR(-1)
BF0
(show battle field)
(all actions of first tactic round)
BG0-BG1
BG0-BG1
...
BG0-BR(-2)-BG1 (second tactic round started)
(all actions of second tactic round)
BG0-BG1
BG0-BG1
...
BG0-BR(-3)-BG1 (third tactic round started)
and so on
*BR(0)
(all actions of first round)
BG0-BG1
BG0-BG1
...
BG0-BR(1)-BG1 (second round started)
(all actions of first round)
BG0-BG1
BG0-BG1
...
BG0-BR(2)-BG1 (third round started)
and so on.
BA1 (on the map screen)
Note:
1. A new round starts between BG0 and BG1.
2. *BR(0) may have two form. If a player has a tactic phase, this will
be:
BG0-BG1
BR(0)
Though if AI has a tactic phase, this will be:
BG0-BR(0)-BG1
So if you do not use BG1 trigger it will be the same.
I did not test it for both AIs and both players, but
think this
will be the same cases.