Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
#2892
Auto-translated
RedHeavenHero, could you explain it to me? Maybe I'll understand better if you do... You were able to explain things clearly to me before...
Правило во взгляде...
In reply to Rhenish
User Avatar
#2893
Auto-translated
Rhenish
RedHeavenHero, could you explain it, maybe I'll understand better... you were able to explain things to me clearly before...
Pack the contents of the MOD into a map archive, preserving the paths.
In the script, write in the appropriate place:
StartDialogScene("path")
Regarding the path: Take the path to the dialog file (DialogScene.xdb) and remove everything that doesn't belong to the archive, change backslashes to forward slashes, and add after the extension #xpointer(/DialogScene).
As a result, it should look something like this:
StartDialogScene("/folders/folders/folders/scene name/DialogScene.xdb#xpointer(/DialogScene)")
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2894
Auto-translated
I noticed a peculiar behavior: I create a treasure with a specific scripted name: ``` CreateTreasure('some_name', TREASURE_CHEST, 10, 111, 118, GROUND, 0) ``` Then, I try to access it using that name: ``` print(IsObjectExists('some_name')) ``` It returns nil, meaning it doesn't find an object with that name, even though the treasure itself appears on the map. In a similar function, CreateStatic, everything works as expected. Is this a misunderstanding on my part, or a bug in the developers' code?
In reply to Jack_of_shadows
User Avatar
#2895
Auto-translated
Jack_of_shadows
I noticed a peculiarity: when I create a treasure with a specific scripted name:

CreateTreasure('some_name', TREASURE_CHEST, 10, 111, 118, GROUND, 0)

and then try to access it using that name:

print(IsObjectExists('some_name'))

it returns nil, meaning it doesn't find an object with that name, even though the treasure itself appears on the map. In a similar function, CreateStatic, everything works as expected. Is this a misunderstanding on my part, or a bug in the developers' code?

I don't understand why print and similar functions are even needed, but I do have a thought about why it returns nil. Do these two lines in your script run sequentially? If so, there's nothing surprising. There should be at least some time delay between them, such as sleep(1);. The game simply doesn't have time to place 'some_name' in the list of objects and then immediately perform an operation with it. There might be another reason, and other people can offer suggestions.
Кампании для Heroes V 3.1 (Трилогия):

Пробуждение зла
Нашествие из Преисподней
Смена эпох

Скачать все кампании одним архивом: Яндекс.Диск Google.Диск

You can download the set of 3 Campaigns (English version) here


Одиночные сценарии Heroes V 3.1:


Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы

Мультиплеерные карты для Heroes V 3.1:

Легендарная война
Сердце вулкана
Передел мира
In reply to Jack_of_shadows
User Avatar
#2896
Auto-translated
Jack_of_shadows
I noticed this peculiarity: when I create a treasure with a specific scripted name:

CreateTreasure('some_name', TREASURE_CHEST, 10, 111, 118, GROUND, 0)

and then try to access it using that name:

print(IsObjectExists('some_name'))

it returns nil, meaning it doesn't find an object with that name, even though the treasure itself appears on the map. In a similar function, CreateStatic, everything works as expected. Is this a misunderstanding on my part, or a developer error?
This is their error. When a resource is created, the name given in the function is not assigned to it; instead, it is assigned a default name:
"floor_number-x_coordinate-y_coordinate--some_large_number"
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2897
Auto-translated
I don't understand why print and similar commands are even needed.
I was calling commands from the console, creating a treasure, seeing that it appeared on the map, and then checking its presence using the print command.

RedHeavenHero, so I know part of the name, everything except the large number? All that remains is to figure out if Lua can analyze the contents of strings.

The essence of the task is as follows: a treasure is generated periodically in a certain location. If the player has not yet picked up the previous one, a new one should not be generated. Accordingly, I planned to check for its presence by script name.
User Avatar
#2898
Auto-translated
Jack_of_shadows
I called the team from the console, created a treasure, saw that it appeared on the map, and then checked its presence using the print command.

RedHeavenHero, so I know part of the name, everything except the large number? All that remains is to figure out if Lua can analyze the contents of strings.

The essence of the task is as follows: a treasure is generated periodically in a certain place. If the player has not yet picked up the previous one, a new one should not be generated. Accordingly, I planned to check for its presence by script name.
I did the same thing, but only with creatures. Maybe you could put a region in that place and work with tsObjects using GetObjectsInRegion(sRegionName, nObjectsTypeID)?
Or another option is to use chests: put several chests in some place on the map (in a secluded spot), assign them names. Use SetObjectPosition(sObjectName, nX, nY, nFloorID = -1) to place them in the desired location. Check by name using IsObjectExists(sObjectName). I'm sure there are other, simpler options
Кампании для Heroes V 3.1 (Трилогия):

Пробуждение зла
Нашествие из Преисподней
Смена эпох

Скачать все кампании одним архивом: Яндекс.Диск Google.Диск

You can download the set of 3 Campaigns (English version) here


Одиночные сценарии Heroes V 3.1:


Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы

Мультиплеерные карты для Heroes V 3.1:

Легендарная война
Сердце вулкана
Передел мира
In reply to Jack_of_shadows
User Avatar
#2899
Auto-translated
Jack_of_shadows
I called the team using the console, created a treasure, saw that it appeared on the map, and then checked its presence using the print command.

RedHeavenHero, so I know part of the name, everything except the large number? All that remains is to figure out if Lua can analyze the contents of strings.

The essence of the task is as follows: a treasure is generated periodically in a certain location. If the player has not yet picked up the previous one, a new one should not be generated. Accordingly, I planned to check for its presence by script name.
The only way I see is to iterate through all integers up to, for example, 100,000. This will be long and tedious, so you won't be able to create many such treasures.
Analyze strings??? What do you mean?

Added 2 minutes ago
For the record: the number of each object is greater than the previous one.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2900
Auto-translated
Analyze strings??? What do you mean?
I mean, being able to search for substrings within strings. In other words, it would be great if a construct like this worked:
IsObjectExists('part_of_name'..*)
where * represents any value.

I'll try the region and GetObjectsInRegion approach in the evening, and then we'll see.
User Avatar
#2901
Auto-translated
The first one doesn't work. Scripts require exact names.
GetObjectsInRegion seems to only work with heroes.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2902
Auto-translated
Yes, here’s another thing I can’t figure out: how does the GenerateHeroInTown function work in the editor’s properties? It creates a hero when entering a town. But which town does it create the hero in? Only the main town? Or all towns belonging to that player? How does it behave if the town entrance is occupied by another hero? Does it create a hero based on the faction, or just randomly? Does it select the hero from the list of available heroes, marked with a checkmark in the editor? Does it need a RandomHeroBox to be set when entering a town for it to work? Because it’s nonsense, I can’t find any pattern. For example, I’ve set up three towns, one of them is occupied, the others are free – no matter how I change the MainTown, heroes don’t appear at all. Anywhere.

Whatever
User Avatar
#2903
Auto-translated
This allows you to select a hero in the game creation menu.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2904
Auto-translated
Ugh. Is it really impossible to have only one hero in each castle belonging to the same player?

Whatever
User Avatar
#2905
Auto-translated
The interface doesn't allow it.

Added after 31 seconds
Unless you use scripts.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4