New ERM for 3.58 - August 24, 2004 FLAGS: System Flag changes and additions: 1) Flag 996 is automatically cleared (set to False) when any !!LE command executes and is set to 1 (True) if there is no Placed Event at the location specified by the LE command (you know that a Placed Event is removed after usage sometimes). Flag 997 and 998 are set as follows: 2) Flag 997 returns the MP state of a battle. =0 (False) if we have a local battle =1 (True) if we have a network battle Then if Flag 997=1, then Flag 998=0 if an AI attacks a Human player at a distant PC Note that the battle here runs at only ONE PC, but this PC is a distant one for the current active PC. Flag 998=1 if we have a Human vs Human battle. Here we have a real MP battle. You may use both flags in BA0 or BA50 trigger like this: !?BA0&997/998; ... Here we go if this is a Human vs Human MP battle 3) For the previous two system Flags (already mentioned in ERM Help), here's a summary of their meanings: Flag 999 means "Is the User sitting before a screen the Current player?" Flag 999 is set to 1 (True) if the current player (when trigger worked out) is a player "here" and 0 (False) if he or she is at another (remote) PC. For example, a mouse click trigger activated during another player's turn. For the AI, Flag 999 will always be 0. If flag 999 is set, you can be sure that this is a human and he is here. Flag 999 is working for all triggers Flag 1000 is a Human/AI owner check and also real versus theoretical battle check. =1 (True) - Human =0 (False) - AI For battle triggers (e.g., !?BA0, !?BG, !?BF, !?BR, etc.) Flag 1000 is a check for a real vs. theoretical AI battle. If Flag 1000=1 (True), it means there's a real battle (at least one human opponent). If Flag 1000=0 (False), it means that it's a theoretical AI-only battle. VARIABLES: 1) Trigger-based local variables: y-1...y-100 are integer variables e-1...e-100 are floating point variables You may use them in the same places that you use y and e variables now. Specific features: 1. They are NOT saved in the saved game. Actually every trigger section will run completely and you cannot save and load a game being inside a trigger section. 2. These variables are local for every trigger and if even one trigger works out inside another trigger section, they will have a different set of variables. As you can see you cannot pass values from trigger to trigger using these variables. 3. All variables are set to 0 at any trigger start, so you can use this as a default value. 4. All functions called from a particular trigger can access and share that trigger's set of variables, since they're trigger-based and not function-based. 2) New hero variables (now there's 200): w101..w200 These work everywhere that the first 100 w variables work except for one exception: !!HT:W There you can use only the first 100 w variables. NEW TRIGGERS: BA52, BA53, CM5, GM0, GM1, MF1, MG0, MG1, MM0, MM1, MR0, MR1, MR2, PI, SN, TH0, TH1 1) Two new triggers for start/end of battle: !?BA52; !?BA53; !?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: !?BA52 - called at a battle start at both sides !?BA53 - 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 one). You need to pass one day so all players will have an identical environment. 2) New trigger for left-mouse click on the adventure map: !?CM5; It may be used with all CM receiver commands that you use for right mouse click: T, S, I, F, A, P, R. 3) Two new Triggers for Saving/Loading: !?GM0; !?GM1; !?GM0 - is called right after loading a saved game but before showing the map. !?GM1 - is called right before saving the game but after choosing the game to save. Example: ********** ZVSE !?GM0; !!IF:M^Loaded^; !?GM1; !!IF:M^Saving^; ********** Comments: !?GM1 will also be called every time the game performs an autosave (i.e., each day after pressing the End Turn button). If you wish to prevent this for some reason, you can disable the autosave with the UN:J5 command. Normally this isn't advisable, however, as the autosave provides an important backup for the player in case anything goes wrong. 4) New trigger for a stack taking physical damage: !?MF1; !?MF1; (before an action) 5) Two new triggers for 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. 6) New Trigger for control over scroll text during a battle: !?MM0; (or just !?MM;) This trigger works when WoG is trying to show hint text in the scroll field (e.g., "fly here"). 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. 7) New Trigger for town screen when you move the mouse over an object: !?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). 8) New Combat Triggers for Stack Resistance ERM control: !?MR0; (or just !?MR) and !?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. 9) New Trigger for Dwarf-style Magic Resistance: !?MR2; !?MR2; will work out when the game calculates dwarf-style magic resistance. You may use !!MR and other triggers. !!MR:N, !!MR:M works as before (described in !?MR0 and !?MR1 trigger section). The !!MR:F here is used as a percentage (0..100) of a chance for the spell to work. Example: ********** ZVSE !?MR2; !!MR:F0; all creatures are completely immune to all ********** 10) New trigger: !?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. 11) New Trigger for sound support: !?SN; 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. 12) Two New Trigger 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. NEW RECEIVERS (and commands for them): CB, EA, EX, IP, MF, MM, MP, MR, SN 1) New object receiver (Other Objects page): !!CB Creature Bank setup. !!CBx/y/l:... - receiver Commands: M$1/$2 - set/get/check a bonus creature type $1 and number $2 The number of bonus creatures should be >0 and <128. To remove bonus creatures, set it to type -1 and number 0. G#1/$2/$3 - set/get/check a guard creature in slot #1 (0...7), to type $2 and number $3. R#1/$2 - set/get/check a resource bonus. Resource type #1 and amount $2. You may set all 7 resources simultaneously. T$ - set/get/check whether CrBank is taken already (1) or not yet (0). Note, that if you reset a bank to not taken (set to 0), you still should set at least one guard stack unless you want the next hero that visits to get the treasure for free. V$ - set/check/get a word of visiti...
keraj8301