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 150 ... 156 157 158 159 160 ... 200 250 300 350 400 407 · «PREV / NEXT»
JimV
JimV


Responsible
Supreme Hero
posted August 10, 2012 05:40 PM

I don't think I understand the question ("Is it my failure in reading manuals again, or does DL:N really crash if dialog was loaded and not shown?"), but I have tried these two tests, in hopes of accidentally lurching upon an answer:

a)
ZVSE

!#VRz101:S^SFDL1CHR.TXT^;

!?CM5; check left-click on adventure screen:  Cast Spell
!!CM:I?v1; [Area clicked: v1]
!!FU&v1<>8:E; exit if Cast Spell button not clicked
!!CM:R0;  [Disable standard right-click operation]
!!DL1:Nz101;

(No DL:S show command; went on about my business in the map and no crash occurred.)

b)
ZVSE


!#VRz101:S^SFDL1CHR.TXT^;
!#VRz102:S^NEWDL2Mx.TXT^;

!?CM5; check left-click on adventure screen:  Cast Spell
!!CM:I?v1; [Area clicked: v1]
!!FU&v1<>8:E; exit if Cast Spell button not clicked
!!CM:R0;  [Disable standard right-click operation]
!!DL1:Nz101;
!!DL2:Nz102;
!!DL2:S;

!?DL&v998=2/v999=6/v1000=12; left-click on Hint Box
!!DL:C1;

(Parsed DL1, but did not show it, then parsed DL2 and showed it.  No crash.)

It took me about a month of repeated crashes before I found out what will and will not work with the DL command, by trail and error.  The main rules I learned:

1) When changing a template item in ERM, always add /1 to the end of the !!DL command.

2) Don't try to change a hint text with !!DL once it has been set.  Instead, assign it to a permanent variable, set an (empty) hint using the permanent variable, and then to change the hint, change the contents of the permanent variable.

(Note to novices:  no, this does not mean I have mellowed and will do work for you that you could do for yourselves - this is in response to Solitaire345, to whom we all owe a lot.)

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


Promising
Famous Hero
posted August 10, 2012 06:41 PM
Edited by solitaire345 at 18:01, 12 Aug 2012.

Those rules I know too.

I have also tested loading a template twice by entering !!DL1:N^GrottoDlg.txt^ command in ERM console twice and successfully crashed the game.

Typing into console !!VRz1:S^GrottoDlg.txt^; and then !!DL1:Nz1; twice did not crash.

I guess third rule should be something like Use direct ERM text in DL receiver only if you know EXACTLY what are you doing and what will happen in each possible case


Edit:
And some tricks I came up while trying to make the Smugglers' Hideout do what I want it to.

Remove artifact from hero. This one properly removes all bonuses and executes !?AE0 trigger.
!!SN:E7411341/1/[HeroID];          v1 = GetHeroStruct_71168D(signed int HeroID)
!!SN:E5123648/2/v1/[Slot Num];     RemoveArtFromHero_4E2E40(HeroStruct *this, int Slot)


Set dialog hint to any string. Main advantage of this one is that you can use ERA's slots (SN:M) for setting and updating hints without using a range of z variables.
!!SN:E7510739/1/[DlgID];             v1 = GetDlgStruct_729AD3(DlgID);
!!SN:E7509967/2/v1/[ItemID]/[Hint];  SetDialogHint_7297CF(Dlg, ItemID, Hint);

____________

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


Responsible
Supreme Hero
posted August 14, 2012 12:35 AM

Thanks for the information, Solitaire345.  Now for something completely different:

Quote:
... Based on what OxFea said above, and screen-capturing some Chain Lightnings, first there are hard-coded white/light-blue arcs between stacks, then all stacks display the lightning-strike animation, roughly simultaneously.  It would cost much more to replace the hard-coded arc with something else, but it could be done. ...



I have added an example of this to the LostTempleDemo.zip package at https://www.box.com/s/a8a7accc0b5436638aa5  - to see the example, extract the zip file into an Era 2 Mods folder, start the Lost Temple map, and use Orrin to cast a Chain Lightning spell.  The spell has the same effect (cost and damage) as Chain Lightning, except that it uses Fireballs instead of Lightning, so creatures which are immune to Fireball are immune to it.  It is probably not the "Chain Fire" spell that anyone but myself envisioned but since it is entirely coded in ERM it could be altered to suit other preferences.

I don't expect anyone to use it, but it was fun to do, and shows some possibilities of ERM and Era which may not have been obvious to everyone.

As an after-thought, I am considering starting the spell with the fireball leaving the casting Hero's hands and traveling to the first target.  This does not happen with Chain Lightning, but might be an interesting effect.

