Skip to content

Posts from NHF – new heroes for Heroes V 3.1.

4.9 (16 ratings)
In reply to RedHeavenHero
User Avatar
#1337
Auto-translated
RedHeavenHero
You can modify the function to add extra elements to the returned table.
The mine doesn't have the CollectableArmy, TownType, and AllowQuickCombat properties, which could lead to issues. To fix them, you'd have to create a bunch of scripts again, and is that the price of automation?
By default, some properties are added to the types. But this won't affect older versions :(

How can I modify the function so that it doesn't cause a significant performance impact?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#1338
Auto-translated
local wrap = GetObjectNamesByType function GetObjectNamesByType(s) if s == 'GARRISON' then return NHF_OBJECTS_GARRISON -- table with pre-known garrison names else local t = %wrap(s) return t end end ```

Added 1 minute ago
By default, some properties are added to types. But this won't affect older versions.
Types? Where is this?
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1339
Auto-translated
RedHeavenHero
local wrap = GetObjectNamesByType

function GetObjectNamesByType(s)
if s == 'GARRISON' then
return NHF_OBJECTS_GARRISON -- table with predefined garrison names
else
local t = %wrap(s)
return t
end
end


Added 1 minute ago

Types? Where is this?
In data.

So, you still need to define the predefined ones.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#1340
Auto-translated
Wouldn't it be easier to define the names in advance rather than rework an entire object type? Otherwise, you'll end up with a ton of bugs; there's probably a reason why the garrison was separated into a distinct type, and the developers likely had their reasons for doing so.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1341
Auto-translated
RedHeavenHero
Wouldn't it be easier to assign names in advance than to rework an entire object type? Otherwise, you'll end up with a ton of bugs; there's probably a reason why garrisons were separated into a separate type, and the developers likely had their reasons.
So, then you'll need to process the map files with your program. And you'll have to rework the standard ones yourself.
Okay. Then the Dwarf Preserve and garrisons can be included in the naming system.
We also need to write scripts for capturing mines, elementals, and other things...

Added 2 minutes later
This way, it will be possible to create perks to increase the reward from guarded objects, for example, add to the "trophies" perk, which will increase the chance of an artifact dropping. Or give this ability as a hero specialization.

Added 5 minutes later
We'll need a unified list of in-game names, like: nhf_garrison_ .. i
Then there's another problem: what if the garrisons in the map are already named by the creator? Then you'll have to either fix the Lua file simultaneously or add all the names to an array, if they exist, add the names of the non-existent ones to the array, and then count by index. The last option is optimal, but it requires checking for an existing name.

So, will you rework the program? And I'll change the existing maps.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#1342
Auto-translated
I suggest the following: process the map.xdb file, give names to unnamed garrisons and Preserves, and save these names in a separate Lua file, which will be the same for each map but have the same name. This file will contain an array of names, including those given by the author. If necessary, I can also process the default maps, although not manually.

Added 5 minutes later
Thus, the file Maps/Multiplayer/***/NHF-Names.lua will contain something like this: NHF_UNNAMED_OBJECTS = {
DWARVEN_WARREN = {
'NHF-DwarvenWarren-0001',
'NHF-DwarvenWarren-0002',
},
GARRISON = {
'gar1',
'gar2',
'NHF-Garrison-0001',
'NHF-Garrison-0002',
'NHF-Garrison-0003',
'NHF-Garrison-0004',
},
}
The sequential numbers can be replaced with random ones.

Added 7 minutes later
To save memory, unnamed objects can be excluded from the array, and only the number of these objects can be written. NHF_UNNAMED_OBJECTS = {
DWARVEN_WARREN = {
NAMED = {
},
UNNAMED_N = 2,
},
GARRISON = {
NAMED = {
'gar1',
'gar2',
},
UNNAMED_N = 4,
},
}
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1343
Auto-translated
RedHeavenHero
I suggest the following: process the map.xdb file, give names to unnamed garrisons and Preserves, and save them in a separate lua file that will be for each map, but will have the same name. This file will contain an array of names, including those given by the author. If necessary, I can also process the default maps, not manually, of course.

Added 5 minutes ago
Thus, in the file Maps/Multiplayer/***/NHF-Names.lua, there will be approximately the following:
NHF_UNNAMED_OBJECTS = {
DWARVEN_WARREN = {
'NHF-DwarvenWarren-0001',
'NHF-DwarvenWarren-0002',
},
GARRISON = {
'gar1',
'gar2',
'NHF-Garrison-0001',
'NHF-Garrison-0002',
'NHF-Garrison-0003',
'NHF-Garrison-0004',
},
}
Sequential numbers can be replaced with random ones.

Added 7 minutes ago
To save memory, unnamed objects can be omitted from the array, and only the number of these objects can be written.
NHF_UNNAMED_OBJECTS = {
DWARVEN_WARREN = {
NAMED = {
},
UNNAMED_N = 2,
},
GARRISON = {
NAMED = {
'gar1',
'gar2',
},
UNNAMED_N = 4,
},
}
There probably won't be many objects of the "garrison" type. Should we save memory?
If you want, you can also process the standard ones.

Added 9 minutes ago
In general, a large function for interacting with the necessary objects will be required for unification. But the problem is that scripts work with objects differently. For example, the trigger for touching a Castle needs to be completed upon visiting and then updated again. The trigger for touching a mine does not require this. In the latest version, I have already combined the battle script with the Castle, hero, and monsters. It is now universal. You can try to move functions to resemble classes to reduce the load and the number of script lines.
Previously, the project was assembled piece by piece, and different scripts for the same situation were the norm. Now there is a lot of similarity. Unification is needed.

RedHeavenHero, what do you think about merging the project with part of NCF and even creating new maps with multiplayer scenarios for these heroes?

Added 17 minutes ago
Ideally, of course, it is better if all names are stored only with the map.
And only this file is loaded. Then there will be few names.

An array is created in the General NHF file, and in the lua of each map, there will only be an addition to this array.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#1344
Auto-translated
There’s also an issue with treasure rooms. Is there a way to extract their army using scripts to influence it? If not, I want to convert all such buildings to scripted battles, similar to the map “I’m Going Out.”
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#1345
Auto-translated
But what should be done with the mobs near the portals? If they are linked to heroes, the portals will become inaccessible. If not, the special abilities of certain heroes will not affect them.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
#1346
Auto-translated
Dyrman
There's also an issue with treasure rooms. Is there a way to pull their army using scripts to influence it? If not, I want to convert all such buildings to scripted battles, similar to the "I'm Going Out" map.
Perhaps, you could add the possible armies to a table and initiate a battle with the selected one.

Added 1 minute later
Dyrman
But what should be done with the mobs near the portals? If they are linked to heroes, the portals will be inaccessible. If not, the special abilities of certain heroes will not affect them.
In principle, the map can be processed so that triggers can be applied not to the mob near the portal, but to the portal itself.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1347
Auto-translated
RedHeavenHero
Perhaps we could add the possible armies to a table and run battles with the selected ones.

Added 1 minute ago

In principle, it's possible to process the map so that triggers can be applied not to the mob near the portal, but to the portal itself.
I believe that the portals also need to be processed. But without a trigger (otherwise, the AI won't pass through).
This way, you can create one-way protection.
We process the map using a program, find groups. We collect the names of the monsters near the portal. We replace them with identical armies on all sides. When one army is destroyed, it is removed from the other side. There may be difficulties if there are more than 3 portals in a group, but they can be solved. And if the army is initially one-sided, it is necessary to create an army on the other side, which is also not easy.

Regarding treasure vaults, that's what I wanted. But it will be necessary to lower the priority to "do not touch" (there was such a standard function in the scripts) for such objects for the AI.

Added 1 hour 35 minutes ago
RedHeavenHero, can you create an array of portals (divided into groups), just like the garrisons and Dwarf Preserves, in a separate file?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
#1348
Auto-translated
Should they be placed all together or separately? Are stairs needed?
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1349
Auto-translated
RedHeavenHero
Should one-way paths be grouped together or separated? Are ladders needed?
Yes, all of them. Groups cannot be read by scripts(((

Added after 8 hours and 57 minutes
Regarding one-way paths, there's a point: the army should be taken based on priority at the entrance, if there is one. Therefore, knowing the entrance is important.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
#1350
Auto-translated
Would this data table structure work?
NHF_OBJECT_GROUPS = {
	MONOLITH_TWO_WAY = {
		["NHF-Building-0001"] = 0,
		["NHF-Building-0002"] = 0,
		["NHF-Building-0003"] = 1,
		["NHF-Building-0004"] = 1,
		["NHF-Building-0005"] = 1,
	},
	MONOLITH_ONE_WAY = {
		["NHF-Building-0006"] = 0,
		["NHF-Building-0007"] = 0,
		["NHF-Building-0008"] = 0,
	},
	SUBTERRA_GATE = {
		["NHF-Building-0009"] = 0,
		["NHF-Building-0010"] = 0,
		["NHF-Building-0011"] = 1,
		["NHF-Building-0012"] = 1,
		["NHF-Building-0013"] = 2,
		["NHF-Building-0014"] = 2,
	},
}
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#1351
Auto-translated
RedHeavenHero
Would this data table structure work?
NHF_OBJECT_GROUPS = {
	MONOLITH_TWO_WAY = {
		["NHF-Building-0001"] = 0,
		["NHF-Building-0002"] = 0,
		["NHF-Building-0003"] = 1,
		["NHF-Building-0004"] = 1,
		["NHF-Building-0005"] = 1,
	},
	MONOLITH_ONE_WAY = {
		["NHF-Building-0006"] = 0,
		["NHF-Building-0007"] = 0,
		["NHF-Building-0008"] = 0,
	},
	SUBTERRA_GATE = {
		["NHF-Building-0009"] = 0,
		["NHF-Building-0010"] = 0,
		["NHF-Building-0011"] = 1,
		["NHF-Building-0012"] = 1,
		["NHF-Building-0013"] = 2,
		["NHF-Building-0014"] = 2,
	},
}
One-way structures should be divided into entrance and exit. And the underground passage could be as well.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...