|
|
Fearun

 
Tavern Dweller
|
posted December 21, 2017 03:25 PM |
|
Edited by Fearun at 15:26, 21 Dec 2017.
|
NO, Sorry RoseKavalier, I have been in a french C++ Forum, and they said that I will need several mouth to learn C++ ...
...even with french tutorials.
This is so long for a player like me who only wants to change few things in a single videogame (HEROES 3)
I will only try to Change DYPLOMACY and nerver go back to C++, it's like chinese for me! 
|
|
Fearun

 
Tavern Dweller
|
posted December 21, 2017 04:16 PM |
|
|
#include "patcher_x86.hpp"
Patcher* _P;
PatcherInstance* _PI;
static _bool_ plugin_On = 0;
int __stdcall testHook(LoHook* h, HookContext* c)
{
c->eax *= 2;
return EXEC_DEFAULT;
}
int __stdcall testHook2(LoHook* h, HookContext* c)
{
c->esi = max(1, (c->esi) >> 2);
return EXEC_DEFAULT;
}
int __stdcall testHook3(LoHook* h, HookContext* c)
{
c->edi = max(1, (c->edi) >> 2);
return EXEC_DEFAULT;
}
int __stdcall testHook4(LoHook* h, HookContext* c)
{
c->ebx += (c->ebx) >> 1;
return EXEC_DEFAULT;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
if ( !plugin_On )
{
plugin_On = 1;
_P = GetPatcher();
_PI = _P->CreateInstance("HD.Plugin.TestPlugin");
_PI->WriteLoHook(0x44467E, testHook);
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
----------
You said:
"" and in DllMain add:
_PI->WriteLoHook(0x4A6C88, testHook2);
_PI->WriteLoHook(0x4A6EE8, testHook3);
_PI->WriteLoHook(0x4A73DC, testHook4); ""
BUT all the previous instruction are already from DllMain...
I'm totaly lost !
|
|
RoseKavalier

     
    
Admirable
Supreme Hero
|
posted December 21, 2017 05:38 PM |
|
|
|
Fearun

 
Tavern Dweller
|
posted December 22, 2017 02:11 AM |
|
Edited by Fearun at 03:41, 22 Dec 2017.
|
HAHA yesss!!!
Your Plug-in WORKS!
Only 25% of the neutral army join my hero! 
THANK YOU SO MUCH ROSEKAVALIER
You're THE BEST
PS:
I have a question about This new Plug-in
I'm going to test this new DIPLOMACY in real games with my friends, and let's say that 25% it's TO MUCH or NOT ENOUGH
IT will be easy to change this VAlue?
I think divided by 4 it's very good but
Maybe joiners divided by 3 or by 6 will be better.
Maybe if my army appears 25% or 75% stronger, it will be better too.
Will I need to rewrite the DllMAin PLug-in ? or it is HEX-editable with 0x4A6C88 / 0x4A6EE8 / 0x4A73DC ???
THANKS
|
|
AlexSpl

   
    
Responsible
Supreme Hero
|
posted December 22, 2017 10:58 AM |
|
Edited by AlexSpl at 11:00, 22 Dec 2017.
|
Delete the following code from your diplomacy plugin:
int __stdcall testHook(LoHook* h, HookContext* c)
{
c->eax *= 2;
return EXEC_DEFAULT;
}
and
_PI->WriteLoHook(0x44467E, testHook);
testHook is just an example of LoHook. You should not include it in your plugins.
|
|
igrik

  
  
Promising
Known Hero
|
posted December 22, 2017 01:37 PM |
|
|
Or you can just disabling "free diplomacy" (for free -> for gold only)
_PI->WriteDword((0x417236 + 1), 3);
_PI->WriteHexPatch(0x4A755D, "EB");
|
|
RoseKavalier

     
    
Admirable
Supreme Hero
|
posted December 22, 2017 02:56 PM |
|
|
Fearun said:
IT will be easy to change this VAlue?
I think divided by 4 it's very good but
Maybe joiners divided by 3 or by 6 will be better.
Maybe if my army appears 25% or 75% stronger, it will be better too.
Will I need to rewrite the DllMAin PLug-in ? or it is HEX-editable with 0x4A6C88 / 0x4A6EE8 / 0x4A73DC ???
I hadn't checked what your hooks were previously, follow Alex's advice he is (always) right.
You can put any value you want, for testHook2 (&testHook3... I'd rename these Diplomacy_Quantity_Free & ..._Gold or something, en français if you prefer) you can write:
c->esi = max(1, c->esi / x);
where x is any value you want, 2, 3, 4, ... pick any arithmetic you want, could be (* 2 / 3)...
Same thing for testHook3 (rename suggestion: Diplomacy_Increase_Strength...)
c->ebx *= y;
where y is any value you want, same as above.
If you want to change these in the future, just recompile the plugin with the changes you want.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2
|
|
peter1985

 

Hired Hero
|
posted December 22, 2017 03:02 PM |
|
|
I would like some help because I met a special situation. I replaced the halfling animation (DEF) in battle with the animation of another shooting creature. The game was broken during the battle. What do you think this is?
|
|
Fearun

 
Tavern Dweller
|
posted December 23, 2017 01:54 AM |
|
Edited by Fearun at 14:19, 23 Dec 2017.
|
Hello Peter,
I think your new .DEFF doesn't match with CRANIM.TXT from H3BITMAP.LOD
In CRANIM.TXT you can find:
Time between fidgets
Walk Animation Time
Attack Animation Time
Flight Animation Distance
Upper-right Missile Offset
Right Missile Offset
Lower-right Missile Offset
Missile Frame Angles
Troop Count Location Offset
Attack Climax Frame
Maybe your new .DEFF is too long or too short !
I'm not pro so let's see what other people say...
|
|
peter1985

 

Hired Hero
|
posted December 23, 2017 05:01 PM |
|
|
Thanks Fearun!
The last number had to be rewritten and so it works! :-)
|
|
Fearun

 
Tavern Dweller
|
posted December 24, 2017 03:04 AM |
|
Edited by Fearun at 03:07, 24 Dec 2017.
|
Hello Houston we've had a problem!
In HOTA, With or without Plug-in, Surrending cost is ALWAYS 100% even if my hero has got artefacts or Expert Diplomacy
I Don't know why...
I've checked the ChangeLog from HOTA release, and there is no Diplomacy modification writen on !
I need "Surrending cost" back like SOD
Any Idea?
|
|
phoenix4ever

 
     
Legendary Hero
Heroes is love, Heroes is life
|
posted December 24, 2017 09:35 AM |
|
|
Are you sure about that?
In that case you should report it here: http://heroescommunity.com/viewthread.php3?TID=39912
|
|
Fearun

 
Tavern Dweller
|
posted December 26, 2017 08:19 PM |
|
|
Yes i'm pretty sure.. I try it multiple times with and whitout Plug-in. 
0x0023ABF8h: 7B 14 AE 47 E1 7A C4 3F = 0.16
0x0023AC00h: 8F C2 75 3D 00 00 00 00 = 0.06
0x0023AC08h: B8 1E 85 EB 51 B8 9E 3F = 0.03
0x0023AC10h: B8 1E 85 EB 51 B8 8E 3F = 0.015
0x0023AC18h: 9A 99 99 99 99 99 F1 3F = 1.1
0x0023AC20h: 33 33 33 33 33 33 F3 3F = 1.2
0x0023AC28h: 00 00 00 00 00 00 08 40 = 3.0
0x0023AC30h: 00 00 00 00 00 40 7F 40 = 500.0
0x0023AC38h: 00 00 00 00 00 00 00 00 = 0.0
0x0023AC40h: 00 00 00 00 00 00 00 40 = 2.0
0x0023AC48h: 00 00 00 00 00 00 14 40 = 5.0
0x0023AC50h: 00 00 00 00 00 00 F0 3F = 1.0
0x0023AC58h: 9A 99 99 99 99 99 A9 3F = 0.05
Does someone know a Point Value for 0,10 ???
|
|
Maurice


Hero of Order
Part of the furniture
|
posted December 26, 2017 10:08 PM |
|
|
There's a link to a floating point calculator somewhere earlier in this thread.
If you don't feel like looking for it, Google is also your friend; it's what I usually do when I need to find a good calculator. Just keep in mind that calculating 16-bit floating points is different from calculating 32-bit floating points.
|
|
Fearun

 
Tavern Dweller
|
posted December 26, 2017 11:15 PM |
|
Edited by Fearun at 23:27, 26 Dec 2017.
|
Thanks Maurice!
My bad !! I Ask a wrong question... It's a representation in the mermory of the floating point Value of 0,10 that I need. I don't know how to find it in hota.exe... it is to change the Bonus per Level of Creature Speclialties. You talked about all of this stuff Page 10 ...
...and you said: " However, as said, you also affect other stuff with what you're doing, because other functions refer to this value, too. As such, it might be better to refer to another location, that holds another Double Precision number in hexadecimal representation. However, since you have to refer to a number that already exists within the exe file, your options are more limited. "
So to change Bonus Creature Special, I need a Représentation of the Floating Point Value of 0.10 . I don't know how to find it
Lost
|
|
Maurice


Hero of Order
Part of the furniture
|
posted December 27, 2017 02:58 AM |
|
|
Well, you could find what it looks like from a calculator and then search the .exe for an occurence of that sequence. When you find it, modify the pointer to point towards that section of the .exe file instead of the one it's pointing to by default.
|
|
Fearun

 
Tavern Dweller
|
posted December 27, 2017 03:59 AM |
|
Edited by Fearun at 04:01, 27 Dec 2017.
|
OK!
I got it!
I was tapping 0,10 instead of 0.10 in the calculator, so I couldn't get the Double precision value...
In France we use "," instead of "." after decimal numbers 
The Double is: 9A 99 99 99 99 99 B9 3F
After 15 min I found this value at 0x0242340, SO I must write 40 23 64.
Thamks
|
|
Maurice


Hero of Order
Part of the furniture
|
posted December 27, 2017 11:53 AM |
|
|
Good to know you managed to find it!
|
|
Fearun

 
Tavern Dweller
|
posted December 27, 2017 07:40 PM |
|
Edited by Fearun at 19:43, 27 Dec 2017.
|
Thank you Maurice
We have seen in this Thread that we can change War-machines provided by BlackSmiths.
I Try it, and it works! But to make it perfect, we also have to change .TXT and .DEFF.
I've been abble to change the text from .TXT but I don't know how to change the DEFF
(The Picture when we "Clic" on BlackSmith to Buy War-Machine)
Maybe it's easy to do... but i don't know how
|
|
RoseKavalier

     
    
Admirable
Supreme Hero
|
posted December 30, 2017 04:25 PM |
|
|
Fearun said: Thank you Maurice
We have seen in this Thread that we can change War-machines provided by BlackSmiths.
I Try it, and it works! But to make it perfect, we also have to change .TXT and .DEFF.
I've been abble to change the text from .TXT but I don't know how to change the DEFF
(The Picture when we "Clic" on BlackSmith to Buy War-Machine)
Maybe it's easy to do... but i don't know how
0x642EA0 hex editable
int [9] ... by creature ID
For HotA (plugin, assuming older versions of HDmod):
*(int*)0x5D1B05
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2
|
|
|