Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: ERM help and discussion
Thread: ERM help and discussion This Popular Thread is 407 pages long: 1 50 ... 100 101 102 103 104 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
JimV
JimV


Responsible
Supreme Hero
posted September 20, 2011 04:49 PM

Thanks for posting your method, Bersy.  I added it to my test map for WoG 3.58f and it gives the same results as my method (naturally, but I haven't tested every possible case so there may be some for which it works better than my method).  I note that it finds the hex which the target stack is on, and this information could also be passed back from the function.

For those tests, I removed my screening of Fire Shield (29).  It appears to me that when the AI (or an AI creature) casts Fire Shield, it triggers MR1 for every opposing creature and calculates the damage (F) which the Fire Shield will do to that creature, and later, if for example Prayer is cast on an opposing creature, it triggers MR1 again and recalculates the damage.  All of this damage (under MR1 for Fire Shield) is theoretical, not actual (actual damage appears under MF1 as physical damage), so I emphasize again that when the spell number is 29, MR:F damage under the MR1 trigger should be disregarded.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted September 20, 2011 05:50 PM

The larger variant takes the fact that ZVS saves EDI which is pointer to stack structure at MR hook procedure. In some rare ocasions this structure is not global 0..41, but copied to the stack one. That's why I access field Mon->Position (+56) and if it's valid position, then get stack id (otherwise it could be possible to calculate stack id knowing start address of array and address of stack structure).

I checked and found sources of your approach. It relies on wog experience system. On any action a static routine MakeCur is called from almost all game events to get monster stack number by it's structure. If someone wants to disable stack experience system (perhaps, in modules/patches), the code will not be executed and vars changed. Still the MR0-1 will work. This can be checked if not to wogify map.

Thank you for your work

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 21, 2011 02:02 AM
Edited by JimV at 21:50, 21 Sep 2011.

Thanks for the analysis.  It seems your methods are the safest ones to use.

I have amended my method to this:


* get address for valid MR:N
!#UN:V?v1/?v2;
!#UN:P900/?v3; [0-Stack experience disabled]
!#VRv30&v1=358:S8873348; address for actual MR:N under MR1 for WoG 3.58f w/stk exp enabled
!#VRv30&v1=358/v3=0:S39170716; address for actual MR:N under MR1 for WoG 3.58f w/stk exp disabled
!#VRv30&v1=359:S8683268; address for actual MR:N under MR1 for Wog/ERA 1.8 w/stk exp enabled

(At the moment I haven't tested under ERA.)

Previously I had found both 8873348 and 38170716 for 3.58f, but I think the latter did not work for spells cast by stack experience abilities.  Testing without stack experience enabled, I find it works for Hero spells, Santa Gremlin and Faerie Dragon spells, and the Thunderbird's lightning bolt.  The former, 8873348, does not work when stack experience is disabled.  I would not have thought to test this without your analysis.

I have re-updated my WoG 3.58f ERM Help update at http://www.box.net/shared/nv038pb3shsgnsuuum5a

(To those who just downloaded it:  sorry!) (Probably won't be the last update, either.)

Update - on a new subject:

A while ago I mentioned that it might be useful, for mapmakers who like to have puzzles and quests in their maps, to have the ability to write and read external files in ERM scripts.  For example:

Suppose you are playing a map and there is an object called "The Guild of Green Magic", which only your starting Hero can visit to get some sort of bonus.  So you visit the object with that Hero, and get the message, "This is the Guild of Green Magic, yada, yada, yada, before you can join our guild you must pass a test.  You will be given three chances to pass, but if you don't succeed, you must meditate for seven days before trying again.  Are you ready for your first try?"

Naturally you reply "No", and save the game.  Then you visit the object again and make your first attempt.  You come close to succeeding, but fail.  So you reload the saved game and visit again.  This time you are asked, "Are you ready for your second try?"

You fail again, and reload the game from before your first try, but when you visit again, you get, "Are you ready for your last try?"

Say that you fail for the third time, and the Guildmeister says, "Sorry, you can come back and try again on day 48."  (The game day being 41.)  You reload the same saved game again, but get that same message when you revisit the object.

At the start of the game, an external file was saved.  That file contained a counter for the number of tries, and a minimum day number - both zero, to start.  When you visited the object, these numbers were read from the external file.  At the end of an unsuccessful try, the counter was increased by one and written back into the external file.  Loading the saved game did not change the data in the external file.  After you finally passed the test and joined the Guild, the external file would be deleted by the script.

I have written a DLL (XFile.dll) which can be accessed under ERA with Bersy's !!SN:E command to call three functions:  XWrite (write an external file), XRead (read an external file), and XRemove (delete an external file).  User instructions, a sample script, and the DLL are included in XFiles.zip, which can be downloaded at http://www.box.net/shared/1n069e3vc5vixc8l1zk5


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 22, 2011 01:16 AM
Edited by Salamandre at 11:58, 22 Sep 2011.

Very interesting, I was myself looking for something similar to avoid cheap reloads. Thanks.

I have an annoying problem: if in battle I apply (BM:M) a spell changing creature stats (speed) then I surrender, when restarting the game the speed of that creature is modified to what was under the haste spell. Once in 3-4 tries. Works properly only if I quit game and restart. Is it possible that combat manager isn't emptied or something else?

@EDIT: is the EA-1 command which screws the creature stats. Buggy.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 22, 2011 05:41 AM

I had some problems with the spell mechanics in the Shining Force battle script, but no longer recall the details.  The script uses BM:M, but only to show the spell (Bless, Haste, etc.) in the creature information screen.  All attribute effects are applied manually (BM:S, etc.) in that script.  At the start of each battle, the Attack Team creatures have their properties set based on the data tables for the characters (MA:A, etc.).  So the problem would never show up in SF, but maybe it did in early versions of the script.

I have not used BM:M much under WoG 3.58f (Spartan Battle Chess uses it, but only to bind AI creatures so the AI can't move them).  "The Dragon Slaughter" does, but creature properties change so much in that game that I doubt if I would notice a glitch.

We know Attack and Defense skill values can be glitched in 3.58f for creatures which have the Deflect skill under Quick Combat (Ronon's problem in "Star Gate Atlantis Rising").  So I suspect the problem may not be new to ERA but is a carry-over from 3.58f.

I see there are some more typos in the 3.58f ERM Help in the comments under the BM:M command (referring to BR:M instead of BM:M and BG:C instead of BM:C).  I will fix these in a day or two.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 22, 2011 06:38 AM

I moved the speed check to battle scripts and fixed the problem.
My further dilemma is removing fly from a creature on second round.

a) if we give fly with EA-#, it does not work, ability is shown in exp panel but not functioning.
b) if we give fly in BA trigger with flags, then removing it in BR later has no effect.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted September 22, 2011 11:02 AM

Also reading/writing from/to ERM ini files can be used.
UN:N5, UN:N6.
In Era 1.9+ all operations with ini are speeded-up significantly. Multiple reading results in reading from memory cache.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 22, 2011 03:15 PM
Edited by JimV at 15:17, 22 Sep 2011.

@Salamandre, if you are certain of these effects, I will add comments about them to ERM Help.  Another possible suggestion:

In TDS, the EA:O command is used to transfer special abilities to a creature (from another creature, previously set up with EA's) in battle.  Perhaps this will work when EA-(stack) does not?

@Bersy, I forgot about UN:N, despite telling people to read all of ERM Help!  (I did read it, long ago, but never used it, so I forgot it.)  Thanks for the reminder.  It writes strings, but of course strings can be processed into numbers and vice-versa.  Still, XFiles was interesting to do (my first DLL - had to do some googling to find out what they are and how to make one), and may be more convenient when working with numbers.  A real Windows programmer (which I am not) could have added a lot more features to it, and perhaps someone will.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 22, 2011 04:35 PM
Edited by Salamandre at 16:51, 22 Sep 2011.

Well, I was not then sent to Berserker and he found EA-1 bugged the whole thing. Tested and retested. However I am not sure this info should be added after only one issue. Probably if not BM:M is used, EA-1 will not cause havoc.

Also, if too much info is gathered, maybe create a separate read me, between the bugs and one time tested solutions it starts to look heavily stuffed IMO.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 22, 2011 05:17 PM
Edited by JimV at 17:18, 22 Sep 2011.

Quote:
... if we give fly in BA trigger with flags, then removing it in BR later has no effect.


I could not reproduce this in 3.58f with the following test script:

* Hint Test map, Orrin, Santa Gremlins=3, Master Genies=4
!?BR&1000/v997>0;
!!VRv1:Sv997%2; odd or even
!!BM3:F?v2; SG
!!BM4:F?v3; MG
!!VRv2&v1=0:&-3; even:  SG no Fly
!!VRv3&v1=0:|2;  even:  MG Fly
!!VRv2&v1=1:|2;   odd:  SG Fly
!!VRv3&v1=1:&-3;  odd:  MG no Fly
!!BM3:Fv2; SG
!!BM4:Fv3; MG

Okay, I didn't use the BA0 trigger, but I was able to add (or remove) Fly in even rounds and remove (or add) Fly in odd rounds, under BR.  That is, in even rounds the Santa Gremlin stack could not fly and the Master Genie stack could, and in odd rounds the SG could fly and the MG could not.

So, I agree, at this point it is too soon to add anything to the ERM Help.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 22, 2011 06:01 PM
Edited by Salamandre at 04:21, 23 Sep 2011.

Ah ok. I was adding fly in BA

!!VRi:|6; add flying + shot
!!MA:X18/i;

Then tried to remove in next BR but did not work. Will try with battle stack.

Another issue: if we want to haste the highlighted unit at battle round start, using a dialog box (which unit you want to haste) then BM:M or BM:S it does not work for the first unit acting, only for others. The speed new value is added but the movement radius remains same. Guess it is too late.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 24, 2011 04:10 PM

As I mentioned when working on Shining Force, once the movement radius shadow is shown on the battlefield I don't know of a way to change it during that turn.  However, under ERA you can end that creature's turn with a Defend action and then immediate give it a new turn with an SN command.  For example, the Move and Shoot turns for a SF shooter have different speeds and movement shadows.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
solitaire345
solitaire345


Promising
Famous Hero
posted September 24, 2011 08:44 PM

I am sorry for being inactive for a while. I added most of the information I found on the last two pages. However if I missed something, please tell - I'll add more information to the help. Download

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 24, 2011 11:08 PM

There some typos in the comments under the BM:M command:

"You can set those 6 fine with BR:M ..." BR:M should be BM:M.

"You can set these for creatures with BR:M ..."  Ditto.

"And if you use BG:C ..."  BG:C should be BM:C.

These aren't very important - not worth a special update.

Under MR:N, Bersy also gave a slightly different version (different UN:C address, 42231940 instead of 42147184) of his method which applies when running under ERA.  Perhaps the change for ERA could be appended as a footnote at some point?

Thanks again for all your work on this update.  It is an amazing document.


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 25, 2011 06:53 AM

Is there any way to display a message on first turn of battle when we are summoning the opponents?

!?BR&v998=16/v999=15/v1000=0/v997=0;
!!BU:S18/1/93/0/1/1; summon opponent
!!IF:Q1/21/18/1^Text^;

The message is displayed  before the battle screen. If in !?BA, it will be displayed twice, before and after. With SN:X same issue.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
solitaire345
solitaire345


Promising
Famous Hero
posted September 25, 2011 05:36 PM

I am not sure if I understood you right about the time when the message should appear. With this script the message appears only after showing the combat screen

ZVSE
!?BR&v998=16/v999=15/v1000=0/v997=0;
!!BU:S18/1/93/0/1/1; summon opponent
!!IF&i=1:Q1/21/18/1^Text^;
!!VRi:S1;

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 25, 2011 06:01 PM

Thanks, I was testing with tactics and this screwed the order, removed.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted September 25, 2011 06:08 PM
Edited by JimV at 18:24, 25 Sep 2011.


This works for me (in ERA only):

* 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

!?BR&v997=0/-195;
!!IF:V195/1;

!?FU77006&195; happens before BG0
!!SN:Ev30/0/1/1; set TL timers to on

!?TL0&195; 1-second timer
!!BU:S18/1/93/0/1/1; summon opponent
!!IF:Q1/21/18/1^Text^;
!!IF:V195/0;
!!SN:Ev30/0/1/0; set TL timers to off

(!?TL0 - best trigger ever!)

The one-second delay is necessary to prevent the BU:S and IF:Q commands from taking place "in the dark" - since !?BR starts in the dark for round zero, as stated in the ERM Help (unless there are Tactics rounds).  

Update - I was writing this while Solitaire345 posted his solution, which simply selects the second round-zero BR trigger to avoid doing the IF:M "in the dark".  I also tried that but on my system, I saw a brief glitch due to the BU:S summon (dark screen with a patch of the adventure map in the center where the creature was summoned) and decided to get rid of it with the above method.  Had I seen Solitaire345's post I would not have posted mine.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted September 25, 2011 07:15 PM

It is well hidden at end of triggers list, I completely forgot about. Will test it, I always disliked the UN:R6 because it freezes all things around.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
solitaire345
solitaire345


Promising
Famous Hero
posted September 25, 2011 10:19 PM

Umm. Indeed if tactics phase is present, the summoned creature will probably appear too soon with my script..

I don't fully understand the example that JimV posted. When is function FU77006 called? I don't see any function receiver in that script.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This Popular Thread is 407 pages long: 1 50 ... 100 101 102 103 104 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.6138 seconds