|
|
RoseKavalier
Admirable
Supreme Hero
|
posted August 05, 2017 06:42 PM |
|
|
Baronus said: Maybe its another code not 50% but 50 and 100? Or else.
I don't see an easy way for hex modification. HDmod plugin could work OTOH because you can add whatever you want.
See function at 0x5BFF60 for the rest of growth (Grail, Statue of Legion & parts, horde buildings ...).
~~~
Regarding hero specialty, HDmod plugin would also work and still allow easy user-customization with a text file there to specify which specialty hero should have. (i.e. plugin reads 156 variables for each hero to know what to write). A few hooks would also take care of specialty icons and text.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 05, 2017 07:52 PM |
|
|
Yes, with hooks it's super easy. But hexpatch is also possible here. You just need more patience You can make code more compact, or you can write a chunk.
|
|
Baronus
Legendary Hero
|
posted August 05, 2017 11:16 PM |
|
|
So its possible n / x only? 1, 2, 3 etc ? And 100%, 50%, 33%, 25%? So 100% citadel and + castle 200% is possible?
|
|
RoseKavalier
Admirable
Supreme Hero
|
posted August 06, 2017 02:42 AM |
|
|
Looking at it relatively quickly, I came up with this awkward solution:
+100% extra growth citadel is easy enough, just replace SAR EAX, 1 by NOP NOP (0x90 0x90).
For Castle, it's more work. With the 2 freed bytes from Citadel, you can shift everything updown and add an extra instruction for Castle which doubles the increase so you get +200% extra instead.
Result:
Note: every instruction in red has to be changed, including the jump at 0x5C0021. The modified bytes are in red in 2nd column.
e.g.
Pikemen
14 normally
28 with Citadel
42 with Castle
For more complicated growth %, AlexSpl can certainly come up with a more elegant solution than mine
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 06, 2017 09:44 PM |
|
|
2RoseKavalier: There is no elegant solution
This is the first way (making the code more compact):
Patch @1BFFC9h (Length: 135 bytes)
0F BE 46 04 8B BE 54 01 00 00 8D 0C C5 00 00 00 00 29 C1 8D 14 4B 8B 04 95 B4 47 67 00 8D 0C C5 00 00 00 00 29 C1 8D 14 88 A1 B0 47 67 00 0F BF 44 90 44 8B 96 50 01 00 00 89 45 F8 89 D0 23 05 E0 CD 66 00 89 F9 23 0D E4 CD 66 00 09 C8 74 0B DB 45 F8 D8 0D 46 00 5C 00 EB 26 A1 D8 CD 66 00 8B 0D DC CD 66 00 21 C2 21 CF 09 FA 74 16 DB 45 F8 D8 0D 42 00 5C 00 EB 08 00 00 E0 3F 00 00 10 40 DB 5D F8 8B 55 F8
Citadel and Castle growth multipliers are shown in blue and green color respectively. By default, 1.75 and 2.25 (75% and 125%).
To produce this patch you can compile the following code in FASM:
use32
movsx eax, byte [esi+4]
mov edi, [esi+154h]
lea ecx, [eax*8]
sub ecx, eax
lea edx, [ebx+ecx*2]
mov eax, [edx*4+6747B4h]
lea ecx, [eax*8]
sub ecx, eax
lea edx, [eax+ecx*4]
; mov eax, 6747B0h
; mov cx, [eax+edx84+44h]
mov eax, [6747B0h]
movsx eax, word [eax+edx*4+44h]
mov edx, [esi+150h]
mov [ebp-8], eax
; mov [ebp-4], cx
; mov ecx, [66CDE0h]
mov eax, edx
and eax, [66CDE0h]
mov ecx, edi
and ecx, [66CDE4h]
or eax, ecx
jz @no_castle
fild dword [ebp-8]
fmul dword [5C0046h] ; castle
jmp @result
@no_castle:
mov eax, [66CDD8h]
mov ecx, [66CDDCh]
and edx, eax
and edi, ecx
or edx, edi
jz @no_citadel
fild dword [ebp-8]
fmul dword [5C0042h] ; citadel
jmp @result
citadel dd 1.75
castle dd 2.25
@result:
fistp dword [ebp-8]
@no_citadel:
mov edx, [ebp-8]
P.S. You should also take care about hints such as "Citadel +%d" and "Castle +%d". But this patch is just a demo
|
|
Baronus
Legendary Hero
|
posted August 07, 2017 06:18 AM |
|
|
Great we can do it. But if you give citadel 100% or more you must multiply citadel costs. eg. 30.000 gold... But if you maximalize it you cant build capitol because its in build order. Its big ballance problem. So I think rater we need fit castle and citadel to prices... 2500 and 5000.
How about 10% and 20% (30% final) growth?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 02:09 AM |
|
Edited by AlexSpl at 04:00, 08 Aug 2017.
|
Quote: And the ones for bonus dwelling (for skeletons, dwarves, dendroids, hell hounds, griffons, goblins) ?
Castle 2887F4h ( +3)
Rampart 288814h ( +4), 288824h ( +2)
Tower 288834h ( +4)
Inferno 288854h ( +8), 288864h ( +3)
Necropolis 288874h ( +6)
Dungeon 288894h ( +7)
Stronghold 2888B4h ( +8)
Fortress 2888D4h ( +6)
Conflux 2888F4h (+10), 41890h ( +1) Vault of Ashes (HotA.dll)
Cove (HotA.dat) 776Fh ( +6), 777Fh ( +3)
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 10:22 AM |
|
Edited by AlexSpl at 10:49, 08 Aug 2017.
|
Just a quick note on fistp instruction. Rounding depends on the current rounding mode (CWR.RC). I assume that the game always restores CWR.RC after every calculation where this flag needs to be changed for some purpose.
If you want to be 100% sure about rounding (this time truncating), use fisttp instead (requires SSE3 support, but it's not a problem since Pentium 4 Prescott).
* * *
This is the shorter version of the previous citadel/castle patch (with fisttp instead of fistp):
Patch @1BFFF7 (Length: 89 bytes)
0F BF 44 90 44 8B 96 50 01 00 00 89 45 F8 89 D0 23 05 E0 CD 66 00 89 F9 23 0D E4 CD 66 00 09 C8 74 0B DB 45 F8 D8 0D 46 00 5C 00 EB 26 A1 D8 CD 66 00 8B 0D DC CD 66 00 21 C2 21 CF 09 FA 74 16 DB 45 F8 D8 0D 42 00 5C 00 EB 08 00 00 E0 3F 00 00 10 40 DB 4D F8 8B 55 F8
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:08 AM |
|
|
AlexSpl said: Cove (HotA.dat) 776Fh ( +6), 777Fh ( +3)
Hi Alex.
I tried changing these Cove bonuses, but it does'nt seem to do anything?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 11:19 AM |
|
|
What version of HotA do you have? I've just checked on 1.4.2. Those are right addresses.
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:24 AM |
|
|
I am using 1.4.2.
Does it matter where the HotA.dat is placed?, cause it is located under 3DO/Heroes3 and I am running it through HD mod.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 11:26 AM |
|
|
Are you patching HotA.dat? What size does it have?
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:36 AM |
|
|
Is it not HotA.dat I'm supposed to edit?
It is 167kb.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 11:41 AM |
|
|
Mine is 170,915 bytes (English version 1.4.2).
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:44 AM |
|
|
So is mine.
It's pretty strange...
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 11:46 AM |
|
|
Can you upload your HotA.dat, or take a picture what do you see at 776F?
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:50 AM |
|
|
I see exactly the same as the picture you posted, 06 at 776Fh and 03 at 777Fh.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted August 08, 2017 11:51 AM |
|
|
Well, then build a pub and check.
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted August 08, 2017 11:56 AM |
|
|
Wow that's strange, now it actually seems to work, it did'nt before when I did exactly the same.
Sorry to bother you then, I guess the problem is solved.
|
|
FfuzzyLogik
Known Hero
|
posted August 08, 2017 12:05 PM |
|
|
Thanks for your answers !
Just a question, what tool you use for hex editing ? The one I use is not that efficient and don't help me to find adresses or understand what's written. So to search values its quite hard.
I'm modding MMVI (not heroes) and I was thinking about modding spells here and that's hardcoded. So I need to find adresses for spells mana costs and effect.
Coming back to subject, for a 25% for citadel, writing "do you lack citadel, so divide by 4" shall work ?
And for 50% for caslte ? I'm not sure to understand well what to write. Some "do you lack a castle, so divide by 2" ?
Sorry for my lack of understanding
See you,
____________
FfuzzyLogik.
If I'm crazy ? Sure, because its madness to be normal...
|
|
|