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: Heroes 3 Hacking Reference Guide (started by BTB in February 2020)
Heroes 3 Hacking Reference Guide This thread is 48 pages long: 1 2 3 4 5 ... 10 20 30 40 ... 44 45 46 47 48 · «PREV / NEXT»
BigPig2
BigPig2


Adventuring Hero
posted March 07, 2026 10:47 PM
Edited by BigPig2 at 00:49, 08 Mar 2026.

I mean it only makes sense itd count AI heroes only, otherwise itd be some inverse difficulty scaling that limits the AI more when the player is doing better (approximately). Its clearly a way to contain the AI. Btw, you dont happen to know the addresses of these limits in the code?

Edit: Found it. The limit of heroes per AI player (5 difficulties) starts at 260518, followed immediately by limits for total between all AI players (also 5) at 26052C.

Also, you mention mistranslation, I am curious, is fizmig sourced from other languages as well?

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 08, 2026 01:00 AM
Edited by AlexSpl at 01:02, 08 Mar 2026.

So, this -

Quote:
AI player does not hire new heroes if there are 9 or more heroes on the map (including the heroes of other players)


should be -

Quote:
AI player does not hire new heroes if there are 9 or more AI heroes on the map (including the heroes of other AI players)


with some exceptions mentioned by FizMiG.

Quote:
Also, you mention mistranslation, I am curious, is fizmig sourced from other languages as well?

I believe, yes.

As for AI choices you asked, look at 524B70h. You may notice some 'magic numbers' in instructions (like mov eax, 66666667h or mov eax, 51EB851Fh). They are for optimized division.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted March 08, 2026 01:04 PM

AlexSpl said:
So, this -
(..)
should be -
I mean both empirically and common sense, yes.

Quote:
As for AI choices you asked, look at 524B70h. You may notice some 'magic numbers' in instructions (like mov eax, 66666667h or mov eax, 51EB851Fh). They are for optimized division.

Well these are hard to comprehend, Im gonna need some time to study them more.

In another thread you indicate another memory location: "sub_52C0B0", what is that about?

Also, I am sure this must have popped up before but I cant seem to find an answer to this: is there an easy way to disable a creature upgrade (both the unit and the building)? I am toying with the idea of removing skeleton warriors.

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 08, 2026 02:58 PM

Quote:
In another thread you indicate another memory location: "sub_52C0B0", what is that about?

It's the function AI_choose_secondary_skill() which calls the mentioned earlier get_skill_value().

Quote:
Also, I am sure this must have popped up before but I cant seem to find an answer to this: is there an easy way to disable a creature upgrade (both the unit and the building)? I am toying with the idea of removing skeleton warriors.

You can alter gTownEligibleBuildMask at 697740h. But it is filled in runtime, so it will be impossible in hex (at least, directy). And try to remove Skeleton's upgrade in the function GetMonsterUpgrade() at 47AAD0h.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted March 08, 2026 03:57 PM

Does it start with archery at 524B70 ?

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 08, 2026 04:39 PM

No, switch jmp at 524C12h, and the cases for each skill start at 525184h (4 bytes for each, ending with First Aid at 52515Bh).

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted March 08, 2026 04:59 PM

Is that last address correct? It seems to be before the one for start? Or am I reading it wrong?

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 08, 2026 05:47 PM
Edited by AlexSpl at 17:49, 08 Mar 2026.

The table itself is at 525184h and it contains addresses for the switch jmp. So, the address containing the code for First Aid is at 52515Bh.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted March 08, 2026 06:44 PM
Edited by BigPig2 at 15:56, 11 Mar 2026.

I am struggling to read this, so up until 125184 it sets up by calculating all the coefficients etc then this section just puts the relevant ones together for each skill? But there dont seem to be enough formulas here? And I was expecting some of them to repeat themselves?

