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

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

Posts: 1126
Post: #9196

Is there a way to let AI learn that my Diamond Dragon's breath attack's secondary target won't deal damage to friendly troops (but the main target still will, if it's hypnotized)?

I can write something like this:

This works almost perfect but I want to avoid setting the damage to 0 for the main target. It seems there is no classic erm way to know whether a target is the secondary target of breath attack or main in OnStackToStackDamage.

Edit:
I made it with some enlightenment from daemon_n. A hook at 441487 makes the whole thing very straightforward.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 14.12.2023 09:04 by Archer30.)
14.12.2023 08:17
Find all posts by this user Quote this message in a reply
daemon_n Offline
Administrators

Posts: 4338
Post: #9197

Как получить тип загружаемого ресурса из дерева всех ресурсов по имени?

На ERM имею следующий код:
(Click to View)
Проблема в том, что для Pcx и Pcx16 результаты не те, что ожидалось, ведь их типы 2/16 и 0/18 соответственно, если верить IDA

Что не так с кодом, с игрой, с чем-либо ещё?


Image: widget.png?style=banner2

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

Posts: 2277
Post: #9198

(23.12.2023 08:16)daemon_n Wrote:  Проблема в том, что для Pcx и Pcx16 результаты не те, что ожидалось, ведь их типы 2/16 и 0/18 соответственно, если верить IDA

Что не так с кодом, с игрой, с чем-либо ещё?

1. HD-мод умеет подменять любой pcx на bmp, поэтому при вмешательстве в код Бараторч наверняка добавил собственные типы, чтобы самостоятельно выгружать HD-модовский ресурс (и чтобы сам движок игры его даже не пытался выгружать).

2. era.dll умеет подменять любой pcx на png, поэтому при вмешательстве в код Берсеркер наверняка добавил собственные типы, чтобы самостоятельно выгружать эровский ресурс (и чтобы сам движок игры его даже не пытался выгружать).

Поэтому лучше проверять на pcx, которые на 100% никто не подменяет (а в сборке Лаучера вполне возможно, что скоро будут подменены все pcx в игре).
23.12.2023 09:55
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16503
Post: #9199

Quote:2. era.dll умеет подменять любой pcx на png
Я гружу классическую pcx8/pcx16 заглушку из чёрных пикселей. Вся реальная работа через перехват функций отрисовки.


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

Posts: 4338
Post: #9200

XEPOMAHT, результат не зависит от HD mod, потому подозреваю, что проблема в моём коде


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
23.12.2023 18:44
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Online
Moderators

Posts: 1126
Post: #9201

In Campaigns:
Is there a way to get the list of creatures that will be carried over to the next zone?


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

Posts: 1126
Post: #9202

Is there a way to load a save game with a hotkey, for example, loading Battle!.GM1 with F10?

Guess it should be calling this function:
004BEFF0

But I tried a few times and failed Fie


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

Posts: 16503
Post: #9203

Seems like no easy way.


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

Posts: 2814
Post: #9204

Да, простого пути вообще нет. Я сам когда-то пытался сделать такое, но потом забил, ибо очень извороченная это задача. Очень!


game bug fixes extended.dll || My Plugins || My GitHub
13.01.2024 21:22
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Online
Moderators

Posts: 1126
Post: #9205

Is there a way to change the name/creature description of a stack on the battlefield?


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

Posts: 2814
Post: #9206

(15.01.2024 11:27)Archer30 Wrote:  Is there a way to change the name/creature description of a stack on the battlefield?
http://wforum.heroes35.net/showthread.ph...#pid110637


game bug fixes extended.dll || My Plugins || My GitHub
15.01.2024 14:45
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Online
Moderators

Posts: 1126
Post: #9207

igrik, thanks a lot!

Well, looks like I need a hook (or MM0?) here because the description I want to show is dynamic. For example,

Quote:Level %y1
where y1 equals the level of the War Machine/Henchman.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 16.01.2024 04:28 by Archer30.)
15.01.2024 17:39
Find all posts by this user Quote this message in a reply
Archer30 Online
Moderators

Posts: 1126
Post: #9208

New question:

Is there to get the pointer of a string in json, for example:

Code:
{
  "ntsfl":  {
    "set": {
      "altTerrains": "1"    // alternative terrains for Castle/Tower
    },

    "str": {
      "grailName":  "Eye of Sauron",
    }
  }
}

What would the pointer to "%T(ntsfl.str.grailName)" be?


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

Posts: 16503
Post: #9209

No, there is not safe way to get a pointer to such string. Strings are allocated on heap (in dynamical memory) and may be deallocated/relocatted any time.
You can create string array before battle and release it after battle. There is a way to get string address on SN:M array element.


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

Posts: 1126
Post: #9210

Berserker, very useful, thanks


Latest ERA mods and scripts in development - My GitHub
17.01.2024 01:38
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