There are two versions of the spell script in the map.  The first version used a solid arc between targets, similar to Chain Lightning, but I like the second version with a traveling ball of fire better.  To see the first version, add ZVSE at the beginning of its Timed Event (in Lost Temple.h3m) and remove the ZVSE from the second version.

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


Famous Hero
posted August 14, 2012 09:53 PM

Where can I find the def of the adventure object "Crystal Cavern"? (Crystal Dragon dwelling)

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


Responsible
Supreme Hero
posted August 15, 2012 01:16 AM
Edited by JimV at 01:22, 15 Aug 2012.

1) Download and install Grayface's Map Editor Patch 3.3, if you haven't already.  (I think it comes automatically with Era 2.)

2) Open any map in the Map Editor and place a Crystal Cave on it, if the map does not already have one.

3) Right-click on it and select Advanced Properties.  The dialog this brings up shows the DEF name used for the object (in this case, AVGcdrg.def).

If you don't know where AVGcfrg.def is stored, read the post "Introduction to Modding and Scripting".  By the way, no offense intended, but that would be a more on-topic post to ask such questions, as DEF's and ERM are different topics.

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


Promising
Famous Hero
of infamy
posted August 16, 2012 04:10 AM
Edited by kegolo at 04:11, 16 Aug 2012.

A while ago I think someone asked if removing the wait button was possible, and Solitaire said it was easy to just add the wait bit to each stack at the start of each round. And that works, but here's a problem: Creature order is now reversed, so all the slow creatures go first. That's just what happens when all creatures wait. So I instead did

!?BG0&1000;
!!BG:A?y1; !!BG&y1=8:A3;

which is even easier and essentially does the same thing as what I wanted (no wait button) but for the AI this is bad. Humans obviously will not press the wait button (which now says defend) unless they want to defend, but the AI doesn't know about this. So they strategically wait for a better time to attack, and now defend instead. I would rather not dumb down the AI any more than they already are.

Any suggestions? I'm sure I could concoct a method to store all stack speed, find the reverse order, change speed each round and then have all stacks wait, and then perhaps revert speed back, but I was hoping you smarter fellows might have a better solution...

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


Responsible
Supreme Hero
posted August 16, 2012 04:40 AM
Edited by JimV at 04:51, 16 Aug 2012.

From the Era manual, New Events:

Stack receives move in battle ^
!?FU77006;

Parameters: Side (0 – left, 1 – right), stack number (0..21).

Example:

1.!?FU77006;
2.!!SN:X0/0; in the battle, only a hero’s first stack will receive the right to a move