Edit: Looking at the formula for First Aid though, it seems clear that the developers believed an AI value of 250 will be enough to pass the test. I do not know what kind of value range the_strongest_spell_efficiency_delta function takes but Artillery is 10*Attack skill, and the AI clearly does take it sometimes (I think?).  So setting whatever skill you consider "must have" to something like 500 or 1000 should be enough for it to be selected? Or another value can be found based on one of the skills with a "(1000 + Army_Power) * 1/x" formula, just find one that gets consistently selected by AI and estimate early-to-mid AI army size. The question is, where exactly in the code does this number then go. My understanding of the syntax of these functions has unfortunately not progressed..

 View Profile
BTB
BTB


Famous Hero
Moist & Creamy
posted April 10, 2026 09:33 PM

I was asked to locate the code for determining how often might.magic heroes are offered Wisdom and Magic kills to fix the bug where Elementalists are treated as a might hero in this regard. Figured it'd be worth posting here:

4DAFE4~F ; ELEMENTALIST FIX

8B F0 mov esi,eax ; ESI = hero class
D1 F8 sar eax,1 ; EAX (hero class) / 2 (dropping remainder)
01 C0 add eax,eax ; EAX * 2
39 F0 cmp eax,esi ; Does EAX = ESI?
75 2A jne 4DB018 ; if yes (magic class) -> [magic class]
EB 1C jmp 4DB00C ; -> [might class] (4DAFF0~B00B is free)

 View Profile
purerogue3
purerogue3


Famous Hero
posted April 25, 2026 09:49 PM
Edited by purerogue3 at 18:47, 26 Apr 2026.

Hey BTB
Can the hill fort be easily made to charge resources as well?

edit:

What happens if you designate a spell level6?
It won't show up anywhere lvl6 is called, but if you make eg. pyramids give lvl6 spells will it work flawlessly?

 View Profile
BTB
BTB


Famous Hero
Moist & Creamy
posted April 27, 2026 03:26 AM

purerogue3 said:
Hey BTB
Can the hill fort be easily made to charge resources as well?


I mean, it does already, so I'm assuming you mean extra resources. It's doable, but you're going to have to be more specific about what it is you're after

purerogue3 said:
What happens if you designate a spell level6?
It won't show up anywhere lvl6 is called, but if you make eg. pyramids give lvl6 spells will it work flawlessly?


Never tried it, but there's one way to find out I suppose.

 View Profile
purerogue3
purerogue3


Famous Hero
posted April 27, 2026 03:48 AM

Currently it only charges gold, the "new hill fort" in hota does however.
If I knew how to find things in the dll I would just change the new one to lvl 1-7 from 1-5.
I'm going to try lvl.6 spells.. because I think 1-2 is too few for non-wisdom.. which shouldn't be essential for might heroes.
Also, I would add back in dimension door and town portal which are too powerful for lvl5 and so are summon spells, except a summon undead which could be lvl5

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted May 11, 2026 04:26 PM
Edited by BigPig2 at 16:27, 11 May 2026.

@BTB
Not sure you have this updated in your notes but the txt file still reads:

(spell flag) BIT 3 (04) Has duration

I believe this should rather read: "Recieves duration bonus from artifacts"
For anyone interested, I believe this is the flag to add for a 50+ turn Fire Wall.

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted May 11, 2026 09:39 PM
Edited by AlexSpl at 21:42, 11 May 2026.

I think you are right. Slightly obsolete, but nevertheless -

// spells flags
#define SPF_BATTLE              0x00000001 //- BF spell
#define SPF_MAP                 0x00000002 //- MAP spell
#define SPF_TIME                0x00000004 //- Has a time scale (3 rounds or so)
#define SPF_CREATURE            0x00000008 //- Creature Spell
#define SPF_ON_STACK            0x00000010 //- target - single stack
#define SPF_ON_SHOOTING_STACK   0x00000020 //- target - single shooting stack (???)
#define SPF_HAS_MASS_ON_EXPERT  0x00000040 //- has a mass version at expert level
#define SPF_ON_LOCATION         0x00000080 //- target - any location
//0x00000100 -
//0x00000200 -
#define SPF_MIND                0x00000400 //- Mind spell
#define SPF_FRIENDLY_HAS_MASS   0x00000800 //- friendly and has mass version


