Skip to content

Posts from Creature banks. Auto-translated

No ratings yet — be the first to rate!
User Avatar
#1
Auto-translated
Good evening, Heroes fans! I have a desire to change the treasure rooms in HoMM 5 (like Vault of Magi, Blood Temple, Crypt, etc.) so that instead of resources, they give creatures, as in the third game. Does anyone know enough to do this? As I understand it, in defaultstats, you can only change the type of guard and, as a reward, give resources/spells/artifacts.
"Один против всех, и каждый сам за себя!"
User Avatar
#2
Auto-translated
Scripts can be used. And yes, there is a way to make these scripts work with your mod on all maps; see NHF.
 

К А
Стикеры GBF в Telegram
User Avatar
#3
Auto-translated
You seem to be familiar with scripts, so I'll just provide a general list of actions:
- Create script tables with guards and rewards (organize them in a way that is convenient for you)
- At the start of the map, iterate through all buildings of this type using GetObjectNamesByType("BUILDING_BLOOD_TEMPLE") and attach touch triggers
- Alternatively, you can create a class for the building-bank with corresponding initializers...
- Touching the bank emulates a battle using StartCombat, and in the callback upon the hero's victory, a random reward is given (or a reward tied to the strength of the guard)
- In the callback, the touch trigger is also reset (or a message is displayed, such as "The treasure has already been looted" + MarkObjectAsVisited()).
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
#4
Auto-translated

}{0TT@6bI4
It seems you're familiar with scripts, so I'll just provide a general list of actions:
- Create script tables with guards and rewards (organize them in a way that's convenient for you)
- At the start of the map, iterate through all buildings of that type using GetObjectNamesByType("BUILDING_BLOOD_TEMPLE") and attach touch triggers
- Alternatively, you can create a building-bank class with corresponding initializers...
- Touching the bank emulates a battle using StartCombat, and in the callback after the hero wins, they receive a random reward (or a reward tied to the strength of the guard)
- In the callback, also reset the touch trigger (or, for a better visual, display a message like "The treasure has already been looted" + MarkObjectAsVisited())

Well, within a single scenario, there are no questions. But where and how do I save the script so that it applies to all maps, including RMG?

"Один против всех, и каждый сам за себя!"
In reply to Картошечка_Pro
User Avatar
#5
Auto-translated
In the data.pak file, there is a scripts folder. You should be interested in the advmap-startup.lua file. At the end of it, you need to add a doFile command with a link to your triggers.
In reply to Долгий
User Avatar
#6
Auto-translated

Long
In data.pak, there is a folder called scripts. You should be interested in advmap-startup.lua. At the end of it, you need to write doFile with a link to your triggers.

Thank you for the guidance.

"Один против всех, и каждый сам за себя!"
In reply to Долгий
User Avatar
#7
Auto-translated

Long
In data.pak, there is a folder called scripts. You should be interested in advmap-startup.lua. At the end of it, you need to write doFile with a link to your triggers.

The advice helped, thank you. But there is one problem. In single-player mode, the scripts work, the treasure chests work as they should, but this does not apply to multiplayer. When trying to start a game on an RMX map with an opponent, all creature banks reset their scripts and act according to their functions before the changes. When trying to play the same map in single-player mode, everything works fine again. Of course, the opponent also has the modification installed. What could be the problem?

"Один против всех, и каждый сам за себя!"
In reply to Картошечка_Pro
User Avatar
#8
Auto-translated
Kartoshechka_Pro

 

The advice helped, thank you. But there's one problem. In single-player, the scripts work, and the treasure chests function as they should, but this doesn't apply to multiplayer. When attempting to start a game on an RMX map with an opponent, all creature banks reset their scripts and function according to their original functions before the changes. When attempting to play the same map in single-player mode, everything works as it should again. Of course, the opponent also has the modification installed. What could be the problem?

advmap-startup.lua is only loaded if the map's MapScript specifies a link to the script. You either need to patch the maps or manually add the links.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
#9
Auto-translated

}{0TT@6bI4
advmap-startup.lua is only loaded if the map's MapScript contains a reference to the script. Either the maps need to be patched, or the references need to be added manually.

Understood, I'll think about it.

"Один против всех, и каждый сам за себя!"