With this command you can get (X?y1/?y2) which side and stack is about to get its turn next, and/or change it to another stack.  E.g., if an AI stack waits, save its stack number and side and set a flag so that FU77006 will force it to take the very next turn (subtract 21 from side 1's BG:N? stack number under FU77006).  The same could be done for human-player stacks to eliminate Waits for them (or just disable or re-assign the Wait button and W hot-key).

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


Promising
Famous Hero
of infamy
posted August 16, 2012 05:16 AM

lol the only problem is...how to test? Code is simple enough, but how to make the AI want to wait. Know of a certain creature lineup that would force a wait from the AI? It happens all the time when I don't need it too...

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


Responsible
Supreme Hero
posted August 16, 2012 05:29 AM

I think generally a fast, walking AI creature will wait against archers if it can't reach them in one turn, and providing it has no archers on its own side to guard.  Meanwhile, if you apply it both to AI's and humans as suggested, you can certainly verify that it works for humans (by enabling the Wait icon and seeing that it does no good).  Testing it for humans on both the right and left sides will verify that it works for both sides, whether the side is human or AI.

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


Promising
Famous Hero
of infamy
posted August 16, 2012 06:42 AM
Edited by kegolo at 06:51, 16 Aug 2012.

So the wait and return to the current troop works...but even with the wait bit set the ability to wait still is open, and then you can click wait infinitely...and I checked that the bit is indeed being set

!?BG0&1000;
!!BG:A?y1 N?v345;  !!FU&y1<>8:E;
!!IF&y1=8:V543/1;
!!BMv345:I?v346;
!!BMv345:F?i;
!!VRi:|33554432;
!!BMv345:Fi;
!!VRv345&v346=1:Sd-21;
!!BG:A12;

!?FU77006&543;
!!SN:Xv346/v345;
!!IF:V543/0;

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


Honorable
Supreme Hero
posted August 16, 2012 01:49 PM

OnStackReceivesTurn -> Set up wait bit.
Stack will get turn with wait flag set. What's the problem?

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


Promising
Famous Hero
of infamy
posted August 16, 2012 02:48 PM

Problem is small: it does not work.

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


Responsible
Supreme Hero
posted August 16, 2012 03:34 PM

Remove the un-necessary (and harmful) stuff and just let the Wait command execute (do not set the W bit yourself, do not override the BG:A setting).  The Wait will set the Wait bit and the FU77006 will give the stack the next turn with its Wait bit set, and the normal Heroes 3 code will handle any attempt to Wait more than once per round.  (The AI will know better than to try.)

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


Promising
Famous Hero
of infamy
posted August 16, 2012 03:45 PM

Yes this is the obvious solution...and the first thing I tried. It doesn't work. Not sure why. I added the cancel action part because without it the creature waits but can still go again and again and again and the message log keeps saying they waited. So if I cancel it and add the bit myself at least the message disappears. Either way though, it still does not work. Maybe because the game hasn't "refreshed" or something. I dunno I agree with you that's it's easy and should work, but I wouldn't be posting dumb questions if that were the case.

Or did you try it and it worked...?

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


Responsible
Supreme Hero
posted August 16, 2012 04:53 PM
Edited by JimV at 00:42, 17 Aug 2012.

Sorry, I didn't test because I recall doing something similar for an early version of "Shining Force", to eliminate all Waits since they were not used in the Shining Force SEGA game.  However, Heroes players objected to losing Wait so it was added back and I no longer have that script, and I think now that the Wait button was disabled with CM:R0 as part of that script.  That would prevent human players from Waiting but I am not sure now how the AI was prevented - maybe it was not, or maybe Era 1.5 worked differently.

After some belated testing, it appears that the FU77006 process interrupts the normal Heroes 3 process in a way which prevents the Wait bit from being checked.  I have one more idea to try, which I will report on later, but first I wish to apologize for the mis-information.

Update: after further testing, my current hypothesis is that the Heroes 3 code does not disable Wait until all the stacks of the side have the Wait bit set; and once that happens, it reverses the order of their turns.  Also, once Wait has been disabled, zeroing all the Wait bits does not re-enable it or restore the normal turn order.

So, to eliminate Wait for AI players, it seems to me all their Wait bits must be set, and then FU77006 must be used to give them their turns in order from fastest to slowest.  This could be done in about a half-page of ERM code.  I would do it for both sides, whether human or AI, to simplify the process.

The alternate would be for OxFea or Bersy or Solitaire345 to find a UN:C method (if there is one) to disable and re-enable Wait (assuming that re-enabling it somehow would restore the normal order of turns).  In that case it could be disabled under FU77006 (as a turn starts) and then renabled under BG0, prior to the next stack's turn.  However, it would probably take less time to do the ERM version than for one of them to do a dis-assembly study, so personally I would spare them that effort by doing what I could do by myself.

Second update: after more testing, I have learned that if all Wait bits are set, when the fastest stack's turn is done, the round ends, even though no other stacks have had a turn in that round.

There is still a slim chance that the original method works for the AI - i.e., that the AI will not go into an infinite loop of Waits when forced to repeat a turn because it does check the Wait bit.  So far I have not seen the AI get hung up with that script - in limited testing.  If I tried that, I would add a test for multiple Waits by the same stack and change the third or fourth one to a Defend.

3rd update: no, the AI does not check the Wait bit either.  By the way, play at Impossible level to get the AI to use Wait.

My personal favorite compromise strategy based on what I know now:  disable Wait for humans by CM:R0 for clicks and a keyboard intercept for W (hotkey), but let the AI wait if it wants.  With all the advantages humans have over the AI, I don't think giving it that minor additional tactic would tip the balance in its favor.

4th update:  but if the AI must be prevented from Waiting, I have found one way:  set the game difficulty level to 1, e.g.,

!#UN:C6919480/4/?v1;
!#VRv1003:Sv1+128728; Era 2 address for game difficulty
!#UN:Cv1003/1/?v1004; save game difficulty level

!?BA0&1000;
!!UN:Cv1003/1/1; set diff. level to 1

!?BA1&1000;
!!UN:Cv1003/1/v1004; restore diff. level

Note:  UN:J2/? can be used to get the difficulty that was set at the start of a game, but it is not where the Heroes program looks for the difficulty level during combat.  On my system (so far), that value is one byte at [0x699538]+0x1F6D8.  Warning:  I have not tested this address on my old XP machine, so buyer beware.  Also, I have not done a huge amount of testing, but in several hours I have never had the AI Wait on difficulty level 1 (normal), and always had it Wait on level 4 (impossible).  Also too, I have not finished a game after changing and restoring the difficulty level - I expect the score to be based on the restored value, but my expectations do not always pan out.  Finally, I don't know what other smart things the AI might be doing in combat at higher difficulty besides Waiting.  In my actual tests, I used a script which only applied the difficulty change after an AI stack had waited for three consecutive turns, and then restored the difficulty for the first turn of the next stack, but this post is too long already.

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


Promising
Famous Hero
of infamy
posted August 17, 2012 02:50 AM

Jim thanks for all the hard work. In all my years playing H3 I'd never noticed that the AI did not wait on easy and did more so on impossible. Interesting to say the least.

The reason I am doing this is for the H2 Succession Wars mod, where there was no wait button, so I am inclined to actually go the whole way and do the difficulty switch as you suggested. I agree that letting the AI wait is a minor issue, but it was more interesting (at least for me) to try and see what can be done with ERM. I do wonder if the AI plays "better" on impossible, like are they more inclined to protect archers or do something tactical in battle, because if that's the case I may be wasting my time removing wait by difficulty swapping, only to hinder the AI even further. Regardless, thanks again for the insights

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


Admirable
Omnipresent Hero
Wog refugee
posted August 17, 2012 03:04 AM

Of course AI plays better the higher difficulty level is. Easy level is only for those discovering the game. Why not keep wait feature, it makes game much richer, ask everyone around...except Kalu, that's it.
____________
Era II mods and utilities

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


Promising
Famous Hero
of infamy
posted August 17, 2012 03:19 AM

Oh well this is for the "authentic H2 option" for the mod. Most people I would assume are not wanting fliers to cross the whole field, archers to have to range penalty, and no wait button. But if they want it, it's there. It's the least I can do for Kalu after all that he did but could not finish.

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


Responsible
Supreme Hero
posted August 17, 2012 03:57 AM

For what it is worth, here is my test script:

ZVSE

* TestNoWaitingAI, JHV, Aug. 16, 2012

* Results before resetting Difficulty:  AI Waits forever (playing at Impossible level)

* uses v1003-v1008

!#UN:C6919480/4/?v1;
!#VRv1003:Sv1+128728;
!#UN:Cv1003/1/?v1004; save game difficulty level

!?BR;
!!VRv1007:S-1;

!?BG0;
!!BG:A?y1 H?y2 Q?v1005 N?v1006;
!!FU&y1<>8:E;
!!BMv1006:F?y3;
!!VRv1008&v1006<>v1007:S0;
!!VRv1008&v1006=v1007:+1; count Waits by stack v1007
!!VRv1007:Sv1006;
!!BG&v1008>2:A3; Defend at 4th consecutive Wait by same stack
!!IF&v1008>2:L^Stack %V1006 has waited 4 consecutive times!^;
!!FU&v1008>2:E; exit after Defend
!!IF:V59/1; set flag to repeat turn
!!UN&v1008>1:Cv1003/1/1; set diff. to normal at 3rd Wait
!!FU&y2<0:E; no Hero
!!HEy2:O?y3;
!!FU&y3<0:E; no owner
!!OW:Iy3/?y4;
!!FU&y4=1:E; AI Owner
!!IF:V59/0; human

!?FU77006&-59; start of a new turn
!!UN:Cv1003/1/v1004; restore diff. level

!?FU77006&59; redo a turn after Wait
!!VRy1:Sv1006;
!!VRy1&y1>20:-21;
!!SN:Xv1005/y1;
!!IF:V59/0;

!?BA1&1000;
!!UN:Cv1003/1/v1004; restore diff. level (in case battle ends w/o FU&-59)

In this test, only the AI is forced to Wait - I would restrict human players separately by disabling their clicks or keypresses (in which case the tests for human players in the above script would not be necessary).  If the AI choses to go guard its archers, the difficulty level will remain unchanged.  Only if it stubbornly insists on Waiting is the difficulty altered.  Once it is near enough to fight it should not need the change.

I admire Kalu's mod for the work that has gone into it, but have never understood the need for a "pure H2" version, since one can always play Heroes 2 directly.  There is even a reverse-engineered free version which does not require a CD.  So it seems like all that effort and great graphics could have gone into something new, or at least not into a "pure H2" version.  But there are a lot of things I don't understand in this world.

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


Admirable
Omnipresent Hero
Wog refugee
posted August 17, 2012 07:07 AM

The problem is that AI will fight very poorly at low level. I did not know it does not use wait at 60%, good catch. For the rest, I agree 100%, this mod can go all the way to H2 and remove all good things from H3, but then only a few people will play it. Hard dilemma for Kegolo who put outstanding work in.
____________
Era II mods and utilities

 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 150 ... 156 157 158 159 160 ... 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.6249 seconds