I would really like it if any of you could make some "un-HotA" plug-ins.

I would like for Inferno:
* To require Mage Guild level 2 for Pit Lords again.
* Arch Devils to give only -1 to enemy luck.

I would like for Tower:
* To get their old build order back, where Mage Tower needs to be build before Altar of Wishes and Golden Pavillion. (Instead I will move some of the special ressource cost from Mage Tower to Upg. Mage Tower, this I can easily do myself.)

I would like for Conflux:
* Sprite building no longer requires Magic University.
* Firebirds immune to Fire Magic again.

It could perhaps be done with 1 plug-in containing all 5 changes or 5 separate plug-ins. I would be very happy if someone could/would do it.

So I spent a bit of time with OllyDbg to figure out the general workings of building requirements.
e.g.

There's a function that's responsible for constructing Castle building depedencies (0x4EB810), however HotA's dll erases all that was done and move it around.

In SoD, building dependencies start around 0x6977E8 and are formed of QWORD (2x DWORD).
In HotA, because of the new town, they reworked the dependencies to a dynamic address that is rewritten every time you start the game. You might be able to fix this using hex editing of the HotA DLL but I think there's an easier way.

Since the game still needs to figure out what the building dependencies are, all of the old references to 0x6977E8 are replaced by references to the dynamic address. You can read this new reference with a plugin and that gives you the new "base" to building dependencies.

What's left to do is getting the offset to your desired building and then writing the value of the new building dependencies there.

References can be obtained from one of many places, I was inspecting this area:int new_reference1 = *(int*)0x5D6018;
int new_reference2 = *(int*)0x5D601F; // or simply new_reference1 + 4

Since I've referenced ERM help, we'll follow their format. In this special case there is no need to reverse the hex/bits as ERM help put them from left to right already.
e.g. (all in hex)
If you want a particular building to require Mage Guild Level 1, the first byte should contain '01'.
... require tavern, the first byte should contain '20'
To require both, you would have 20 + 01 = 21

Example in SoD vs HotA

[Note: ERM counts bytes from 0]
Byte ~0~ in SoD is 81h
The 1 is for '01', that means Mage Guild Level 1. There is no Mage Guild Requirement in HotA because the '01' is absent.
Then we have '80', that means Fort.

Byte ~3~ is 'C0'
That is the sum of '40' + '80'
'40' for the byte #3 is 'Dwelling 1' aka Workshop
'80' for byte #3 is 'Dwelling 2' aka Parapet

Byte ~4~ is '03' '05' for HotA
That is the sum of '01' + '02' '01' + '04'
'01' is dwelling 3 aka Golem Factory
'02' is dwelling 4 aka Mage Tower but not in HotA'04' is dwelling 5 aka Altar of Wishes in HotA

With this, you should have everything needed to figure out the dependencies and offsets you wish for now and in the future.

~~~

Archdevil -luck back to original value
_PI->WriteHexPatch(0x44AFFF, "83 3E 37 74 1B");
(restores original code, but in reverse order)EDIT: see bottom of this post.

~~~

Firebirds
I haven't looked yet, I will edit in later. Maybe it's just a creature flag (0x4000) which would be simple enough.
EDIT: yep, intuition was correct...this should bring it back. o_pCreatureInfo[CID_FIREBIRD].flags = 0x409B;____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

Thanks, OxFEA. I still find it a bit confusing so I decided to implement my suggestion into an easy-to-use header and hook.

Line 9 is an example for Naga Dwelling.First argument is town id.Second argument is building id.Third argument is a list of all buildings you want as requirement to build the current building. Separated by | means logical OR;
in English it means require all of these buildings.

You'll need this:
[url=https://github.com/RoseKavalier/h3_plugins/blob/master/includes/town_dependencies.h[/url]
Include it directly in "homm3.h" with the other includes there.

Spell Mirth at any school level acts on all friendly units. Moral is always increased by 1 and (if final moral is positive) additionally probability of extra attacks is increased - depending on Water school level by 50/50/75/100% from bonus value, related to moral.
For example, if we initially have Moral equal 3, after Expert Mirth we well have probability of extra attacks equal 25%, not 12.5%. Besides, secondary skill Leadership (besides usual increase of Moral) now also increase probability of extra attacks - by 10/20/30% from bonus value, related to moral. For example, if we have Moral equal 3 and we have Expert Leadership, probability of extra attacks will be equal 16.25%, not 12.5%.

Procedure of "weighting" of spell by AI is completely rewritten. AI is using such procedures for spells in battle to select spell which will be applied.
Tested on SoD/Complete.

Great work with the depedencies, also thank you for the town_dependencies.h !

@RoseKavallier:
1) Please add town_dependencies also to your HoMM3includes upload
Or is it not meant to be updated with new stuff?
That way it is also easier to see what is new in your homm3.h file.

