Current time: 03.05.2024, 07:48 Hello There, Guest! (LoginRegister)
Language: english | russian  

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

Posts: 1126
Post: #9211

New question:

So I am trying to set up a string array and use it later, yet nothing seems to work.

%(namePtr) %(descPtr) are both 0. What could be wrong?


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

Posts: 1126
Post: #9212

New question:
Is there a way to make AI heroes more aggressive, like they believe they are stronger and decide to defeat neutral stacks on the map more often?

I tried to place different hooks around AI values calculation, yet those hooks led to crashes.


Latest ERA mods and scripts in development - My GitHub
20.01.2024 03:54
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16502
Post: #9213

First of all, warning. Address in SN:M memory is preserved only until game restart/array deallocation (SN:M#118 or any operation, changing array size (push, pop, setCount).
You began with array of size 2 and two empty strings from start. Then you pushed another two strings and got addresses of the first two strings.

ntsfl_grailStr = ['', '', 'some name', 'some description'];

Just change !!SN:M(M_AUTO_ID)/2/(M_STR)/(M_STORED)/?i^ntsfl_grailStr^; to

!!FU(NewStrArr):P?i^ntsfl_grailStr^/(M_STORED); create new string array of size 0

And don't change array size anymore. Tell me if you need a function like AllocBattleStr:P^some text^/?(valid address until battle end)


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

Posts: 1126
Post: #9214

Ah yea that's a simple mistake. Thanks a lot! It's sorted out.


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

Posts: 1126
Post: #9215

Yet another new question:

Is OnBattlefieldVisible a good timing for playing spell animation?

Here's a debug sent from a player

As we can see, the game crashed exactly when spell animation was played.
This is reported from time to time. I could not reproduce a single crash with that script but I think it would be good to resolve it once and for all.

My questions:
- Is there any alternative timing for spell animation before tactics phases/after entering the battlefield?
- Is playing spell animation after OnBattleRound safer and leads to fewer issues?


Edit: It looks like OnBattlefieldVisible is indeed not safe. Even BM:M at this timing could fail. I plan to abandon this trigger from all scripts.


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

Posts: 16502
Post: #9216

It seems not stable. Probably, on BeforeBattleAction on Round 0 is better.


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

Posts: 1126
Post: #9217

Do you mean
is better than
Btw both are after Tactics, which isn't the best solution because you usually want to know most info before setting your troops' positions.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 22.01.2024 06:10 by Archer30.)
22.01.2024 04:16
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1013
Post: #9218

Здравствуйте..

А кто может подсказать, а почему нельзя никак удалить пустую лодку с карты приключений командой !!UN:O ?

В чём тут подвох?
22.01.2024 18:29
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2277
Post: #9219

(22.01.2024 18:29)fatsawhorse Wrote:  А кто может подсказать, а почему нельзя никак удалить пустую лодку с карты приключений командой !!UN:O ?

В чём тут подвох?

Лодка, как и герой, - объект менеджера окна приключений, а не объект карты. Соотвественно, добавление и удаление - отдельные содовские функции, !!UN:O не увидит лодку, т.к. физически на карте её нет - она отрисовывается поверх карты.
22.01.2024 20:19
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1126
Post: #9220

Continue from the topic here

This is a script for adding "TEST" in the description of the first stack of the Defender's side (stack #21). I'd like to know if I am doing this correctly.

Questions:
1. Is there anything to be fixed/optimised?
2. Is both restorations of pointers OnGameLeave and OnAfterBattleUniversal necessary?


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

Posts: 16502
Post: #9221

It seems, that there is no need to restore descriptions on game leave or even on after battle. Try without restoration code at all.


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

Posts: 1126
Post: #9222

Berserker, thanks, thought that was necessary. Now it's much simpler.


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

Posts: 16502
Post: #9223


I use prefix "edu" as "educational" replacement. Just call edu_AllocBattleStr function to get stable address for any text, which will work until battle end.


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

Posts: 1126
Post: #9224

Berserker, it worked well, thanks. Maybe that should be placed in EEF?

Also any hint about this?


Latest ERA mods and scripts in development - My GitHub
24.01.2024 11:50
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16502
Post: #9225

Yep, you can add the code to EEF.



Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
25.01.2024 16:52
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