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 4 - Lands of Axeoth > Thread: Heroes 4 Modding Revisited
Thread: Heroes 4 Modding Revisited This thread is 17 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 · «PREV / NEXT»
Albyx
Albyx


Known Hero
posted January 16, 2023 09:46 AM
Edited by Albyx at 15:26, 16 Jan 2023.

Some "H4 Modding Manual" based on this thread made into pdf or another document would be useful. Sometimes I feel like this kind of modding handbook could've saved me lots of time I spent searching for enum values and some addresses.


Edit: hey, it's 300th reply in this thread !

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


Legendary Hero
posted January 16, 2023 10:02 PM
Edited by baronus at 22:04, 16 Jan 2023.

baronus

We built it to have all in one place.
Dont worry topic is wasted. I have modding tut txt but in polish. Other my idea is give usefull post index with actualisation from time to time. Add your discovery with building order propeties. Here is not!

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


Responsible
Supreme Hero
posted January 22, 2023 02:39 PM

Albyx said:
Some "H4 Modding Manual" based on this thread made into pdf or another document would be useful. Sometimes I feel like this kind of modding handbook could've saved me lots of time I spent searching for enum values and some addresses.


Edit: hey, it's 300th reply in this thread !


I had the intention of starting just that, a few years ago, but never got far, but it was planned here:
Modding Compendium
____________

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


Responsible
Legendary Hero
Modding the Unmoddable
posted January 23, 2023 03:13 AM
Edited by NimoStar at 03:13, 23 Jan 2023.

Discussion isn't useless. yes, it may be that the information is scattered. But scattered information we have now is better than "maybe full guide" that we don't have.

After all, if the guide with all the information is ever made, we can unpin this one and pin the other.

But right now? There is no such full resource...

Also, here we can also add stuff discussed on H4 Ultimate discord with extra addresses.
____________

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


Responsible
Legendary Hero
Modding the Unmoddable
posted January 25, 2023 08:15 PM
Edited by NimoStar at 20:17, 25 Jan 2023.

Ah, since we now know the hex locations for building dependancies,

does anyone know or can find the locations for SKILL dependancies?

I take it it is very likely the code will look quite alike

If we find them finally we can free a better progression for heroes (instead of needing something like Advanced Death Magic just to get the paltry bonus from Basic Demonology; some decisions should just be left to the user)

Plus, I wonder if we can get "tertiary" skills without the basic skill (Say, Resurrection without Life Magic), or to change which skill is the "main" one (for example, it would be interesting for Leadership to be the parent of Tactics, since Tactics is the strong one)
____________

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


Known Hero
posted January 26, 2023 06:57 AM

Copied hex editing building requirements guide from my thread here.
If you use IDA to get into what these parts of code do, you may squeeze more out of this guide I think:


Hex editing building requirements

While working on my plugin I've found a way to edit or remove building requirements, that will be useful for modders who  can't or don't want to use plugins based on H4API and Patcher. Only thing you need is hex editor.

I must also say, that now I'm working on plugin for adding new buildings to already existing requirements or creating more complex requirements like we have on creature dwellings (choosing one of two buildings, requiring only one of several buildings etc.), so method in this thread will not be really useful if you use Patcher in your mod.

So, here there are 6 addresses (without additional offsets):

1. 48d500 - common buildings
2. 48db60 - life
3. 48e890 - order
4. 48f2e0 - death
5. 48fde0 - chaos
6. 4908a0 - nature
7. 491380 - might

You need to search for this bytes:

89 68 04 C7 00 7C  5D 99 00 C7 40 08 XX 00 00 00 ,

where XX is code of building, that is required for building (NOT the building you are changing requirement for).

Change that XX byte and it should work.
If you want to remove requirement, set it to 00(village hall).


For example, I'll change Seminary requirement from Abbey to level 5 mage guild:
1. Search for 89 68 04 C7 00 7C  5D 99 00 C7 40 08 1D 00 00 00 starting from 48db60. It is at 48db92.
2. Change 1D (Abbey) at 48db9e to 18 (level 5 guild).
3. Save the change and run the game!

Buildings codes:
00- Village Hall;
01- Town Hall;
02- City Hall;
03- Fort;
04- Citadel;
05- Castle;
06- Shipyard;
07- Caravan;

08- Prison;
09- Tavern;
0A- Blacksmith;
0B- Grail;
0C- Level 1 up;
0D- Level 1 down;
0E- Level 2 up;
0F- Level 2 down;

