Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
Auto-translated

How do I display a text message? I recommend checking out the FAQ by Jack_of_Shadows – you can find it in his signature and in the group files in my signature. It's done using a script.

С уважением, }{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
Auto-translated
}{0TT@6bI4

How do I display a text message? I recommend checking out the FAQ by Jack_of_Shadows – you can find it in his signature and in the group files in my signature. It's done with a script.

Thank you very much! I found many guides and files on your page!
User Avatar
Auto-translated
Hello everyone,
During the creation and testing of a map, I encountered a problem. The issue is that there's an AI player with a powerful hero in their castle. This hero is disabled and assigned the role of HERMIT (so that no one interacts with him). The AI player has two heroes in reserve, which are retrieved from there using a script. They should behave like regular heroes – capturing mines, resources, and other points of interest. However, they are standing still and don't want to do anything. How can I fix this behavior and make the heroes from the reserve behave like regular AI heroes? I thought about using an AI attractor, but it also doesn't work stably and cannot be configured for two heroes simultaneously.

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
So, wouldn't it be logical to assume that the HERMIT behavior, as specified in the player's settings, also applies to them?
С уважением, }{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
Auto-translated
}{0TT@6bI4
Then it would be logical to assume that the HERMIT behavior specified in the player settings also applies to them?
If we rely on the documentation, SetHeroRoleMode should work for a specific hero, but not for the player as a whole. But I remembered that you can try looking in the player settings in the map properties; there seemed to be something similar for the entire player.

Added 2 minutes ago
AstralLein
In addition, there is a separate scripting function to block interaction with a specific AI hero.
But what function are you talking about? I couldn't find it in the documentation.

Added 9 hours 30 minutes ago
After a series of experiments, I came to the conclusion that a combination of active heroes from the reserve (not running to one point) and an AFK hero in the castle under the control of one player is practically unviable. I set different behaviors for the player as a whole, and not for a specific hero through a script. I reread the documentation again - the function for blocking interaction with a specific AI hero is essentially only one - the one I wrote about above - SetHeroRoleMode (HERMIT). As a result, only two options remain:
- replace the reserve heroes with regular tavern heroes; they behave as expected even with an AFK hero in the castle.
- remove the AFK hero from the castle, and the reserve heroes will become more active.

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
IchGViji
Hello everyone!
I have another question that I haven't found an answer to yet - how can I prevent artifacts from being transferred to the player after defeating an enemy hero? I understand how to do it within the same player - the 'untransferable' property - but unfortunately, it only works if I want to exchange artifacts between my own heroes.
The only option that comes to mind is to remove specific artifacts after the battle, but that seems like a workaround...
SetHeroLootable(<enemy hero name>, nil) should do just that, but I haven't tested it.
In reply to Magnificent
User Avatar
Auto-translated
Magnificent
SetHeroLootable(<enemy hero name>, nil) should do just that, but I haven't checked.
Yes, I just tested it, and it works! And what's even better, it works even on reserve heroes if they aren't on the map. And reserve heroes are a pretty interesting feature, all things considered...

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
Hello!
I have a question for mapmakers and script writers regarding the `startThread` function – is there a desirable number of open threads, and if exceeded, could the game freeze?

The thing is, I'm running some checks not through triggers, but in separate threads, and I'm worried that this might cause the game to crash. I had a situation where the game froze after launching a function in a separate thread. I then added sleeps at the beginning and end of the function, but the concern that the game might still freeze remains.

Those who have experience using `startThread` – have you encountered cases where functions running in separate threads caused the game to freeze, and if so, how did you resolve them? Also, on average, how many additional threads were running simultaneously on your maps?

If needed, all my functions that are launched in separate threads currently look like this:

function doSomeChecks()
   while (1) do
      sleep(10)
      --some code
      if (condition) then
         --some code
         break
      end
   sleep(10)
   end
end

Сценарии:
"Холм мертвецов"
"Священное древо"
In reply to IchGViji
User Avatar
Auto-translated
IchGViji
Hello!
I have a question for those who create maps and scripts regarding the startThread function: is there a desirable number of open threads, and if it is exceeded, can the game freeze?
I haven't heard of any specific limitations. I don't know what checks are required in your case, but I would try to replace several threads with separate checks with sequential checks in one thread, if possible, as this would be more reliable.
IchGViji
For those who have used startThread, have you encountered cases where functions freeze in a separate thread, and if so, how did you resolve them? Also, on average, how many additional threads were running at the same time on your maps?
I only used startThread once (I needed to call a function each time the hero gains experience), and it worked well; I used sleep(5). Freezing is possible due to an infinite loop (somewhere in the --some code)?
In reply to Magnificent
User Avatar
Auto-translated
Magnificent
I haven't heard of any specific limitations. I don't know what checks are required in your case, but I would try replacing several threads with separate checks with sequential checks in one thread, if possible, as this would be more reliable. I only used startThread once (I needed a function call each time the hero gains experience), and it worked well; I used sleep(5). Freezing is possible due to an infinite loop (somewhere in the --some code)?
There is no infinite loop; the condition is very specific, and I debugged it. One example of where I used startThread is to check if the enemy player has no towns and heroes (except for reserve ones). With this approach, the code will be cleaner and simpler, in my opinion.

If this check is done with triggers, it will turn out that one function will have to be written in several places - in the function triggered by the loss of a hero, and in the functions triggered by the capture of towns (and each group of towns has its own separate handler function). This makes code maintenance more complex.

Plus, checking for one-time events - for the new day trigger function, I planned to write regular events so as not to overload it.

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
You can have hundreds of threads running simultaneously, and the game will handle it without any issues. However, it's best to avoid checking certain individual things in an infinite loop, such as calculating the path cost in movement functions – this can cripple the game even with a single thread.
Нет войне.

Statistics

Welcome our newest member: Emil