Wake of Gods Forum | Форум Во Имя Богов

Full Version: Ошибки, баги и недочёты ERA
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Bug report:
F12 for updating scripts will be broken if exiting a game (via HD feature) during battle.

Steps to reproduce:
- Load any save game
- Press F12 (check if it's working, it should)
- Start a fight
- Load a save game after exiting during the fight
- Press F12 again (it should be broken now, nothing happens)

This makes testing very inconvenient...
As a quick workaround just add some hot key for fast losing battle and the game (to be able to get to game main menu). I don't know, wether Baratorch included any changes for OnGameLeave I requested recently.
Berserker, it‘s not only that though, I suppose the culprit is something more obvious. I experienced F12 not working sometimes when I
- Get into battle
- Minimize ERA and edit my script
- Get back to ERA, found F12 not working
It's not reliably reproducing so I just list everything I did last time. Perhaps minimizing in battle screen instead of adv map could lead to such issue?
Archer30, maybe game window does not receive directory change notification, and thus VFS thinks, that no files or directories were changed and F12 reuses existing scripts in memory. Tried making another change in editor and pressing CTRL + S, then F12 in game?
Berserker, I don't think it's the case. It's pressing F12 and no text appears at the bottom, as if the keyboard's broken. Yet it works again after re-starting ERA.
Archer30 I tried to reproduced bug but did not have luck. I tried various scenarios to recreate bug using latest launcher 2.955 that includes R73 HD mode (a few week old).

I found this F12 wont work when
- HD help dialog is displayed (F1 on adventure map and in combat),
- Town dialogs (magic guild, dwelling upgrade, castle upgrade, leprechaun bank, Peons dialog...). But it work on army buy screen and all other "classic info" dialogs...,
- Hero henchmen screen...,
- "Welcome to gem settings" dialog.

F12 trigger ReloadErm method in all cases, but its exit from method when ErmTriggerDepth is no 0. In all above cases it is not 0.
Seems to me that all dialogs that related to HD mode has ErmTriggerDepth>0.

If you have additional info how to reproduce bug i can take look further...

Bug report:
Also, during gorilla testing i found that game crash when you try to reload scripts (F12) in hero meeting screen when quest log is opened. Crash occurs later, when quest dialog close button is hit.
Steps:
- Meet hero,
- Open quest dialog (any hero),
- F12 - sound is plays as sign of succeed reload,
- Close quest dialog,
- HD mode crash.
Can someone confirm this bug too?
gamemaster, I see. If battle is initiated by ERM, baratorch's way to exit battle (jump out of stack context) will leave ErmTriggerDepth > 0. I think, it can be the issue. The best way is to lose battle and game via two ERM commands on hot-key instead of using "Load from battle" functionality.

F12 is not totally safe, because ERT strings are reloaded and thus some string addresses may become broken. I usually press F12, than save and load. Otherwise code using ERT-strings may crash.
Quote:If battle is initiated by ERM
It was indeed my case.

Do you think there could be other problems besides F12 not working with "load from battle" feature?
F12 is quite reliable, unless ERT strings were used for creature/spell descriptions or in-game dialogs, because those strings are dynamically allocated and freed, thus their addresses will differ from one loading to another. If you have met any issue, try F12 + save + load.
Berserker, I'd like to report a weird problem:
Flag 1000 can become FALSE on a battle replay vs neutral monsters with random hero active.

Okay this might sound confusing, let me show you how to reproduce the problem step by step.
- Download testing mod + save game The testing mod contains battlereplay plugin, latest random heroes script (and libs) and my testing script to show the value of flag 1000.
- Activate the mod and load the save game
- Use Tazar and fight the Pitlords
- Tazar would be asked if retreat, pick anything to end the battle
- Replay the battle
- If everything goes right, you will see this:
Image: d8HDdtK.png
Flag 1000 becomes 0 as soon as the battle replay is confirmed.

A few findings:
- It looks like this is not reproducible in a new game.
- The appearance of random hero (hero for the neutral stacks) is crucial. If Gelu does not appear on the other side, flag 1000 is bugless.

What do you think about this? Rolleyes
Seems like it's more a question for a battle replay plugin author. Era set f1000 before each trigger exactly, like ERM does:
Code:
// Really the meaning of ZvsGmAiFlags is overloaded and cannot be trusted without looking at ERM help
ZvsGmAiFlags: pinteger = Ptr($793C80);

if ZvsGmAiFlags^ >= 0 then begin
  f[1000] := ZvsGmAiFlags^ <> 0;
end else begin
  f[1000] := not ZvsIsAi(Heroes.CurrentPlayerId^);
end;
Perhaps, ZvsGmAiFlags variable should be preserved between replays.
So igirk?

Ultimately I can set the flag back to TRUE under every trigger in a script with a large number prefix Rolleyes
Yep, it's better for igrik to check this variable persistence between replays.
(31.01.2024 20:12)Berserker Wrote: [ -> ]Yep, it's better for igrik to check this variable persistence between replays.
Daemon_n is already manages this plugin BattleReplay.dll (As far as I know) 115
igrik, бюрократы! )))

Code:
// battle
void BACall(Dword n,_Hero_ *hp)
{
  #include "templ.h"
  Dword oldpo=pointer;
  pointer=n+30300;
  ERM_GM_ai=!G2B_CompleteAI;
//  ERM_PosX=0;ERM_PosY=0;ERM_PosL=0;
  ERM_HeroStr=hp; // 3.57f 29.01.03
  ProcessERM();
  pointer=oldpo;
  RETURNV
}

G2B_CompleteAI — глобальная переменная, истинна при чистом автобое.

Устанавливается ещё до начала битвы здесь:

Code:
// Нападение героя на что-то другое
{0x49F195,0,DP(Get2Battle)}

int __stdcall Get2Battle(Dword MixedPos,_Hero_ *HrA,_MonArr_ *MArrA,
                         int OwnerD,Dword Pv4/*0*/,_Hero_ *HrD,_MonArr_ *MArrD,
                         int Pv3/*-1*/,Dword Pv2/*1*/,Dword Pv1/*0*/) // ECX=Adv.Manager
{
  _ECX(G2B_AdvMan);
  G2B_MArrD=MArrD; G2B_MArrA=MArrA;
  G2B_HrD=HrD; G2B_HrA=HrA;
  G2B_OwnerD=OwnerD;
  G2B_MixedPos=MixedPos;
  __asm  pusha
  ExpoFromBattle=1;
  CheckForCompleteAI(); // <<<<<<<<<<<

Думаю, нужно при инциализации повтора боя вызвать эту функцию самостоятельно:

Code:
void CheckForCompleteAI(void)
{
  #include "templ.h"
  G2B_CompleteAI=1;
  _Hero_ *hp;
  hp=G2B_HrD;
  while(hp!=0){
    if(hp->Owner<0) break;
    if(hp->Owner>7) break;
    if(IsAI(hp->Owner)==0) G2B_CompleteAI=0; // human
    break;
  }
  hp=G2B_HrA;
  while(hp!=0){
    if(hp->Owner<0) break;
    if(hp->Owner>7) break;
    if(IsAI(hp->Owner)==0) G2B_CompleteAI=0; // human
    break;
  }
  if(IsAI(G2B_OwnerD)==0){ // хозяин защищающихся монстров - человек
    G2B_CompleteAI=0; // human
  }
  __asm{
    mov    eax,0x691259
    mov    al,[eax]
    test   al,al
    je     l_No
    mov    eax,0x691258
    mov    al,[eax]
    test   al,al
    je     l_No
  }
  G2B_CompleteAI=0;
l_No:;
  RETURNV
}
Reference URL's