2) Btw... all those .h and .cpp files work for HoTA and for Complete Heroes?

3) Was the spelling "ChangeDepedency" intended? Or do you plan to change it to "ChangeDependency" ?

4) You wrote you will do something with homm3.h , so the following is not necessary anymore:
"Configuration Properties -> C/C++ -> Code Generation, and set Struct Member Alignment to "1 Byte (/Zp1)""
Did you already do that with your homm3.h in towndependencies?

5) I tried to make a plugin for Conflux SpriteNoDependencies with your includes, but I get this error:
town_dependencies.h(4) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Where do I get the stdint.h file?

6) And I'm not sure what to put into your ChangeDepedency function if I don't want any dependency, will it work to just leave it blank?
int __stdcall new_town_dependencies(LoHook *h, HookContext *c)
{
// IDs see town_dependencies.h file
o_TownDependencies->ChangeDepedency(TOWN_ID_CONFLUX, BLD_ID_DWELL1U); // town, building, dependencies seperated by |
return EXEC_DEFAULT;
}
Or should I put "false" or "true" as third argument?

I solved 5) by downloading an open source stdint.h and putting it into my includes folder. And changing <stdint.h> to "stdint.h" within the town_depencies.h file.
But I hope there is a better solution, to add this stdint.h file to my Visual Studio 2008 Express Version.

I circumvent 6) by using mage guild 1 as only depedency. But still would be interested to know how to change it to "no depedency".

Here is the plugin:
http://handbookhmm.ru/forum/viewtopic.php?p=17059#p17059

Serp said:Great work with the depedencies, also thank you for the town_dependencies.h !

@RoseKavallier:
1) Please add town_dependencies also to your HoMM3includes upload
Or is it not meant to be updated with new stuff?
That way it is also easier to see what is new in your homm3.h file.

2) Btw... all those .h and .cpp files work for HoTA and for Complete Heroes?

3) Was the spelling "ChangeDepedency" intended? Or do you plan to change it to "ChangeDependency" ?

4) You wrote you will do something with homm3.h , so the following is not necessary anymore:
"Configuration Properties -> C/C++ -> Code Generation, and set Struct Member Alignment to "1 Byte (/Zp1)""
Did you already do that with your homm3.h in towndependencies?

5) I tried to make a plugin for Conflux SpriteNoDependencies with your includes, but I get this error:
town_dependencies.h(4) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Where do I get the stdint.h file?

6) And I'm not sure what to put into your ChangeDepedency function if I don't want any dependency, will it work to just leave it blank?
int __stdcall new_town_dependencies(LoHook *h, HookContext *c)
{
// IDs see town_dependencies.h file
o_TownDependencies->ChangeDepedency(TOWN_ID_CONFLUX, BLD_ID_DWELL1U); // town, building, dependencies seperated by |
return EXEC_DEFAULT;
}
Or should I put "false" or "true" as third argument?

RoseKavalier said:Archdevil -luck back to original value
_PI->WriteHexPatch(0x44AFFF, "83 3E 37 74 1B");
(restores original code, but in reverse order)

This doesn'nt seem to be working for me though...

I have not tested it. In theory it should work unless the HotA patch there is somehow applied later. Let me check.

EDIT:
indeed, the HotA patch is applied during the modifications just before 0x4EEA79.

Just place the HexPatch within a LoHook at 0x44AFFF, that works 100%.

BTW, this is only HotA. For SoD compatibility do the following instead:_PI->WriteHexPatch(0x44AFFF, "83 3E 36 74 1B");
_PI->WriteByte(0x44B011, 0x37);____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2

You found your man. I've been hitting the Russian website and download the plugin ever since you first mentioned it. Just let me know what aspects are you interested in and where should I submit my feedback.