Current time: 21.11.2024, 19:42 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
ERA III
Author Message
V_Maiko Offline

Posts: 610
Post: #1381

(01.06.2021 19:21)Sandris Wrote:  Хотел узнать, можно ли этот крошечный мод/плагин на свободное изменение имен классов героев в зависимости от пола адаптировать под текущую версию Эры?

https://disk.yandex.ru/d/N36mr1HZPcWncg

Сейчас он, похоже, не работает.

Turquoise is one of the many interesting mods forgotten by feanor, as well as sapphire was to increase the class of heroes, I doubt that the source code of those is still preserved. Probably not even Majaczek inherited these sources.
01.06.2021 20:04
Find all posts by this user Quote this message in a reply
igrik Offline
Administrators

Posts: 2819
Post: #1382

Не знаю, последние или нет. Но вот исходники Феанора:
Code:
// dllmain.cpp: определяет точку входа для приложения DLL.
#include "turquoise.h"

Patcher * globalPatcher;
PatcherInstance *patcher;
/*GAMEDATA save;


void __stdcall InitData (PEvent e)
{
    memset((void*)(save.class_names), 256*32, 0);
}


void __stdcall StoreData (PEvent e)
{
    WriteSavegameSection(sizeof(save), (void*)&save, PINSTANCE_MAIN);
}


void __stdcall RestoreData (PEvent e)
{
    ReadSavegameSection(sizeof(save), (void*)&save, PINSTANCE_MAIN);
}


void __stdcall SetNameWrapper (PEvent e)
{
    SetHeroClassName(ErmX[1], (char*)ErmX[2]);
}

void __stdcall GetNameWrapper (PEvent e)
{
    GetHeroClassName(ErmX[1], (char*)ErmX[2]);
}
*/

_ptr_ GetClassNameDefault;

char* GetClassName(HERO* hero)
{
    char tmp[64];
    sprintf(tmp,"SN:W^hero_class_name_%i^/?z1;", hero->Number);
    ExecErmCmd(tmp);
    
    if(ErmZ[1][0]!=0)
    {
        return ErmZ[1];
    }
    return CALL_1(char*, __thiscall, GetClassNameDefault, hero);
}

void __stdcall InitNames(PEvent e)
{
    char tmp[1024];
    char tmp_erm[1024];
    for(int i=0; i!=256;i++)
    {
        sprintf(tmp,"Hero%i",i);
        ReadStrFromIni(tmp, "Classnames", "turquoise.ini", (char*)tmp);
        if (*tmp)
        {
            sprintf(tmp_erm,"SN:W^hero_class_name_%i^/^%s^;", i, tmp);
            ExecErmCmd(tmp_erm);
        }
    }
}


char* __stdcall GetClassName_hook(HiHook* h, HERO* hero)
{
    return GetClassName(hero);

    /*char tmp[64];
    sprintf(tmp,"SN:W^hero_class_name_%i^/?z1;", hero->Number);
    ExecErmCmd(tmp);

    if(ErmZ[1][0]!=0)
        return ErmZ[1];
    else
        return CALL_1(char*, __thiscall, h->GetDefaultFunc(), hero);*/
}

int __stdcall hook_4E1(LoHook* h, HookContext* c)
{
    c->ecx = (int)GetClassName((HERO*)(c->eax));
    return EXEC_DEFAULT;
}

