|
|
SilverG
Known Hero
|
posted October 18, 2024 01:11 PM |
|
|
AlexSpl said:
Quote: I am using HD mod. >D
You have no choice after all Every confusing problem has a solution (well, in Heroes world), you just have to spend some time to locate it.
Btw, changing cost should not have such an effect, so try to make your changes again after a fresh installation. I'm sure, the culprit is one of your other pathes (even if they seemed to work normally before).
Itīs not cost changes, itīs prod changes... for example I have made that The Castleīs Resource Silo gives +6 Wood/Ore, +3 Gems and +2000 Gold/Day... In game this works like a charm.. but once you make a right click n the town, just to view whatīs going on, the game crashes...
And thereīs a maximum Gold production cap for a (any) Town - I have experimented with this.... the absolute max per Town for Gold production is 32,000/day after that the game displays a negative number -32468.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 18, 2024 02:32 PM |
|
|
I think it's because the game cannot properly draw town's main resource (which you see when right-click on your town, but don't see if you click on opponent's one).
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 18, 2024 03:19 PM |
|
|
Looked at the code. You have to handle how resource icons are displayed.
if ( (bitNumber[15] & v31->full_building_mask) != 0 )
{
silo_income = town::get_silo_income(v31);
v43 = 0;
v44 = 0;
v91 = 0;
v45 = &v91;
do
{
if ( silo_income[v44] )
{
++v43;
*++v45 = v44;
v44 = v91;
}
v91 = ++v44;
}
while ( v44 <= 6 );
if ( v43 == 2 ) // Town has two main resources?
{
v46 = operator new(0x48u);
Memory = v46;
LOBYTE(v99) = 9;
if ( v46 )
v47 = iconWidget::iconWidget(v46, 6, 75, 20, 18, 2007, "smalres.def", v92, 0, 0, 0, 16);
else
v47 = 0;
a4 = v47;
v48 = p_Widgets->last;
LOBYTE(v99) = 5;
vector_insert_ptr_5FE2D0(p_Widgets, v48, 1u, &a4);
v49 = operator new(0x48u);
Memory = v49;
LOBYTE(v99) = 10;
if ( v49 )
v50 = iconWidget::iconWidget(v49, 6, 87, 20, 18, 2007, "smalres.def", v93, 0, 0, 0, 16);
else
v50 = 0;
a4 = v50;
v51 = p_Widgets->last;
LOBYTE(v99) = 5;
}
else // otherwise
{
if ( v43 != 1 )
goto LABEL_64;
v52 = operator new(0x48u);
Memory = v52;
LOBYTE(v99) = 11;
if ( v52 )
v53 = iconWidget::iconWidget(v52, 6, 81, 20, 18, 2007, "smalres.def", v92, 0, 0, 0, 16);
else
v53 = 0;
a4 = v53;
v51 = p_Widgets->last;
LOBYTE(v99) = 5;
}
vector_insert_ptr_5FE2D0(p_Widgets, v51, 1u, &a4);
}
You have three main resourses, so you should write a case for such a possibility. That means you should call iconWidget::iconWidget() three times with different coordinates to draw three main resources. Or you can hack the game logic and convert this -
if ( v43 == 2 ) // Town has two main resources?
to this -
if ( v43 > 1 ) // Town has two main resources?
so only the first two main resources are drawn.
|
|
SilverG
Known Hero
|
posted October 18, 2024 04:02 PM |
|
|
AlexSpl said: Looked at the code. You have to handle how resource icons are displayed.
if ( (bitNumber[15] & v31->full_building_mask) != 0 )
{
silo_income = town::get_silo_income(v31);
v43 = 0;
v44 = 0;
v91 = 0;
v45 = &v91;
do
{
if ( silo_income[v44] )
{
++v43;
*++v45 = v44;
v44 = v91;
}
v91 = ++v44;
}
while ( v44 <= 6 );
if ( v43 == 2 ) // Town has two main resources?
{
v46 = operator new(0x48u);
Memory = v46;
LOBYTE(v99) = 9;
if ( v46 )
v47 = iconWidget::iconWidget(v46, 6, 75, 20, 18, 2007, "smalres.def", v92, 0, 0, 0, 16);
else
v47 = 0;
a4 = v47;
v48 = p_Widgets->last;
LOBYTE(v99) = 5;
vector_insert_ptr_5FE2D0(p_Widgets, v48, 1u, &a4);
v49 = operator new(0x48u);
Memory = v49;
LOBYTE(v99) = 10;
if ( v49 )
v50 = iconWidget::iconWidget(v49, 6, 87, 20, 18, 2007, "smalres.def", v93, 0, 0, 0, 16);
else
v50 = 0;
a4 = v50;
v51 = p_Widgets->last;
LOBYTE(v99) = 5;
}
else // otherwise
{
if ( v43 != 1 )
goto LABEL_64;
v52 = operator new(0x48u);
Memory = v52;
LOBYTE(v99) = 11;
if ( v52 )
v53 = iconWidget::iconWidget(v52, 6, 81, 20, 18, 2007, "smalres.def", v92, 0, 0, 0, 16);
else
v53 = 0;
a4 = v53;
v51 = p_Widgets->last;
LOBYTE(v99) = 5;
}
vector_insert_ptr_5FE2D0(p_Widgets, v51, 1u, &a4);
}
You have three main resourses, so you should write a case for such a possibility. That means you should call iconWidget::iconWidget() three times with different coordinates to draw three main resources. Or you can hack the game logic and convert this -
if ( v43 == 2 ) // Town has two main resources?
to this -
if ( v43 > 1 ) // Town has two main resources?
so only the first two main resources are drawn.
This looks neat.... but where can I find this code in IDA?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 18, 2024 08:34 PM |
|
Edited by AlexSpl at 20:37, 18 Oct 2024.
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 18, 2024 09:02 PM |
|
Edited by AlexSpl at 21:05, 18 Oct 2024.
|
Your problem is in that the game cannot handle more than two main resources. So, you have to 'upgrade' its logic. Btw, I recommend to solve this problem on your own. Thus you will warp your skills to the assembly engineer, class 3a Actually, it's one of those tasks you have to learn on.
Just learn shortcuts and common instructions. I bet, you will be surprised how fast you learn patching process w/o any degree.
|
|
SilverG
Known Hero
|
posted October 18, 2024 09:49 PM |
|
|
AlexSpl said: Your problem is in that the game cannot handle more than two main resources. So, you have to 'upgrade' its logic. Btw, I recommend to solve this problem on your own. Thus you will warp your skills to the assembly engineer, class 3a Actually, it's one of those tasks you have to learn on.
Just learn shortcuts and common instructions. I bet, you will be surprised how fast you learn patching process w/o any degree.
Thanks Alex!
|
|
SilverG
Known Hero
|
posted October 18, 2024 10:19 PM |
|
Edited by SilverG at 22:21, 18 Oct 2024.
|
AlexSpl said:
Sadly this is all I can find when I open H3HD.exe in IDA:
https://ibb.co/PWMgxm5
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 19, 2024 01:29 PM |
|
Edited by AlexSpl at 13:29, 19 Oct 2024.
|
Try to open the database I've shared. Seems you've just opened the executable with IDA.
|
|
SilverG
Known Hero
|
posted October 22, 2024 08:36 AM |
|
|
AlexSpl said: Try to open the database I've shared. Seems you've just opened the executable with IDA.
I canīt open it....
<a href="https://ibb.co/dLcQJHS"><img src="https://i.ibb.co/wwLKr2T/Error-IDA.png" alt="Error-IDA" border="0"></a>
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 22, 2024 11:49 AM |
|
|
|
FfuzzyLogik
Known Hero
|
posted October 23, 2024 11:07 PM |
|
|
If someone is interested to place one artifact to give 1500g/turn, one easy way is to change the "purse of gold" and doble his value.
Localisation : 000c7729 (or 004c7729) is the hex to edit.
The last part is : 8D 3C 4F => means => lea edi, [edi + ecx*2]
And changing it by : 8D 3C 8F => means => lea edi, [edi + ecx*4]
So the total value is 375*4 (1500 gold) insead of 375*2 (750 gold)
As I'd like one for 1500g, one for 1000g and one of 500g (instead of 1000/750/500) I just have to swap who is the "best artifact"
If it helps someone...
Thanks AlexSpl for the localisation and read of code for endless sack of gold !
____________
FfuzzyLogik.
If I'm crazy ? Sure, because its madness to be normal...
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted October 30, 2024 01:18 PM |
|
|
Is there any way to make AI cast Fire Wall, Quicksand, Remove Obstacle, Force Field and Land Mine?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 30, 2024 01:54 PM |
|
|
The answer is yes, though, as I mentioned earlier, first, you have to write a weighting function for each spell you want AI to be able to cast. You cannot do it via hex-editing, so... for you the answer is no, I suppose.
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted October 30, 2024 01:55 PM |
|
|
Hmm bummer...
How did adding a weigthing function work again?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 30, 2024 02:16 PM |
|
|
Adding a weighting function requires some knowledge of C++ (or another programming language that allows you to create DLLs aka plugins).
The only open source solution I know of for the original game / Horn of the Abyss that allows adding spells (or writing new / updating present spell weighting functions) is the NewSpells plugin. Another option is VCMI, but we talking HotA here
Also you can 'revive' the spells mentioned above with some very dirty tricks, like feeding AI with a weighting function of another spell. In this case AI will be able to cast those spells, but without any understanding/estimation of the current situation on the battlefield (basically random). It may give you some joy, but I'm not sure you'll tolerate random casting anyway.
|
|
Phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted October 30, 2024 03:19 PM |
|
|
Thanks Alex
Yeah I suppose that might be too great a task for me sadly.
How do you borrow a weight from another spell? And can it be done by hex editing?
The problem is AI always seems to cast the same boring spells to me, Slow, Blind or a low level damage spell. (I suppose this problem is amplified, because AI might heroes very rarely gets Wisdom.)
So it seems very few spells can be learned from AI with Eagle Eye.
Also the 5 spells I mentioned can't be learned at all from AI.
I know I can change AI's spell priorities in sptraits.txt and perhaps I should, but I guess Slow and Blind are some of the better spells (also) for AI. It's just boring that it only uses like 10% of the combat spells and it makes Eagle Eye even more useless.
|
|
Csaros
Hired Hero
|
posted October 30, 2024 08:21 PM |
|
Edited by Csaros at 20:34, 30 Oct 2024.
|
Can you make a *.dll to insert code into h3hota HD.exe? How? I know you can use a cheat engine, but then you have to use it every time you start the game. Is there a known solution?
Second thing: Is it possible to write in assembly an option to allow cancelling a level up (where a player chooses no skill)? How could this be approached?
|
|
AlexSpl
Responsible
Supreme Hero
|
posted October 31, 2024 04:02 PM |
|
|
Quote: Can you make a *.dll to insert code into h3hota HD.exe? How? I know you can use a cheat engine, but then you have to use it every time you start the game. Is there a known solution?
You have to rewrite an entry point function so that it would load your plugin. Also there are several programs around the net, which can attach a dll to a process. You can create then a batch file like this -program.exe process.exe plugin.dll, and start it instead of the game directly.
Quote: Second thing: Is it possible to write in assembly an option to allow cancelling a level up (where a player chooses no skill)? How could this be approached?
Probably, the simplest solution is to call widget::enable(), but you've asked for the ultimate hex hack So, here it is - F9BA4: 74 -> EB. Now you can just press OK to skip a skill, or choose a skill and press OK, if you want that skill.
|
|
phoenix4ever
Legendary Hero
Heroes is love, Heroes is life
|
posted October 31, 2024 04:34 PM |
|
|
AlexSpl said: So, here it is - F9BA4: 74 -> EB. Now you can just press OK to skip a skill, or choose a skill and press OK, if you want that skill.
Huh interesting, though it will make the game much easier.
Alex can you please answer me about using spell weights from other spells, in regards to the 5 combat spells AI can't cast? (The question I asked in my last post.)
|
|
|
|