Current time: 13.03.2025, 03:10 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Ошибки, баги и недочёты ERA
» crash logs / errors / bugs of era
Author Message
Berserker Offline
Administrators

Posts: 16730
Post: #871

Вылет на моде Human AI. Вижу некорректный код. Пересылаю автору.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
01.02.2025 18:16
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #872

CM:H may return incorrect hero Id(s) when Scholar is triggered before hero meeting screen, when there is another hero nearby

Okay this may sound confusing. Let's reproduce the bug step by step.

1. Get 3 heroes next to each other
Image: AEtDlYm.png
2. Give Scholar to one of the heroes, also give this hero all the spells
3. Save the game
4. Use this hero who have Scholar to visit another hero to trigger Hero Meeting Screen
5. Close the Scholar dialogue and enter Hero Meeting Screen
6. Use the testing script to check out whether any of the hero Ids returned from CM:H are wrong.
7. If nothing goes wrong, reload the save game saved in #3 and try again from #4.

Save game for testing (test from step #4 with it)
and video


Note:
- It doesn't matter which hero has Scholar (no matter left or right)
- The hero with scholar can be in any position among the 3 heroes


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 04.02.2025 00:05 by Archer30.)
03.02.2025 23:50
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16730
Post: #873

Archer30, the reason is simple, I suppose. The trigger remembers hero IDs on click event only. KeyPress event was not supported. I agree, that it's better to initialize those variable before showing dialog, but original implementation handles clicks only:

{0x5B02DD,0,DP(MouseClick2Hero)}


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
04.02.2025 00:47
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #874

Yeah I suspect that's the reason when I posted. But what's the ideal way to obtain the left/right hero on Hero Meeting Screen? Apparently, we need an universal erm command instead of CM:H.


Latest ERA mods and scripts in development - My GitHub
04.02.2025 07:50
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2385
Post: #875

(04.02.2025 07:50)Archer30 Wrote:  But what's the ideal way to obtain the left/right hero on Hero Meeting Screen? Apparently, we need an universal erm command instead of CM:H.

Добавь у себя в плагине хук где-нибудь сразу после конструктора диалога, например в 5AEAEEh, и выполни в нём этот код:

Code:
    MC_lhp=((_Hero_ *)MC2H_sm[0x40/4])->Number;
    MC_rhp=((_Hero_ *)MC2H_sm[0x44/4])->Number;

Чтобы ВоГ запомнил номера героев ещё до непосредственного открытия диалога митинга героев, а не после того, как уже произошёл клик.

Если не хочешь ставить хук, то НЕ используй кастыльную команду CM:H, а получай номера героев из менеджера встречи героев напрямую с помощью UN:C. Хотя можно без особых хлопот добавить новую ERM-команду получения данных из менеджера встречи героев в самой era.dll, но придётся уговорить Берсеркера.
(This post was last modified: 04.02.2025 10:50 by XEPOMAHT.)
04.02.2025 10:41
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #876

Yeah I believe this is a frequent used feature and has better to be managed by ERA itself.


Latest ERA mods and scripts in development - My GitHub
04.02.2025 12:19
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #877

Okay I will just use swap manager before any change is made.
I believe this should replace the current CM:H implementation or become a function in EEF.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 07.02.2025 11:47 by Archer30.)
07.02.2025 11:08
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16730
Post: #878

Archer30, thanks, I agree with you totally. Thanks for the solution.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
07.02.2025 16:38
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #879

Critical issue of game-saving feature in new ERA

This happens only occasionally but the damage is huge. It's started to be observed by players after ERA 3.9.13, after we implemented this dialogue:
Image: OjoG9mP.png

What I encountered:
- Testing stuff, load and save a save game several times
- Terminate ERA process to get some food
- Restart ERA and found the save game I used earlier cannot be used, said that the version mismatched

This is so weird...I immediately have several questions:
- Why didn't the game tell me the version was mismatched before I restarted the ERA instance? It worked just fine earlier.
- Why would it mismatch anyway? I am 100% sure this save game was made in ERA 3.9.21.

Here's the save game and debug folder. The debug is generated after the issue's popped so no script inside.
Download

It's a save game using TUM R, you will need the mod to load, probably
TUM R

I would suggest to disable ERA save game version check to load my save game and see if there is any issue.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 07.02.2025 21:55 by Archer30.)
07.02.2025 18:59
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16730
Post: #880

Some code prevented WoG SaveManager or WoG LoadManager functions to save or load correctly WoG data of static size. To be more precise, the issue is with SaveMapMon or LoadMapMon function from Monsters.cpp.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
07.02.2025 23:25
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #881

Continue from stack exp flag ability canceling the ability of creatures own