int __stdcall hook_4DB(LoHook* h, HookContext* c)
{
    c->eax = (int)GetClassName((HERO*)(c->ecx));
    return EXEC_DEFAULT;
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        //инит Эры, инит патчера
        globalPatcher = GetPatcher();
        patcher =  globalPatcher->CreateInstance(PINSTANCE_MAIN);
        ConnectEra();

        
        RegisterHandler(InitNames, "OnBeforeErmInstructions");
        RegisterHandler(InitNames, "OnAfterCreateWindow");

        //Storing data
        /*RegisterHandler(InitData, "OnBeforeErmInstructions");
        RegisterHandler(StoreData, "OnSavegameWrite");
        RegisterHandler(RestoreData, "OnSavegameRead");

/*
        RegisterHandler(SetNameWrapper, "OnErmFunction4074666");
        RegisterHandler(GetNameWrapper, "OnErmFunction4074667");*/

        

        HiHook *h = patcher->WriteHiHook(0x4D91E0,SPLICE_,EXTENDED_,THISCALL_,(void*)GetClassName_hook);
        GetClassNameDefault = h->GetDefaultFunc();
        
        patcher->WriteLoHook(0x4E1DE6, (void*)hook_4E1);
        patcher->WriteLoHook(0x4DB980, (void*)hook_4DB);
        patcher->WriteLoHook(0x4DBDF7, (void*)hook_4DB);
    }
    return TRUE;
}


game bug fixes extended.dll || My Plugins || My GitHub
01.06.2021 20:12
Visit this user's website Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #1383

(01.06.2021 18:24)Berserker Wrote:  !!FU(SaveGame):Pz2;The function is from Era Erm Framework. Many usefull functions there.

Thanks, autosave works now, quicksave says "quicksave + number" in IF:L box but no additional quick saves are created, nor a simple quick save. It creates no save at all. I compared with the autosave section, which works, and was not able to find the error.

One question: where is stored map name, z2? Because I use the abbreviate in the script, as now the title is too long so can't see game day for reload.
(This post was last modified: 01.06.2021 20:43 by Valery.)
01.06.2021 20:19
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #1384

Val, that not true, Tried right now the script and quick saving occurs normally.
Right, z2 is file name and you form it in the script.

Image: image.png


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

Posts: 2196
Post: #1385

I use the 3.8 clean package uploaded by Panda. I get no quick saves and when I reload the only quick save I see, it isn't recent. No idea then...
I see no instructions so no need to start game for script to work, just F12 after replacing

How to read the debug file?

I get erm errors on this script, yet the effects coded at the end (+20 movement) work well


I get also errors when I click on the entrance of a converted dwelling(ie was a portail and then converted to devils). Yet the dwelling is functional and is counted in towns growth.
(This post was last modified: 01.06.2021 21:31 by Valery.)
01.06.2021 21:21
Find all posts by this user Quote this message in a reply
daemon_n Offline
Administrators

Posts: 4343
Post: #1386

Valery, !!IF&53:Q1/8/98/1:M extra ":M"
should be


Image: widget.png?style=banner2

Новейший Heroes Launcher
01.06.2021 21:37
Visit this user's website Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #1387

In fact, it should be no M at all.

!!IF&53:Q1/8/98/1^text^; This is correct. Strange than I never got error before.

I solved the converted dwelling error too, it was a typo

!!IF:Q1/21/y9/4:^%Z1^; -> !!IF:Q1/21/y9/4^%Z1^;

In Era 2 it never gave warning 105
(This post was last modified: 01.06.2021 21:48 by Valery.)
01.06.2021 21:41
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #1388

Valery, not strange. Old ERM engine was lack of dozens of checks, so buggy code could be everywhere.
Example for old ERM: !!VRy1&v9876543=13:S5; no indexes were checked in conditions

> ERM context in commodus.erm:3877:71

When you see ERM error dialog, you see the exact script file : line number in file : line offset
Debug\Era\erm tracking.erm will contain all executed commands with file names, lines and offsets
erm memory.txt contains all ERM variables values

Quote:I see no instructions
It's your script, so yep, timer and options instructions. Maybe debug code. I started new game.


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

Posts: 2196
Post: #1389

Ah, I kept reading the new version you send me before, with no timer and instruction. My bad
01.06.2021 22:08
Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #1390

