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 > Library of Enlightenment > Thread: AI's skill priorities (started by phoenix4ever in October 2018)
AI's skill priorities This thread is 3 pages long: 1 2 3 · «PREV
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted May 03, 2020 06:31 PM
Edited by AlexSpl at 09:23, 04 May 2020.

Corrected coefficients for Archery and Scholar (thanks to Ben80).

1. Archery
Value = [(500 + Ranged_Units_Power) * k / 100], where
k = 16, for Basic Archery;
k = 7, for Advanced Archery;
k = 11, for Expert Archery.

18. Scholar
Value = [the_strongest_spell_efficiency_delta(1, 1, 0, 0, 0, 0, 0) * Spell_Power * 1/10],
if a hero has Wisdom, otherwise 0;

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted April 14, 2026 06:49 PM
Edited by BigPig2 at 23:27, 14 Apr 2026.

So I'm gonna go ahead and necro this 8yrs old thread because what I have found is highly relevant and I believe the OP is still looking for answers about this.

Using the IDA Free tool to explore the code sections that AlexSpl pointed out I can elaborate on some of his comments and add a couple of my own.

There is a table of 28 pointers (addresses) in SoD + HD exe starting at 125184 with 19 4C 52 00 (124C19 in the exe) for Pathfinding (skill number 0). You can see some of them will repeat as per AlexSpl's list of formulas on page 1 in this thread. Notably, Tactics (skill 19) and Armorer (23) have their own (identical, although in the latter case with order of 2 instructions switched - I can't tell if this might have consequences) formulas written out under separate addresses from their counterparts on the list, providing space for potential new, easy to use formulas. Also, if you want to assign your chosen skill one of the other existing formulas it is as simple as switching the value assigned to it on this list to the one assigned to your target other skill, in fact, you can even assign the exact same formula to all 28 of them, please report your observations if you do, I am very curious what happens.

All or most formulas of the form: Value = [(1000 + Army_Power) * Constant/10^n can be relatively easily adjusted in certain ways. Majority of them use an "shr/sar" operation as part of their optimised division by 10 or 100, an operation which is essentially a division by a power of 2. Reducing the argument by 1 results in value doubling, increasing it by 1 results in the value halving etc, for example the code for Ballistics, (formula: Value = [(1000 + Army_Power) * 1/8]), starting at 124D73:

mov     eax, edi
pop     edi
cdq
and     edx, 7
pop     esi
add     eax, edx
sar     eax, 3 (C1 F8 03 at 124D7D-F in SoD + HD exe)
mov     esp, ebp
pop     ebp
retn    4

can be changed to 1/4 by changing the 3 to 2 or to 1/16 by changing it to 4 (I think, back up before trying!). U get the point. This isn't the only but by far the easiest way to adjust these values. If this is confirmed to work I can write up where this instruction (and the other similar one: SHR) occurs for each skill I find it in. There is more ways to change these values by messing with the values used for the division by 10/20/50/100 but I am still figuring it out.

The 1/2 in Widsom's formula is, as far as I can understand, the D1 F8 at 124D01-2 and 124CE6-7 (this appears to be a shorter, optimised version of C1 F8 01, the formula is fragmented into multiple cases, that's why this happens in at least these two spots) so if you NOP it out (put 90 90 in its place, or, to double it once again: D1 E0) your AI value for Wisdom should immediately double (again, I THINK, no promises at this point). Alternatively, it should be easy to give Wisdom doubled or even quadrupled Ballistics value for example (by changing the C5 4C 52 00 into 73 4D 52 00 at 1251A0 and adjusting as per above), that should settle it for good..

 View Profile
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · «PREV
Post New Poll   Post New Topic   Post New Reply

Page compiled in 0.0401 seconds