Skip to content

Posts from How do I set a hero limit for the AI?

No ratings yet — be the first to rate!
Auto-translated
How do I set a hero limit for a computer-controlled opponent, so that it can't recruit more than 3 heroes? Thanks in advance for the answer!
User Avatar
Auto-translated
You can lock heroes in the tavern. In the player tab. But it's a lengthy process. I don't know of any other ways.

Added 2 minutes later
Oh, and yes. Why create a new thread? You could just ask about this in the existing thread about the editor.
На дальней станции сойду...
Трава по пояс,
Зайду в траву, как в море босиком...
User Avatar
Auto-translated
bonycaspita
How can I set a hero limit for the AI, so that it can't hire more than 3 heroes? Thanks in advance for the answer!
Generally, there's no way to do that. Because even if you ban hiring after 3 heroes, one will still remain in the tavern, and the AI will hire him anyway. On the other hand, if you need to prohibit all heroes except certain ones, you can use AllowPlayerTavernRace(player, race, 0/1 (prohibit/allow)) 8 times for each race, and then use AllowPlayerTavernHero(player, script name of the hero, 0/1 (prohibit/allow)) to allow the AI to hire specific heroes. For example, I used this to create a player character who could only hire Andrias and Lorenzo (as in the last mission in the campaign for Freya). To ensure that heroes are always with the player, you can link them using MakeHeroReturnToTavernAfterDeath(script name of the hero, 0/1 (prohibit/allow)). It's unlikely that you'll be able to force random heroes into a hero limit (and campaign heroes in general), because you probably won't be able to create a script that will delete the least useful extra heroes, for example, only those hired after the ban is activated. Although, I might be wrong about this)
In reply to Азгалор
User Avatar
Auto-translated
Azgalor
Overall, it doesn't work. Because even if you implement a ban after hiring 3 heroes, one will still remain in the tavern, and the bot will hire him anyway. On the other hand, if you need to ban all heroes except certain ones, you can use AllowPlayerTavernRace(player, race, 0/1 (ban/allow)) 8 times for each race, and then use AllowPlayerTavernHero(player, script name of the hero, 0/1 (ban/allow)) to allow the bot to hire specific heroes. For example, I used this method to create a player who could only hire Andreas and Lorenzo (as in the last mission in the campaign for Freya). To ensure that the heroes are always with the player, you can link them using MakeHeroReturnToTavernAfterDeath(script name of the hero, 0/1 (ban/allow)). It is unlikely that you will be able to force ordinary random heroes into a hero restriction (and campaign heroes in general), because you will hardly be able to create a script that will remove the least useful heroes, for example, those hired only after the ban is activated. Although, I might be wrong about this.
Where can I find your maps? I really want to play them.
На дальней станции сойду...
Трава по пояс,
Зайду в траву, как в море босиком...
In reply to Григорий Ковалев
User Avatar
Auto-translated
Grigory Kovalev
Where can I find your maps? I really want to play them.
Unfortunately, I don't have any maps.
In reply to Азгалор
User Avatar
Auto-translated
Will there be more? Right now, there aren't many good maps available, and you could fix that.
На дальней станции сойду...
Трава по пояс,
Зайду в траву, как в море босиком...
In reply to Григорий Ковалев
User Avatar
Auto-translated
Grigory Kovalev
Will there be any? There are not many good maps right now, and you could fix that.
We'll see). For now, I'm working on a dynamic multiplayer map where the action will take place in a very large city. Until recently, I was preparing a spin-off map for Unicorn Empire, but unfortunately, due to technical issues, I lost most of my personal data, including everything related to games. Therefore, for now, I'm doing a little bit of everything: building a map, restoring mods, and re-populating the Lua file to bring back convenient and interesting functions. That's it... If something comes out of me, you'll definitely know).
In reply to Азгалор
User Avatar
Auto-translated
We're waiting!
На дальней станции сойду...
Трава по пояс,
Зайду в траву, как в море босиком...
In reply to Азгалор
User Avatar
Auto-translated
Azgalor
Let's see) For now, I'm working on a dynamic multiplayer map where the action will take place in a very large city. Until recently, I was preparing a spin-off map for Unicorn Empire, but unfortunately, due to technical issues, I lost most of my personal data, including everything related to games. Therefore, for now, I'm doing a little bit of everything: building a map, restoring mods, and re-populating the Lua file to bring back convenient and interesting functions. That's it... If anything comes out of me, you'll definitely know)
It's a pity that a lot of data was lost... If you need help, feel free to ask! I will always be happy to help!
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

User Avatar
Auto-translated
Azgalor, you have no idea how much anticipation you've created! I'm really looking forward to your map. I agree with Andrey, I'll always be happy to help.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________

Statistics

Welcome our newest member: Emil