Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
Probably, this question is off-topic, but does anyone know how to change the class skills of heroes? For example, an Orc can cast spells, but cannot learn them at the magic school (they will be given as rewards for quests) and does not use battle cries.

Added 6 minutes later
I want to create a script:
function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- and this --
Loose(1)
end

startThread(alive)
function MestoK (heroname)
if heroname == "Hero9"
then MEssageBox (GetMapDataPath().."MestoK.txt")
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Mesto", nil)
end;
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Mesto", "MestoK");
The second one doesn't work. Please tell me what the error is.

Added 38 seconds later
Where there are the letters "eee", there is "ili" instead.
User Avatar
Auto-translated
The MessageBox is written incorrectly. The letter "E" should be lowercase.

Added 1 minute ago
"or" does not relate to the code. You had to choose from 2 writing options.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Auto-translated
function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- eee --
Loose(1)
end

startThread(alive)

function MestoK (heroname)
if heroname == "Hero9"
then MessageBox (GetMapDataPath().."MestoK.txt")
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Mesto", nil)
end;
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Mesto", "MestoK");

function MestoPX (heroname)
if heroname == "Hero9"
then MessageBox (GetMapDataPath().."MestoPX.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MestoP", nil);
end;
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MestoP", "MestoPX");

function MestoP (heroname)
if heroname == "Hero9"
then MessageBox (GetMapDataPath().."MestoX.txt")
StartCombat("Hero9", nil, 5, 45, 200, 55, 30, 47, 150);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MestoO", nil);
end;
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MestoO", "MestoX");
The StartCombat script doesn't work, but the hero does stop when entering the zones. Where is the error?

Added after 35 seconds
in the zone*
In reply to Аскет2
User Avatar
Auto-translated
Aescet2
Where is the error?

At the very least, there's an error in StartCombat. What does the manual say about the arguments of the function? The third argument indicates the number of stacks of the enemy. There's a figure of 5 there, but what is the actual number?

The sacred meaning of the Alive() function is unclear.
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира
Auto-translated
The script works fine, thanks.

Added 2 minutes later
I also need a script that awards victory to the first player for capturing a town.
In reply to Аскет2
User Avatar
Auto-translated
function capture_town(prev_owner, cur_owner, hero, town)
if cur_owner == 1 then
Win(1)
end
end

Trigger(OBJECT_CAPTURE_TRIGGER, 'script_town_name', 'capture_town')
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Auto-translated
And here's another script. I need it to be set up so that after 6 months, one player loses, and after 4 months, a large army appears. Thanks in advance.
In reply to Аскет2
User Avatar
Auto-translated
function new_day()
local day, wday, week, month = GetDate(DAY), GetDate(DAY_OF_WEEK), GetDate(WEEK), GetDate(MONTH)
if month == 7 then
Loose(1)
end
if month == 5 and week == 1 and wday == 1 then
DeployReserveHero('reserved_hero_name', x_coordinate, y_coordinate, floor_0_or_1)
end
end

Trigger(NEW_DAY_TRIGGER, 'new_day')


Added after 38 seconds
You only need to reserve a hero for a specific AI player in the Players tab of the map properties.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Auto-translated
:) :D Honestly, you're a lifesaver. I'll make you a co-author of the scripts in my map.

Added 1 minute ago
And one last question: how do I remove a creature upgrade from someone?

Added 5 minutes ago
And where do I create a hero? I don't understand.
In reply to Аскет2
User Avatar
Auto-translated
In the properties tree for towns and forts on the map, there is CreaturesUpgradesFilter.
To the right of each CreaturesUpgradesFilter sub-property, there is a description in Russian.

Added 1 minute ago
Player Properties → Select an AI player from the Players list → Reserve Heroes List → Add.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Auto-translated
Phew, I think that’s all. Just a little more, and I’ll upload the map.

Added 19 hours and 11 minutes ago
And how do you make it so that a hero from the previous mission transfers to the next mission at a specific location, retaining the skills from the previous mission?

Added 1 minute ago
Or is this not done in scripts?
Auto-translated
Can maps be added to a campaign after it has been created, or not?

Statistics