Current time: 15.04.2024, 01:50 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Ваши вопросы по ERM-скриптам
Author Message
Berserker Offline
Administrators

Posts: 16471
Post: #8971

Или так:



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

Posts: 1104
Post: #8972

daemon_n, XEPOMAHT, Berserker, thanks for the answers.

I have another question, how can I remove a hero with error. For some reason, a hero is put on the map without assinging an owner. By checking with erm, I have this:
Image: s43tOPV.png
IF:M returns the correct coordinates and -1 as the owner.

As a result, the game crashes at the start of this hero's turn. What I want to do is to either correct the owner or remove the hero from the map so that it won't cause error.

Tried with HE:K, HE:O, no luck.


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

Posts: 4338
Post: #8973

Archer30, set pos -1/-1/-1;


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
13.02.2023 04:01
Visit this user's website Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #8974

Set owner to red, call HE:P to change position, call HE:K.


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

Posts: 4338
Post: #8975

to set owner properly, you need use player setup OW:O


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
14.02.2023 19:08
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1104
Post: #8976

Unfortunately, none of Berserker and daemon_n's method works. The hero with no owner still stays on the screen.

HE:O + HE:K simply has no effect
HE:P-1/-1/-1 leads to an instant crash

I don't understand how OW:O can help here


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 15.02.2023 01:11 by Archer30.)
15.02.2023 01:10
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2271
Post: #8977

(15.02.2023 01:10)Archer30 Wrote:  I don't understand how OW:O can help here

(15.02.2023 01:10)Archer30 Wrote:  HE:O + HE:K simply has no effect

У Вас там такое возмутительное количество работающих скриптов, что разобраться в них просто так не получится. При таком объёме найти ошибку очень сложно (особенно когда в ваших модах одни скрипты правят ошибки других, другие правят ошибки третьих и т.д., в итоге такие кастыли копятся как снежный ком и превращают общий ERM-код в тыкву). Скорее всего какой-то кривой ERM-скрипт делает данного героя безхозным, от того, его нельзя убрать с карты с помощью !!HE:K.

(15.02.2023 01:10)Archer30 Wrote:  HE:P-1/-1/-1 leads to an instant crash

Перемещать героев за пределы карты вообще-то нельзя.
15.02.2023 02:16
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #8978

Archer30, maybe upload savegame?


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

Posts: 1104
Post: #8979

Berserker, unfortunately, the save game was heavily modded, you will have to download stuff in order to load it. I don't think it is worth the time.

So I know clearly how exactly this problem happened. It was resulted by my script of boosting AI turn speed.
The script is long, but the main idea is rather clear: It resets AI heroes every X day with the function !!SN:E5081488/(CALLCONV_THISCALL)/(heroPtr)/(hero); to remove some unimportant data so that the AI could start moving instead of being stuck in a place for minutes. I don't know the details of this function, but it just works. The AI heroes do have a shorter time of responding.

My script:

Full script for download

Here comes the problem of my script:
In most cases, the script works ok. But for some reason, usually, after Month 2, there is a chance the script results in an error just like the screenshot here. Pink player's heroes were moved back to the map, yet the owner could not be set correctly. If this happens, the game will crash the next day when Pink is about to move, but if loading a save game before the day with error and re-execute my script, the error could be gone. That is a say, the problem does not happen 100% but once it happens, it is the end of the game.

Here I'd like to know if you guys have advice on my script or boosting AI turn speed in general, mostly I want to know if there is a chance to fix the issue of missing hero owner by executing this script.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 15.02.2023 08:27 by Archer30.)
15.02.2023 08:21
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2271
Post: #8980

(15.02.2023 08:21)Archer30 Wrote:  It resets AI heroes every X day with the function !!SN:E5081488/(CALLCONV_THISCALL)/(heroPtr)/(hero); to remove some unimportant data so that the AI could start moving instead of being stuck in a place for minutes. I don't know the details of this function, but it just works. The AI heroes do have a shorter time of responding.

Единственное, что увидел в этой функции, влияющее на ИИ, это сброс множителя агрессии героя на дефолтное значение и сброс координат карты, в которые идёт ИИ. И то, и другое можно устанавливать вручную с помощью нескольких строк, без вызова функции по 5081488, т.е. без костылей в сотни ERM-строк, замедляющих игру. НО:

1. Сброс координат заставит ИИ поменять цель визита на карте, что, возможно, сделает его тупее.
2. Сброс агрессии так же может превратить героя в тряпку и лёгкую мешень для человека.
3. Можно конечно сбрасывать счётчики телепортации и городского портала, но так ИИ так же не сможет пользоваться данными заклинаниями на 1 ход, т.е. ещё сильнее оглупеет.

Алгоритмы поведения ИИ с помощью кастылей всё же советую не менять - они написаны достаточно неплохо и работают быстро на картах стандартных размеров. Да, на картах гигантсткого размера ИИ долго думает, но это решается только увеличением тактовой частоты процессора - по коду игры радикальных оптимизаций написать за 20 лет пока ни у кого не получилось. Костыли в виде отупляющих ИИ ERM-скриптов - не выход.
15.02.2023 11:08
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16471
Post: #8981

Archer30, is AI slow if fly and dimension door are banned?


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

Posts: 1104
Post: #8982

XEPOMAHT, thanks. Well, I understand executing the function at 5081488 certainly has some problems, but on the other hand, it's quite annoying for players to see AI heroes standing for so long before moving. I mean, something is wrong in the mods, but I don't know where exactly so that I wrote another script to boost AI speed and cause some other troubles.

Would you mind simplifying my script a bit without calling 5081488?

Berserker, it is. In my full script I disable AI DD and limit the quantity of AI heroes. Yet the function at 5081488 is still crucial for boosting the speed of AI.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 15.02.2023 16:01 by Archer30.)
15.02.2023 15:25
Find all posts by this user Quote this message in a reply
igrik Online
Administrators

Posts: 2814
Post: #8983

(12.02.2023 23:12)Archer30 Wrote:  As a result, the game crashes at the start of this hero's turn. What I want to do is to either correct the owner or remove the hero from the map so that it won't cause error.

Tried with HE:K, HE:O, no luck.

Archer30, try this:



game bug fixes extended.dll || My Plugins || My GitHub
16.02.2023 19:36
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1104
Post: #8984

igrik, thanks. I tested the code and it resulted in map drawing error.

But don't worry, I am not seeking for resolving the issue from this side anymore. I should be able to prevent a hero from appearing on the map with no owner.


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

Posts: 1104
Post: #8985

Is there a way to check the hex ID my creature is about to stand for the melee attack (if I click my mouse)?

Here's a problem I encounter. I try to make the Backstab ability, which gives a 20% bonus on the final damage if attacking from behind. The problem is, without a way to check the hex ID of my creature is about to stand for its next attack, I can't have the corrected damage shown on the screen (so it won't be like Cavalier with Charge ability, showing different damage according to mouse position).

Well, it's confusing to describe, let's see the code.


What should I change the MM:D line, for it to return the position my creature about to appear for the next attack?
In a word, is it possible to have my theoretical damage corrected depending on whether it's going to be an attack from behind?

I know it can be done by CM:A and a lot of lines. I hope to know an internal way so the code can be shorter.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 23.02.2023 07:55 by Archer30.)
23.02.2023 07:19
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