And, from the latest DB by void_17 -

00000001 enum __bitmask spell_flags : __int32
00000001 {
00000001     SF_BATTLE_SPELL          = 0x1,
00000002     SF_MAP_SPELL             = 0x2,
00000004     SF_TIME_SCALE            = 0x4,
00000008     SF_CREATURE_SPELL        = 0x8,
00000010     SF_SINGLE_TARGET         = 0x10,
00000020     SF_SINGLE_SHOOTING_STACK = 0x20,
00000040     SF_EXPERT_MASS_VERSION   = 0x40,
00000080     SF_TARGET_ANYWHERE       = 0x80,
00000100     SF_REMOVE_OBSTACLE       = 0x100,
00000200     SF_DAMAGE_SPELL          = 0x200,
00000400     SF_MIND_SPELL            = 0x400,
00000800     SF_FRIENDLY_MASS         = 0x800,
00001000     SF_NOT_AT_WAR_MACHINE    = 0x1000,
00002000     SF_SPELL_FROM_ARTIFACT   = 0x2000,
00004000     SF_DEFENSIVE             = 0x4000,
00008000     SF_AI_DAMAGE_SPELL       = 0x8000,
00010000     SF_AI_AREA_EFFECT        = 0x10000,
00020000     SF_AI_MASS_DAMAGESPELL   = 0x20000,
00040000     SF_AI_NON_DAMAGE_SPELL   = 0x40000,
00080000     SF_AI_CREATURES          = 0x80000,
00100000     SF_AI_ADVENTUREMAP       = 0x100000,
00100000 };


Thou who seekest, findest

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted May 11, 2026 09:58 PM
Edited by BigPig2 at 21:58, 11 May 2026.

Ive seen speculation about this flag being responsible for the 1 SP = 1 turn duration property (and even hoped to use that for my own purposes) and people reporting it not working. But I will admit my assertion is based entirely on the pseudocode in the .i64 file, lines 298-302 of combatManager::CastSpell function read:
       if ( (spell_traits->m_flags & 4) != 0 )
       {
           SpellDurationBonus = hero::GetSpellDurationBonus(castingHero);
           monster_power += SpellDurationBonus;
       }

where GetSpellDurationBonus handles the 4 spell duration artifacts.

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted May 11, 2026 10:13 PM
Edited by AlexSpl at 22:14, 11 May 2026.

For reference

You can see which spells have that flag set.

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted May 11, 2026 10:20 PM

Standard spell duration is set there - 0x4446C8.

 View Profile
BigPig2
BigPig2


Adventuring Hero
posted May 11, 2026 10:36 PM

AlexSpl said:
For reference

That is very handy!
Quote:
Standard spell duration is set there - 0x4446C8.

Yes, I am aware. I have been plotting to jump out with this value and give it a bit of a shr treatment (I am thinking to set standard duration to something like 1+SP/4 or maybe 2+SP/8) but I dont yet understand asm well enough to make sure I dont make a mess in the process (I am worried to inadvertently overrite values stored in some other registers) so for now I am just studying the whole of CastSpell and related functions.

My other goal is to route all the enchantment type spells through GetHeroSpellBonus (I want shield/protection type spell specialists) but again, I know what to do conceptually but not yet in practice.

 View Profile
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted May 11, 2026 10:41 PM

You might want to study the code of some plugins working with spell durations.

FfuzzyLogik

and

NewSpells

The latest virtually allows you to do all the spell magic possible, including adding new spells without replacing old ones.

 View Profile
Jump To: « Prev Thread . . . Next Thread » This thread is 48 pages long: 1 2 3 4 5 ... 10 20 30 40 ... 44 45 46 47 48 · «PREV / NEXT»
Post New Poll   Post New Topic   Post New Reply

Page compiled in 0.0742 seconds