Posts from Scripts
No, the scripts still don't work. What's the problem? Could you take a look if possible?
You need to unlock the console in the game, and it will show you exactly what the problem is with the script. There's no need to post the entire script here every time.
Regarding the script, I took a quick look and noticed this:
function SetPlayerStartResources (player, wood, ore, mercury, crystal, sulfur, gem, gold)
if player == 1
then wood = 20
ore = 20
mercury = 10
crystal = 15
sulfur = 10
gem = 10
gold = 15000
end
endWhat is this? Reinventing the wheel, and doing it wrong.
SetPlayerStartResources (1, 20, 20, 10, 15, 10, 10, 15000)
--without any function, etc.Maybe it's simpler this way?And yes, what is this function for?
function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- or --
Loose(1)
endIf it's what I think it is, it can be done much simpler and clearer, without any loops
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
Well, the main thing is that it works.
Just for general information, there is a trigger that reacts to the player losing a hero. You can make it so that if "that specific" hero is lost, the player immediately loses the game.
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
if heroname == "Hero9"
then MessageBox (GetMapDataPath().."ha.txt")
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Ha", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Ha", "ha"); ```
Here's another error. The script contains two functions named "gnom," but only one function named "ha." This could have been checked independently.
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
Added 1 minute ago
``
Added 35 seconds ago
Basically, I forgot about the line, so the scripts weren't working.
Added 2 minutes ago
I've already fixed it.
function QuestPervii ()
if HasArtefact ("Hero9", "TOME_OF_DESTRUCTION") without quotes, incorrect id
then MessageBox (GetMapDataPath().."QuestPervii.txt")
ChangeHeroStat ("Hero9", STAT_DEFENSE, 7) STAT_DEFENCE
RemoveArtefact ("Hero9", "TOME_OF_DESTRUCTION") without quotes, incorrect id
Trigger(OBJECT_TOUCH_TRIGGER, "Pervii", nil)
else MessageBox (GetMapDataPath().."LoseL.txt")
end;
end;function QuestVtoroi ()
if HasArtefacts ("Hero9", "SKULL_OF_MARKAL") incorrect function name, id without quotes, incorrect id
then MessageBox (GetMapDataPath().."QuestVtoroi.txt")
ChangeHeroStat ("Hero9", STAT_OFFENCE, 7)
RemoveArtefact ("Hero9", "SKULL_OF_MARKAL" ) without quotes, incorrect id
Trigger(OBJECT_TOUCH_TRIGGER, "Vtoroi", nil)
else MessageBox (GetMapDataPath().."LoseLI.txt")
end;
end;function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- or --
Loose(1) remove, so as not to confuse anyone
endTrigger(OBJECT__TRIGGER, 'X', 'capture_town') incorrect trigger id, pointer to a non-existent function
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
For example, the codes
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Gnom", "gnom")
and
Trigger(6, "Gnom", "gnom")
work the same, but the second entry is much more convenient to use.
Added 3 minutes later
function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- or --
Loose(1)
end
function alive(heroname)
if heroname=="Hero9" then
Loose()
end
end
Trigger(2, 1, "alive")
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
To avoid dealing with various constants like REGION_ENTER_AND_STOP_TRIGGER or TOME_OF_DESTRUCTION, it's better to replace them with numbers (all numbers are listed in the document IDs for scripts). This makes the code more compact and helps avoid several errors that are almost unnoticeable during debugging.
For example, the codes
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Gnom", "gnom")
and
Trigger(6, "Gnom", "gnom")
work the same, but the second entry is much easier to use.
In Notepad++, where I write scripts, for example, when you enter the first letters of a constant, a list of words from the file is suggested, and you just need to choose one. This reduces the chance of making a mistake.
Added 2 minutes later
function alive()
while IsHeroAlive("Hero9") do
sleep(10)
end
Loose()
-- or --
Loose(1)
end
function alive(heroname)
if heroname=="Hero9" then
Loose()
end
end
Trigger(2, 1, "alive")
I need a script so that the mission fails after a hero dies. Thanks in advance.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Nargott wouldn't approve.
In Notepad++, where I write scripts, for example, when I type the first letters of a constant, a list of words from the file is suggested, and I just have to choose one. This reduces the chance of making a mistake.
Added 2 minutes later
The second one will trigger with any loss of a hero by the player, the first one - only upon death.
That's true. But in this specific case, loss = death and death = loss. If there were any transfers of a hero from one owner to another or something like that, then yes, there would be a difference. And even then, the trigger can be disabled at any time.
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4