Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
#3404
Auto-translated
What should be done with the script: if a hero enters the stopv territory, the hero stops, and a text message appears. After the text disappears, if the hero continues to move, he loses 50% of his army; if he leaves, he doesn't.
Правило во взгляде...
In reply to Rhenish
User Avatar
#3405
Auto-translated
function stopv()
Trigger(6, 'stopv', nil)
MessageBox(???)
end

function kill_half_army(hero)
Trigger(6, 'kill_half_army', nil)
for i=0,6 do
local t, n = GetObjectArmySlotCreature(hero, i)
RemoveHeroCreatures(hero, t, ceil(n/2))
end
end

Trigger(6, 'stopv', 'stopv')
Trigger(6, 'kill_half_army', 'kill_half_army')
You can do it like this, but you'll need another region called "kill_half_army". When a hero enters this region, they will lose half of their army.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#3406
Auto-translated
Is there a way to make a hero forget a spell? I couldn't find such a function...
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира
User Avatar
#3407
Auto-translated
There is no such function. As an alternative, I can suggest giving a hero a scroll with this spell or taking a scroll with this spell away from a hero.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#3408
Auto-translated
Can I now enter the text by typing my speech instead of the question marks (???), or do I need to insert it from a text document?
Правило во взгляде...
In reply to RedHeavenHero
User Avatar
#3410
Auto-translated
RedHeavenHero
There is no such function. As an alternative, I can suggest giving a hero a scroll with this spell or taking it away from a hero.

That's a shame. No, this option won't work for me.
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира
User Avatar
#3411
Auto-translated
I couldn't understand the text. How do I specify the path and where should I put the file? It didn't work somehow...
Правило во взгляде...
User Avatar
#3412
Auto-translated
Copy the texts in Unicode encoding into the file named map_name.h5m/Maps/Multiplayer (or SingleMissions)/map_name/. The path is specified starting from /Maps/.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#3413
Auto-translated
why doesn't this piece of code work?
while (contr==1) do
              contr=0;
              for i=1,95 do
                      if HasArtefact("geroy", i)==true then
                             RemoveArtefact("geroy", i);
                             if contr==0 then
                                     contr=1;
                             end;
                     end;
              end;
       end;
More precisely, it works, but the game gets stuck in a loop and freezes. The idea is to remove all artifacts from the hero, taking into account that some may be duplicated.
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира
In reply to MasteR
User Avatar
#3414
Auto-translated
Juss456
Why isn't this piece of code working?
while (contr==1) do
contr=0;
for i=1,95 do
if HasArtefact("geroy", i)==true then
RemoveArtefact("geroy", i);
if contr==0 then
contr=1;
end;
end;
end;
end;

More precisely, it works, but the game gets stuck in a loop and freezes. The idea is to remove all artifacts from the hero, taking into account that some may be duplicated.
You could try doing it this way:
for artefact = 1, 95 do
for n=1, GetHeroArtifactsCount("geroy", artefact) do
RemoveArtefact("geroy", artefact)
end
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#3415
Auto-translated
For some reason, the script isn't working:
function stopv() Trigger(6, 'monolog', nil) MessageBox(\Maps\Multiplayer\Rhenish's War\monolog.txt) end Trigger(6, 'monolog', 'monolog')
I've tried it every which way, even completely differently. The map name is Rhenish's War, and at least in WinRar, that's how it's named, and that's generally how it's called...
Правило во взгляде...
In reply to Rhenish
User Avatar
#3416
Auto-translated
Rhenish
For some reason, the script isn't working:

I've tried it every which way, and even completely differently. The map name is Rhenish's War, and at least in WinRar, it's listed as such...

It's not working because the trigger has the function name "monolog," but it's declared as "stopv." There's no connection between the trigger and the function.

Added 52 seconds later
RedHeavenHero
You could try doing it like this:
for artefact = 1, 95 do
for n=1, GetHeroArtifactsCount("geroy", artefact) do
RemoveArtefact("geroy", artefact)
end
end


Thanks! I didn't know that function existed.
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира
In reply to Rhenish
User Avatar
#3417
Auto-translated
Rhenish
For some reason, the script isn't working:

I've tried it every which way, and even completely differently. The map name is Rhenish's War, and in WinRar, it's listed as such...
I didn't write the trigger that way. And, in addition to what Juss456 said, the path to the text needs to be enclosed in quotes, and forward slashes should be used.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#3418
Auto-translated
Hmm? I've already tried to create a trigger for the monologue myself...
And there's another problem here: the map name contains a quote mark, which is used to specify a path. What should I do now?
Правило во взгляде...