|
|
JimV
Responsible
Supreme Hero
|
posted September 26, 2011 03:45 AM |
|
|
@Solitaire345, the FU77006 is described in the Events section of the ERA 1.5 Help document - quote:
-----------------------------------
77006 - Battle: Who Moves?
Decision on what stack will move now.
Parameters (2): Side (0 - left, 1 - right) / Stack number (0..41)
----------------------------------------
It is a very useful event (trigger), but may not be necessary in the script. It triggers before BG0, so in my initial trials I was hoping it would take place after the battlefield screen appeared, but this turned out not to be the case (without Tactics), so I added the TL0 trigger to it. The one-second delay might be enough if I had set it under the BR trigger instead of the FU77006 trigger, but I did not test this. Testing was a little tedious because I was editing a WoG 3.58f test map, but then copying it into a very-modified Heroes directory (Shining Force) which has ERA 1.8.
As I said, TL0 is my favorite trigger, but Bersy has disabled it under ERA because it can slow a game down (since it causes a trigger search every second). So I enable it before using it and then disable it afterwards. There are a lot of cases where I want a trigger that occurs right after some other event.
|
|
solitaire345
Promising
Famous Hero
|
posted September 26, 2011 04:43 PM |
|
|
Oh.. I forgot about these triggers. I'll add them in next ERM help update. I also found that you can use regular triggers with their numbers (As function numbers. For example !?FU30315; equals !?AE0; trigger).
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted September 26, 2011 06:30 PM |
|
|
Maybe you noticed it, in "other objects" column, there is a problem with last example.
Also, in BM trigger, at BM:F, I found that we can check for all MA:X flags as well. Probably most people already knew it, I didn't, and there is no explicit hint about (it says "as for MA:X" but we can guess it is about procedure, not using previous flags).
____________
Era II mods and utilities
|
|
Bersy
Honorable
Supreme Hero
|
posted September 26, 2011 06:43 PM |
|
Edited by Bersy at 18:52, 26 Sep 2011.
|
ZVSE
; Script: Universal Battle Rounds
; Version: 1.0
; Requires: Era 1.5+
; Uses 5 global v-vars: v100-v104. Feel free to change.
; v100 - real tactics phase will take place
; v101 - visible round ID
; v102 - real round ID (not counting fake and tactics rounds)
; v103 - [implementation specific, dont rely on it] zero round flag if tactics takes place
; v104 - [implementation specific, dont rely on it] is current BR trigger native or generated by script
!?BA0;
; y1-y2 - heroes numbers
; y3-y4 - heroes tactics
; y5-y6 - heroes tactics states
!!BA:H0/?y1 H1/?y2;
!!HEy1:S19/?y3 R4/?y5;
!!VRy4:S0;
!!HEy2&y2>=0:S19/?y4 R4/?y6;
!!VRv100:Sy3-y4;
!!VRv100&v100>0/y5=0:S0;
!!VRv100&v100<0/y6=0:S0;
!!VRv100&v100<>0:S1;
!!VRv101:S-1;
!!VRv102:S-1;
!!VRv103:Sv100;
!!VRv104:S1;
!?BR&v104=1;
!!VRv102&v997>=0/v103=1:+1;
!!if&v100=1:;
!!VRv101&v997<>-1:+1;
!!el:;
!!VRv101:+v103;
!!VRv103&v103=0/v997=0:+1;
!!en:;
!?FU77006&v100=1/v997=-1/v101=-1;
!!VRv101:+1;
!!VRv104:S0;
!!FU30302:P; call BR trigger
!!VRv104:S1;
!?BR;
!!IF:M^Tactics takes/took place: %V100
WoG round ID: %V997
Visible round ID: %V101
Real round ID: %V102^;
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted September 26, 2011 07:22 PM |
|
|
Quote: (!?TL0 - best trigger ever!)
Sorry but after reading the help, I get nada from. How to use your TL example? in ERM help we can only get C, E and T. How to make work !?TL0 for example?
From ERM help:
"To see how it works, you can use the next ERM code:"
!?TL#[...](typos btw)
Where to place it? It works nowhere, it's not like an object to visit and enable...is !!SN calling it?
____________
Era II mods and utilities
|
|
solitaire345
Promising
Famous Hero
|
posted September 26, 2011 09:02 PM |
|
|
Quote: Maybe you noticed it, in "other objects" column, there is a problem with last example.
Uhh.. One missing bracket messed it all. Sorry.
Quote: Also, in BM trigger, at BM:F, I found that we can check for all MA:X flags as well. Probably most people already knew it, I didn't, and there is no explicit hint about (it says "as for MA:X" but we can guess it is about procedure, not using previous flags).
Changed 'as for' to 'the same as in'. Hope it's better now.
Added a new page with description of new ERA events (it's right above the triggers list)
Download
I'm currently making a new format FL, which would store all values of monster flags. I will include it in next update. Added. Link updated
____________
|
|
JimV
Responsible
Supreme Hero
|
posted September 26, 2011 11:23 PM |
|
Edited by JimV at 07:00, 27 Sep 2011.
|
Quote: How to make work !?TL0 for example?
From (WoG 3.59) ERM Help:
--------------------------------------
Real-Time Timer (!?TL#;)
# = 0 - period of call is 1 second
# = 1 - period of call is 2 seconds
# = 2 - period of call is 5 seconds
# = 3 - period of call is 10 seconds
# = 4 - period of call is 60 seconds
-----------------------------------------
"Real-Time" means clock time, as opposed to game-time. The !?TM trigger is based on game-time (game days); if it is set for intervals of 1 game day, it executes once for each game day. Similarly, the TL0 trigger executes once for each second on the computer clock (or thereabouts).
If you tried the sample scripts in the 3.59 ERM Help and they didn't do anything, recall that Bersy disabled the WoG 3.59 TL triggers by default in ERA (see ERA 1.5 manual). That was a good idea. It is better to be able to enable them (using the SetOptions procedure given in the ERA 1.5 Help manual) when you need them, and then disable them after use, so they are not triggering all the time, as they would otherwise do.
Example: you want something to occur just after a Hero leaves a certain town (under certain conditions), and it has to occur on the Adventure screen, not the town screen. You can check for a click on the town check-mark (exit), and enable the TL timers. Then under the TL trigger, you perform the desired action and then disable the TL triggers again. In WoG 3.58f I could sometimes simulate a delay of that sort by testing for a characteristic sound file being played or checking a VR:T value (I mean a delay while the program finishes some activity, not a frozen delay), but what I really wanted was a real-time timer. Thank you, WoG 3.59 team and Bersy in particular.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted September 27, 2011 07:50 AM |
|
|
I still don't get it... Let's say we need to display a message 10 seconds after visiting an object.
ZVSE
* v30 stores SetOptions address
!#VRz1:S^Angel.dll^; store dll name
!#SN:Lz1/?v2; now v2 holds dll ID
!#VRz1:S^SetOption^; store function name
!#SN:Av2/z1/?v30; get function address to v30
!?GM0;
!!VRz1:S^Angel.dll^; store dll name
!!SN:Lz1/?v2; now v2 holds dll ID
!!VRz1:S^SetOption^; store function name
!!SN:Av2/z1/?v30; get function address to v30
!?OB10/10/0;
!!SN:Ev30/0/1/1; set TL timers to on
!?TL0;
[?]
Which function is stored in v30? And what contains this function?
@solitaire
Thank you, all looking great!
____________
Era II mods and utilities
|
|
Bersy
Honorable
Supreme Hero
|
posted September 27, 2011 10:41 AM |
|
|
[SetOption function is deprecated in 1.9+ and thus does nothing. By default binary patch for memory turns TL off. Still manual !!UN:C command can be used to switch TL on the fly.]
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted September 27, 2011 11:45 AM |
|
|
|
mister_kalu
Known Hero
|
posted September 27, 2011 04:45 PM |
|
|
simple question
how i add more hit points to monster if a specific hero ,( f.e.HE45) controls him?
is with W variables ?
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted September 27, 2011 05:39 PM |
|
|
ZVSE
!?BR&v997=0;
!!BA:H0/?y-98;
!!BA:H1/?y-99;
!!DO31000/0/20/1&y-98=45:P;
!!DO31000/21/41/1&y-99=45:P;
!?FU31000;
!!BMx16:T?y1;
!!FU&y1<>$:E; $=ID
!!BMx16:H#; #=new HP
____________
Era II mods and utilities
|
|
crvsdd
Tavern Dweller
|
posted September 30, 2011 03:04 AM |
|
|
More advanced question
Say I want to give hero XYZ the following properties:
1) If XYZ is present in combat, and at anytime all active enemy troops has "Slow" spell on them, then combat ends immediately, with XYZ as winner.
2) The defeated enemy is removed from the map after battle, but after n days, re-appears on the map with all surviving troops when condition (1) occured, in the same spot where he was defeated.
3) player controlling XYZ chooses what the value of n is (say the options are 0,1 and 2.
Any clue?
|
|
Aleee
Known Hero
|
posted September 30, 2011 08:02 PM |
|
Edited by Aleee at 20:02, 30 Sep 2011.
|
If you really want clues, not ready solutions, then:
1) Use !!BM:G in cycle to check all enemy creatures. If they're all slowed save the hero's ID (!!BA:H), his owner ID (!!HE:O), his coordinates (!!HE:P) and finish the battle (!!BU:V). Set some flag to 1.
2) Set the timer which activates every day. Let it count days when the flag you chose becomes 1. After "n" days use !!HE:P and !!HE:O (remember, you saved heroes' ID, owner ID and coordinates) and simply place him on the map. Null all used variables and flags.
If there is a possibility that there may be a couple of such heroes, you'll have to extend the script and use more variables checking on how many heroes are already "hidden".
3) What do you mean saying "control"? There are dozens of different ways.
|
|
Hero_of_Light
Responsible
Supreme Hero
|
posted September 30, 2011 09:52 PM |
|
|
I've been browsing Gnollking's artifact scripts and i came up with some combination artifact ideas. I thought i'd use those WOG blank artifacts for this. I have some questions though.
First of all how can you change the place an artifact is equiped? for instance how can you make a head artifact to be equiped on the shoulders?
Secondly, one of Gnollking's scripts gives Expert Archery when the Golden bow is equiped. However, if the hero has all secondary skill slots full will it work? I would like to know if there is a way to add this bonus as a Hidden Skill, so that it will work always. Does anyone know how to do that?
____________
Not idly do the leaves of Lorien fall.
|
|
Aleee
Known Hero
|
posted September 30, 2011 11:16 PM |
|
|
Quote: First of all how can you change the place an artifact is equiped?
!!UN:A
Quote: I would like to know if there is a way to add this bonus as a Hidden Skill, so that it will work always.
This is exactly how !!HE:S works.
|
|
JimV
Responsible
Supreme Hero
|
posted October 01, 2011 06:09 PM |
|
|
I have updated XFiles.zip at
http://www.box.net/shared/1n069e3vc5vixc8l1zk5
to include some more functions.
To install, extract the Data, EraPlugins, and Maps folders into your Heroes3-Era folder.
This dll allows a user to read and write external binary and bmp files with ERM commands within a Heroes3/Era game. External binary files can be used to save numerical game data for quests and puzzles, so that the mapmaker can control how many tries a player gets, regardless of whether the player saves and reloads it between tries.
External bmp (bitmap) files can also add a few features to a game.
Advantages:
1) Like external files displayed with !!IF ERM commands, but unlike DEF frames, external bmp's can have full RGB resolution.
2) Unlike IF displays, the user can specify the location of external bmp's anywhere within the 800x600-pixel Heroes screen, with the DrawBmp function.
3) Unlike IF displays, but like DEF frames, the external bmp's can be masked onto the existing features of the Heroes screen. This is done by creating a mask for the screen region using SaveMask, then drawing the mask using DrawBmp. When creating a mask, as with a DEF frame, the object to be drawn is surrounded by a uniform color which will be treated as transparent. In DEF's, this color is usually aqua (R=0, G=255, B=255), but any color can be used. The color at pixel (0,0) (top-left corner) of the external bmp is assumed to be the transparent color.
Disadvantage: the Heroes program does not know the external bmp has been drawn, so it will erase it as soon as it refreshes the screen. This can be prevented in three ways:
1) Freeze the Heroes screen with a delay. One of the arguments to DrawBmp is a delay time in milliseconds.
2) As long as a Heroes Dialog Box is active, Heroes will not refresh the part of the screen which is outside the active DB. So an external bmp can be drawn outside a DB and it will not disappear until the DB is exited - unless the player drags the mouse pointer over the external picture which will wipe it away, tile by tile (32x32). To make this less likely, the CenterPtr function can be used to position the mouse pointer inside a DB.
3) My favorite trigger !?TL0 can be actived using the SetOption function of Angel.dll under Era 1.5 and Era 1.8 to repaint the external bmp faster than Heroes can erase it (with no flicker if the right delay timing is used), until a count is exceeded or some other trigger (such as an Era keypress event, or the release of a mouse button) disables TL0. Animation can be done using this method, by drawing different frames of an animation at different TL0 triggers.
All three methods are illustrated in the inclosed test map, "XFiles Test". Its ERM script was written for and tested under Era 1.8. Era 1.8 can be obtained in self-installing form (over Heroes 3 The Shadow of Death or Heroes 3 Complete, not over an existing WoG installation) at:
http://heroescommunity.com/viewthread.php3?TID=34324 (third post)
Other versions of Era may not have the SetOption function, in which case the XFiles.erm script in "XFiles Test" will need to be updated with whatever new method can be used to enable and disable TL0.
|
|
Bersy
Honorable
Supreme Hero
|
posted October 01, 2011 07:43 PM |
|
|
$4EDCC5 - code location of timer hook.
$E8, $C6, $A1, $06, $00 - bytes to turn on
$E8, $E6, $8B, $28, $00 - bytes to turn off
The $4EDCC6 integer value can be saved, rewritten and restored to the previous state after work.
|
|
JimV
Responsible
Supreme Hero
|
posted October 01, 2011 08:56 PM |
|
|
Bersy, thanks very much for posting the new method of enabling and disabling !?TL# triggers. There are times when they provide unique capabilities. I will be busy on other things for a while, but when I get a chance I will update my demo map to use the new procedure.
|
|
solitaire345
Promising
Famous Hero
|
posted October 01, 2011 10:17 PM |
|
|
Update. Several typos, added list of flags to format table and a note that mithril (resource number 7) cannot be set as reward for defeating monsters (error message in game suggested that 7th resource is okay o set).
Download
Also some questions to Bersy or anyone else who knows how stuff works inside the game:
1. Why there are several identical strings in the exe? For example the string './WoG.ini' is there nine times. Can eigth of them be removed and all pointers set to the remaining one? (Didn't have time to check how they are used in the code. If they are changed at some point, then of course the can't be deleted)
2. I have also found the load game function that calls several functions which load stuff that was added in WoG. It was obvious that data like town demolitions, Commanders and creature experience, but there were also some functions looking for sections in the savegame that begin with NTWN and SPL0 (I named them LoadNewTown and LoadSpell in my disassembly). Are they fully implemented and usable or do they need finishing? (Also, what does function LoadB1 (sstarts at 0x00706862) do?)
|
|
|
|