The clone ability changed in Era 3. The clones are supposed to appear on second round, which meant when your hero had tactics and the other not (or vs neutrals), you get clones as soon as tactics phase is completed. Now they appear 1 turn later.
(This post was last modified: 02.06.2021 06:55 by Valery.)
02.06.2021 06:54
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #1391

Clones and summonings should appear on the second non-tactics round. I fixed the bug. Original summoning description and comments in code meant: "on the second round", but due to complex/invalid round counting in the code clones used to appear sometimes on the first round. Do I understand you correctly?

Code:
[*] Fixed WoG bug with tactics detection on the very first round. Do not use BU:R in !?BR or !?FU(OnCombatRound) for zero round,
    because a few structures are not initialized at this moment and random crash may occur. First round code was moved after
    combat theme initialization and tactics popup message appearance.

[+] Added 4 new battle events as solution to !?BR and v997 mess with full backward compatibility:
    Event: 'OnBeforeBattlefieldVisible'.
    Occurs when battlefield and stacks are ready, but not visible. Right before !?BR&v997=-1.
    WoG applies spells to stacks in this phase and inits shoot/melee/attack-n-return settings.

    Event: 'OnAfterTacticsPhase'.
    Occurs right after tactics phase or after 'OnBeforeBattlefieldVisible' event if no tactics phase takes place.
    WoG summons Santa's guardians in this phase (because now stacks are in their final positions).

    Event: 'OnBattlefieldVisible'.
    Occurs when battlefield becomes visible. Game changes theme to combat and display tactics popup message (if case of active tactics skill)
    right before this phase.
    
    Event: 'OnCombatRound'. A drop-in replacement for !?BR aka 'OnBattleRound'. Occurs only for visible real rounds.
    v997 is round number. For tactics phase it starts from -1000000000. For normal phase, counting starts from 0.
    Each round v997 is increased by one, thus it can serve as always increasing unique round ID.
    Note: v997 value in other triggers may be different!

    Example:
    !?FU(OnCombatRound)&v997=0; on first non-tactics visible real round
    ; apply spells, play music, change creature attributes, etc.


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

Posts: 2196
Post: #1392

It wasn't "sometimes", clones appeared on second round if no tactics on your side - tactics on both sides, then right after tactics phase if you had tactics and enemy didn't. Which lead me to a tons of battles setup in that direction, one map, Time of Prophecy being based on the clones wall tactics, without it will not work.

This is a difficult situation, as long as Era 2 was still playable, the solution was easy, keep the same configuration as the last 15 years or so. But now, with the lethal hit of Microsoft to Win 7, which, based on my experience, puts out of game Era2, I am forced to look for Era 3 compatibility. So far, so good, except this clones aspect which I heavily used, as it diversifies battles.

Is there a chance that a plugin restoring the clone WoG/Era2 behavior could be done then shipped only with my maps? Sorry to bother you, if you have in mind another solution, tell it to me.
02.06.2021 20:18
Find all posts by this user Quote this message in a reply
XEPOMAHT Online
Moderators

Posts: 2356
Post: #1393

(28.04.2021 06:34)Berserker Wrote:  Реальный кадр def может отсутствовать, но сам файл def должен существовать.

Тестирование на портретах монстров показало, что там все кадры в деф-е обязательно должны быть, иначе игра показывает совершенно другой реальный кадр вместо того, что надо. Поэтому для ERA+ придётся добавлять TwCrPort.def с 1000 пустых спрайтов. 148
(This post was last modified: 03.06.2021 00:08 by XEPOMAHT.)
02.06.2021 21:15
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16657
Post: #1394

XEPOMAHT, разве это не HD-мода фишка для предотвращения вылетов? Проверка наличия реального кадра в дефе? Проверь без HD-мода тоже.

Valery, this is exactly the case when bug becomes a feature )
Didn't tested, by try:



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

Posts: 2196
Post: #1395

It didn't work, still on second round with hero having tactics 105
02.06.2021 23:33
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-2024 MyBB Group