I agree that this is not a bug according to the Wog source.
Code:
case 'f': // Flags
        if(ebp->Lvls[BB_Lvl]==2) break;
        dw=0;
        switch(ebp->Mod){
          case 'F': dw=0x00000002; break; // can fly
          case 'S': dw=0x00000004; break; // can shoot
          case 'B': dw=0x00000008; break; // breath attack
          case 'L': dw=0x00000010; break; // Alive
          case '1': dw=0x00000080; break; // KING 1
          case '2': dw=0x00000100; break; // KING 2
          case '3': dw=0x00000200; break; // KING 3
          case 'P': dw=0x00000400; break; // не чуствителен к псих атаке
          case 'E': dw=0x00001000; break; // no melee penalty
          case 'I': dw=0x00004000; break; // fire magic immunity
          case 'D': dw=0x00008000; break; // Double strike
          case 'R': dw=0x00010000; break; // No retailate
          case 'M': dw=0x00020000; break; // No moral penalty
          case 'U': dw=0x00040000; break; // Undead
          case 'A': dw=0x00080000; break; // round attack
          case 'G': dw=0x80000000; break; // dragon
//          case 'b': RETURN(0)
//          default: TError("CREXPBON.TXT: Unknown Type field"); break;
//          default: RETURN(0)
        }
        if(ebp->Lvls[BB_Lvl]==1){ *(Dword *)&Mon[0x84]|=dw; }
        else{                     *(Dword *)&Mon[0x84]&=~dw; }
        break;

However,
- I don't see a scenario canceling the flag ability of a creature by stack exp ability is needed
- Part of the WoG Team wasn't aware of this feature.
For example, for the No Retaliation ability of Darkness Dragons. The values of the ability were set as
Code:
0/0/0/0/0/0/1/1/1..
But for the Flying ability of Imps, it was set as
Code:
2/2/2/2/2/2/1/1/1...
I don't see why they should be set differently. Likely, some guys writing crexpbon.txt weren't aware of the difference between setting 0 and 2 here.

Thus, I propose to disable the feature of cancelling ability by stack exp
Code:
_PI->WriteByte(0x71BF08, 0x30); // jnz     short loc_71BF39
I will add it to GEM if everyone's happy.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 27.02.2025 22:53 by Archer30.)
27.02.2025 22:32
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #882

HE:C (without parameter #4/#5 for stack exp) is counterintuitive in exp management

If you use
to multiply the number of creatures of slot 0#, you would find that the stack exp of this stack is halved.
This is because ERA tries to keep the total exp of this stack, and thus, the exp of each unit is recalculated after the HE:C execution.

It makes sense to some extent, but it is counterintuitive. Judging from existing scripts in the old WoG Scripts mod, nobody realised how HE:C works. These are happening now:
- After choosing a henchman for your hero, the stack number of the chosen stack is reduced by 1, yet the total exp increases.
- After sacrificing a few creatures in Emerald Towers, the sacrificed stack has increased stack exp for each unit

The better implementation for HE:C (without parameter #4/#5 for stack exp) is, when it sets the stack number, simply just set it and keep the stack exp for each unit the same before and after setting. This suits every script I've seen in multiple mods.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 01.03.2025 19:32 by Archer30.)
01.03.2025 19:30
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16730
Post: #883

Archer30, wog native behavior was if you add some creatures to a stack, the exp per creature should be dropped. It's default behavior for adding newbie creatures. I totally agree, that removing creatures or changing their number to a new value leads to counterintuitive results. As I understand, it's the most simple solution to keep int32 stack exp value unchanged by default, otherwise any change should involve whole stack exp recalculation.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
01.03.2025 19:35
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1190
Post: #884

Berserker, just to make sure we are on the same page - we have a full set of stack exp management with HE:C commander by using the #4/#5 parameters. The discussion is about the scenarios when these two parameters aren't presented.

Quote:wog native behavior was if you add some creatures to a stack, the exp per creature should be dropped.
Yes, this is correct and expected.

Quote:As I understand, it's the simplest solution to keep int32 stack exp value unchanged by default; otherwise, any change should involve whole stack exp recalculation.
So, keeping the total exp of a slot is coding-wise easier?
Well, wog team implemented tools to keep the stack exp for each unit. For example, the line for taking out one creature for henchmen is:
It can be changed to
in order to keep the same stack exp for each unit.

My idea is, it would be better to have "keeping same stack exp for each unit" as the method for HE:C without #4 and #5 parameters. The current implementation is quite unexpected and multiple scripts have used it in a wrong way.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 01.03.2025 21:41 by Archer30.)
01.03.2025 20:18
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16730
Post: #885

Archer30, I got your point and faced the same issue during writing old project. But most scripts will simply ignore stack exp when, for instance, adding new creatures in growing armies script. It's so easy just to modify counter without even remembering, that stack exp system exists. Another issue is backward compatibility. If you insist on new behavior, let it be for version 4.x.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
02.03.2025 03:36
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Forum Jump:

Powered by MyBB Copyright © 2002-2025 MyBB Group