10- Level 3 up;
11- Level 3 down;
12- Level 4 up;
13- Level 4 down;
14- Institute of Magic Level 1;
15- Institute of Magic Level 2;
16- Institute of Magic Level 3;
17- Institute of Magic Level 4;

18- Institute of Magic Level 5;
19- First Library;
1A- Second Library;
1B- Seminary(Haven)
1C- Stable(Haven)
1D- Abbey(Haven)
1E- University (Order)
1F- Treasure (Order)

20- Undead Transformer(Necropolis
21- Necromancy Amplifier (Necropolis)
22- Battle Academy (Chaos)
23- Thieves Gauntlet(Chaos) or Wrestling Pits(Stronghold)
24- Mana Vortex(Chaos)
25- Creature Portal(Nature)
26- Rainbow(Nature)
27- Sacred Grove(Nature)

28- Breeding Pens(Stronghold)
29- Magic Dampener(Stronghold)
2a- Arena of Honor(Stronghold)

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


Responsible
Legendary Hero
Modding the Unmoddable
posted March 14, 2023 06:49 PM
Edited by NimoStar at 18:55, 14 Mar 2023.

Joining previously unavailable information in same thread

Albyx said:
I'm using IDA, so there is 0x400000 offset in addresses.

Numbers for gem effects:
Mana Opal (6 mana) - 0x6C0004
Sapphire of Defense (6 defense) - 0x6C0048
Ruby of Attack (6 attack) - 0x6C0063
Emerald of Speed (2 speed) - 0x6C0082

Changing message text by hex editing can be done by changing pointers that are located at:
0x6C0CAF and 0x6C0CBE for Mana, Defense and Attack gems (they all share the same string)
0x6C0CE5 and 0x6C0CF4 for Speed gem.




Although I would say 0x6C0063 is wrong, there is no "6" at that address, it's actually at "65"


____________

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


Legendary Hero
posted March 14, 2023 08:09 PM
Edited by baronus at 20:11, 14 Mar 2023.

baronus

Annex to building requirements:

baronus said:
Something wrong.
Here you have all buildings. First you must write a code. At the end is aklways 08 and next is building number.

Common x 48d500
077c5d99 00c74708 XX 00 00 00
01,02,03
04,05,07
09,0a,14,15
16,17,18
19,1a

Life. x 48db60
895804c7 007c5d99 00C74008 XX 00 00 00 ,
1d,1b,1c,0c,0d,0e,0f,11,10,
Order x 48e890
1e,1f,0c,0d,0e,0f,11,10,
Death x 48f2e0
896804c7 007c5d99 00C74008 XX 00 00 00 ,
0c,0d,0e,0f,10,11,20,21
Chaos. x 48fde0
0c,0d,0e,0f,10,11,23
Nature x 4908a0
0c,0d,0e,0f,11,10,27,26,25
Might. x 491380
0c,0d,0e,0f,10,11,23,2a


Dont discuss here its only discovered adresses text.

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


Responsible
Supreme Hero
posted March 15, 2023 10:37 AM

I think we, in collaboration, could make a user friendly modding guide here on HC aswell, I can set up a tread when I have some time to do so, but I guess it would be most optimal to keep it clear of discussions, test results etc and just boil it down to thr basic guide. We can always link to original treads.
Also if someone is willing to gather up the stuff in pdf or similar that'd be great.

I could also use help with an overview as I havent been that actively followinh the progress lately and also I know alot of you are more skilled at modding and understanding the basics behind it, than I am.
____________

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

Tavern Dweller
posted July 01, 2023 05:52 PM

AlexSpl said:
The best approach to modding HoMM IV would be to decompile the executable and figure out its main classes. It's a shame that HoMM IV community lacks skilled guys and we speak about 'hex-editing' in 2022. Just look around you, there are so much info about plugins out there, but still you're stuck with childish things.

How is that going with Heroes III? Would it be possible to re-use the tools made for H3, like H3API -> H4API?

I saw a really cool project "h3dec", to fully decompile H3, but I don't know if it's still alive: https://minexew.github.io/2018/12/28/h3dec.html

In particular, I found the following lines very promising:

Quote:

RetDec is too memory hungry to run over the entire file at once, but when applied partially, provides very pleasing results. If the database of variable & function signatures can be saved and loaded independently on what part of the binary is currently being processed, this will be the way forward for decompilation.


____________

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

Tavern Dweller
posted July 11, 2023 06:39 PM

Seems like "Taxpayer" ability only works on peasants
Tried to add it to dwarves but it didn't work.

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


Undefeatable Hero
Therefore I am
posted July 11, 2023 06:55 PM

You can try H3.5 aka WoG/ERA*.. In WoG, you can create/get an H4 version.. So you are first modder H4 version, if you know WoG scripts.. Now's you try H4.5 version, when you are using H4.. Ok you know also H5 is sucking now.. Because of different version.. If H5.5 means you find developed H6, but UbiSnow disagreed with H5.5 team.. And their H6 version..

Ok good job! Remember MOD meant better graphics, stronger AI and bug fixes also compatibility with Windows, Linux and Os.. I noticed only HoMM team is different opinion..

*taxpayer
____________
Fight MWMs - stand teach

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


Known Hero
posted July 11, 2023 09:33 PM

LGBT_Lover_Boy said:
Seems like "Taxpayer" ability only works on peasants
Tried to add it to dwarves but it didn't work.



Taxpayer checks for creature code and not ability.
0x63E2C6 - code of peasants for displaying additional income in "Kingdom" tab.
0x63E306 - for giving extra gold.

I think it should be changed to work properly, maybe also for other resources like H3 crystal dragons

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

Tavern Dweller
posted July 12, 2023 06:49 PM

Albyx said:
LGBT_Lover_Boy said:
Seems like "Taxpayer" ability only works on peasants
Tried to add it to dwarves but it didn't work.



Taxpayer checks for creature code and not ability.
0x63E2C6 - code of peasants for displaying additional income in "Kingdom" tab.
0x63E306 - for giving extra gold.

I think it should be changed to work properly, maybe also for other resources like H3 crystal dragons


Is it possible to add it to the dwarves, or i can only replace it?
Also, do you know how to add Magic Resistance to unit?

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


Known Hero
posted July 13, 2023 01:23 PM

LGBT_Lover_Boy said:
Albyx said:
LGBT_Lover_Boy said:
Seems like "Taxpayer" ability only works on peasants
Tried to add it to dwarves but it didn't work.



Taxpayer checks for creature code and not ability.
0x63E2C6 - code of peasants for displaying additional income in "Kingdom" tab.
0x63E306 - for giving extra gold.

I think it should be changed to work properly, maybe also for other resources like H3 crystal dragons


Is it possible to add it to the dwarves, or i can only replace it?
Also, do you know how to add Magic Resistance to unit?



With hex editing you can only replace, to extend code you can use plugins in c++ (like Zero does here) or manualy write Assembly jumps.


I recall magic resistances can be set in Zero's code too, never changed them myself so can't point exactly where they are located in executable.

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


Responsible
Legendary Hero
Modding the Unmoddable
posted September 25, 2023 10:26 AM
Edited by NimoStar at 10:42, 25 Sep 2023.

Albyx said:
Copied hex editing building requirements guide from my thread here.
If you use IDA to get into what these parts of code do, you may squeeze more out of this guide I think:


Hex editing building requirements

While working on my plugin I've found a way to edit or remove building requirements, that will be useful for modders who  can't or don't want to use plugins based on H4API and Patcher. Only thing you need is hex editor.

I must also say, that now I'm working on plugin for adding new buildings to already existing requirements or creating more complex requirements like we have on creature dwellings (choosing one of two buildings, requiring only one of several buildings etc.), so method in this thread will not be really useful if you use Patcher in your mod.

So, here there are 6 addresses (without additional offsets):

1. 48d500 - common buildings
2. 48db60 - life
3. 48e890 - order
4. 48f2e0 - death
5. 48fde0 - chaos
6. 4908a0 - nature
7. 491380 - might

You need to search for this bytes:

89 68 04 C7 00 7C  5D 99 00 C7 40 08 XX 00 00 00 ,

where XX is code of building, that is required for building (NOT the building you are changing requirement for).

Change that XX byte and it should work.
If you want to remove requirement, set it to 00(village hall).


For example, I'll change Seminary requirement from Abbey to level 5 mage guild:
1. Search for 89 68 04 C7 00 7C  5D 99 00 C7 40 08 1D 00 00 00 starting from 48db60. It is at 48db92.
2. Change 1D (Abbey) at 48db9e to 18 (level 5 guild).
3. Save the change and run the game!

Buildings codes:
00- Village Hall;
01- Town Hall;
02- City Hall;
03- Fort;
04- Citadel;
05- Castle;
06- Shipyard;
07- Caravan;

08- Prison;
09- Tavern;
0A- Blacksmith;
0B- Grail;
0C- Level 1 up;
0D- Level 1 down;
0E- Level 2 up;
0F- Level 2 down;

10- Level 3 up;
11- Level 3 down;
12- Level 4 up;
13- Level 4 down;
14- Institute of Magic Level 1;
15- Institute of Magic Level 2;
16- Institute of Magic Level 3;
17- Institute of Magic Level 4;

18- Institute of Magic Level 5;
19- First Library;
1A- Second Library;
1B- Seminary(Haven)
1C- Stable(Haven)
1D- Abbey(Haven)
1E- University (Order)
1F- Treasure (Order)

20- Undead Transformer(Necropolis
21- Necromancy Amplifier (Necropolis)
22- Battle Academy (Chaos)
23- Thieves Gauntlet(Chaos) or Wrestling Pits(Stronghold)
24- Mana Vortex(Chaos)
25- Creature Portal(Nature)
26- Rainbow(Nature)
27- Sacred Grove(Nature)

28- Breeding Pens(Stronghold)
29- Magic Dampener(Stronghold)
2a- Arena of Honor(Stronghold)


I wanted to change Stronghold prerequisites seeing it is by far the weakest competitive town. My focus would be on getting level 2 creatures easier to build.

For that purpose I would change Citadel for harpies prerequisite into Wrestling Pits, while Nomad prerequiste would be Arena of Honor.

At first I though we didn't have Wrestling Pits, but now I know its just a variation upon Thieves Gauntlet.

So, thanks for the codes.

On the other hand, I was unable to find either the pattern at the address or the pattern itself


I did find the offsets you said of "might", but I am unclear into knowing which building is which. Besides, the recruitment buildings seem not to be there (No prerequisite is 04, "Citadel")


Is that plugin of yours ready yet?
____________

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


Known Hero
posted September 25, 2023 05:20 PM

I abandoned idea of such plugin after updating to the latest Modding System. Usage of one plugin on its own or incorporated in bigger mods blocks all other mods that use the same plugin because MS can't load multiple plugins with one name (which is set in plugin code).

Structure of big mods in MS is philosophical question.
Some may use multiple small MS plugins (for example creature stats, abilities, classes etc) to get final MS configuration that will be considered final big mod. Problem of this approach is other mods with the same structure or plugins are incompatible.
Others may put such changes into one plugin or even compile everything in one dll. So all changes are in one place and support of other mods with similar changes is still there (depends on how these mods do things, but most of the time it should be fine). Downside is it's harder to modify for non-modders.

I think the second approach is better, as it allows for more flexibility in combining different mods.

---

Regarding your hex problem, maybe you use modified exe or search from wrong place? When I wrote instruction I've done this in exe from GOG, and it was found successfully, I wouldn't write instruction otherwise.

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


Responsible
Legendary Hero
Modding the Unmoddable
posted September 26, 2023 05:56 AM
Edited by NimoStar at 06:01, 26 Sep 2023.

Although I see your point, The plugins could be copied with different names to work in different mods, blocking by name is not a substantial  problem. Modular plugins are far more configurable than a DLL, which may also be detected as a virus like the Equi version.

In the other point: Harpy Nest still asks for Citadel ingame, thus it should be able to be found as 04. I think there is an error in the instructions.

I notices you only described to change prerequisites for special buildings, which may be the source of the discrepancy.
____________

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


Known Hero
posted September 28, 2023 05:15 PM

Every modular plugin is also a dll at heart, there's no differense in this regard. If you are worried about dlls you can count this as disadvantage for modular solution , because there are more components and each of them has a chance to trigger something in antiviruses.
I think we shouldn't worry about this too much though, the problem Equilibris has with antiviruses isn't caused by dlls themselves, but by the method this dlls are applied. Executable patched by RoseKavaliers' patcher has no problem with antiviruses. I encountered some weird Windows defender reactions to my compiled dlls during development but it's fixed by rearanging the code most of the time.

---

It seems like my instruction doesn't work for everything, but it's not only for special buildings because I remember somebody changed ghost dwelling requirement this way.
My proposal is to disassemble game exe with IDA, Ghidra etc and search for building codes around the area where you found some requirements already. There are lots of different functions for creating requirements, you can't find them all with one simple hex search.

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


Responsible
Legendary Hero
Modding the Unmoddable
posted October 03, 2023 10:40 PM

Well, I still prefer the modular solution because every module has a function and each can be configured of their own accord. A few KB by duplicating the plugin in a per-mod basis doesn't discourage me as much as having several DLLs as full mods in and of themselves. At last the DLL detected by antivirus problem is solved in a collective way by the plugins (a plugin can be assembly-tested for virus detection and then distributed as a standarized package and used safely by every mod, only being configured by json or other such means), whereas if mods are assembled individually then each version will have different checksum and so...
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 17 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0674 seconds