Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Heroist
User Avatar
Auto-translated
Has anyone managed to create their own hero specialization using scripts? For example, making a specialist in skeletons... :confused:
In reply to Markel the Imperor
User Avatar
Auto-translated
Markel the Emperor
Has anyone managed to create their own hero specialization using scripts? For example, making a specialist for skeletons… :confused:
You can do some things.
If you're interested, you can study and copy scripts from a mod whose main goal is new specializations:
/topic/9337/

Added after 14 hours 41 minutes
Is there a function that determines which direction an object is facing?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
Auto-translated
Dyrman

Added 14 hours and 41 minutes ago
Is there a function that determines which direction an object is facing?
I don't think this will be necessary. Portals only have 4 rotation angles, and they can be determined by the relative position of the mob.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
I don't think this will be necessary. Portals only have 4 possible rotation angles, and they can be determined by the relative position of the mob.
Well, we'll see. There are quite a few types of portals.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
Auto-translated
Please help! I can’t figure out what’s wrong; the script just won’t work, no matter what I try. ``` function biaraF () Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", nil ); MessageBox(GetMapDataPath()..'text9.txt'); SetObjectPosition ('Raelag' , 8, 129, 0) end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", "biaraF" ); ``` It seems like everything is correct, and the hero’s name matches the script, so there shouldn’t be any errors here. The console displays: "Can`t find terrain info file for map... and the map directory." All other scripts work, but this one doesn’t react at all when entering the region :smile32:
Создаётся карта "Забытый Авангард (готовность 80%)
In reply to AkaR
User Avatar
Auto-translated
AkaR
Please help! I can't figure out what's wrong; the script just won't work, no matter what I try.
function biaraF()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", nil);
MessageBox(GetMapDataPath()..'text9.txt');
SetObjectPosition('Raelag', 8, 129, 0)
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "biara", "biaraF");

It seems like everything is correct, and the hero's name matches the script, so there shouldn't be any errors here. The console displays: "Can't find terrain info file for map... and the map directory." All other scripts work, but this one doesn't react at all when entering the region :smile32:
So, the error isn't in the script. I'm encountering this error for the first time. Perhaps the file containing the map's geography is corrupted, or the link is incorrect.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
O_o Hmm... the ground texture file seems to have disappeared. In the game, when exiting to the surface, the game crashes; in the editor, the texture is simply missing, and objects are floating in the air... I'll try copying this file from another map and editing it there.

Added 16 minutes later
I fixed the ground texture error, but the script still isn't working. I discovered a strange thing: the hero teleports, but to a completely different function (a different trigger). The regions don't overlap... I don't understand what's wrong.
Создаётся карта "Забытый Авангард (готовность 80%)
In reply to AkaR
User Avatar
Auto-translated
AkaR
O_o Hmm... the earth texture file seems to have disappeared. When exiting to the surface in the game, it crashes; in the editor, the texture is simply missing, and objects are floating in the air... I'll try copying this file from another map and editing it there :(

Added 16 minutes later
I fixed the surface error, but the script still isn't working. I discovered a strange thing: the hero teleports, but to a completely different function (a different trigger). The regions don't overlap... I don't understand what's wrong :(
Could there be functions or regions with the same name?
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
I'm having a problem: (
I can't seem to get the GetDate function to work.
I need it so that when quest N is received, a countdown starts until day M (in my case, day 10), and when the 10th day arrives since the quest was received, a certain action is performed. But it's also necessary that if the hero completes the quest within those 10 days, the trigger resets, and the function loses its meaning. I wrote a complicated function with a bunch of if statements, but it refuses to work. The console doesn't output anything :( .
Создаётся карта "Забытый Авангард (готовность 80%)
In reply to AkaR
User Avatar
Auto-translated
How to control the order of operations. I need my AI hero to approach a point and then teleport from there, but it teleports immediately and that's it. =(
And is it possible to make him see portals? For example, if the path to the castle is through a portal, he doesn't react to movehero(... castle coordinates).
Мои карты

Возрождённый v 1.5 (обновление от 25/09/2016) :smile24:

готовится продолжение.

Великая Пустыня ( 25%) - про Маркела
Тьма над Иролланом (0%) - про Николаса

Мои моды (скорректированы мод на чумных энтов и циклопов зомби)
User Avatar
Auto-translated
Try using SetObjectPosition instead of teleport and attach a trigger to the region where the AI will DEFINITELY pass.
Создаётся карта "Забытый Авангард (готовность 80%)
In reply to AkaR
User Avatar
Auto-translated
AkaR
I'm having a problem: (
I can't seem to get the GetDate function to work.
I need it so that when quest N is received, the countdown to day M (in my case, 10) begins, and when the 10th day arrives since the quest was received, a certain action is performed. But it's also necessary that if the hero completes the quest within those 10 days, the trigger resets, and the function loses its meaning. I wrote a complicated function with a bunch of if statements, but it refuses to work. The console doesn't output anything :( .

I don't think it's that complicated. Here's how you can do it. You have the quest being received triggered by a function, right?

Then:
n = 0 (write this outside of all functions)

--Your function--
....
Quest received (the required one)
n = 1 -- now we set n to one
--end of function--

Now, through a trigger for a new day (Trigger(NEW_DAY_TRIGGER , 'day')) (example), call the function to execute.

--new day function--
if n > 0, then
n = n + 1 -- if n > 0, which in our case means that the quest has already become active, we increment n by 1.
--end of new day function--

Thus, we add +1 to n each day, starting from the day after the quest is received.
Now, all that remains is to write the verification function (it can be written directly inside the new day function)

--new day function--
--what is written above--
if n == 11 and the quest has already been completed, then
Your actions
Otherwise, if n == 11, then (this already means that after this time, the quest has not been completed)
Your other actions
"For aesthetics, if you don't need the counter to continue, make n = 0"
--end of new day function--

If "Your actions" are already written in another function, that's not a problem. Instead, write startThread (name_of_function_with_actions). That's it, I think.
[/code]
Now, a little reference material:

Trigger(NEW_DAY_TRIGGER , 'day') -- trigger for a new day
SetObjectiveState ('objname' , OBJECTIVE_ACTIVE) -- activate the quest, replace the first parameter with the name of your quest
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED/FAILED) -- complete the quest, or fail it.
n = 0 -- and so on (variable)
Trigger(TRIGGER_NAME, nil) -- reset the trigger.


Thus, here is the complete script: (instead of red, you substitute your values):

n = 0

function xxx
...
SetObjectiveState ('obj1' , OBJECTIVE_ACTIVE)
n = 1
end

Trigger(NEW_DAY_TRIGGER , 'day')

function day
if n > 0 then
n = n + 1
end
if n == 11 and GetObjectiveState ('obj1') == OBJECTIVE_COMPLETED then
...
elseif n == 11 then
...
end
end

I don't think I wrote anything more complicated. ;)

Whatever
In reply to Heroist
User Avatar
Auto-translated
Heroist
I don't think it's that complicated. So, here's the idea. You have a function that handles receiving the quest, right?

Then:
n = 0 (write this outside of all functions)

--Your function--
....
Receive the quest (the required one)
n = 1 -- now we set n to one
--end of function--

Now, using a trigger for a new day (Trigger(NEW_DAY_TRIGGER , 'day')) (as an example), call the function to execute.

--new day function--
if n > 0, then
n = n + 1 -- if n > 0, which in our case means that the quest has already become active, we increment n by 1.
--end of new day function--

Thus, we add +1 to n every day, starting from the day after the quest is received.
Now, all that remains is to write a check function (it can be written directly inside the new day function)

--new day function--
--what is written above--
if n == 11 and the quest has already been completed, then
Your actions
Otherwise, if n == 11, then (this already means that the quest has not been completed within this time)
Your other actions
"For aesthetics, if you don't need the counter to continue, set n = 0"
--end of new day function--

If "Your actions" are already written in another function, that's fine. Instead, write startThread (name_of_the_function_with_actions). That's it, I think.
[/code]
Now, a little reference material:

Trigger(NEW_DAY_TRIGGER , 'day') -- trigger for a new day
SetObjectiveState ('objname' , OBJECTIVE_ACTIVE) -- activate the quest, replace the first parameter with the name of your quest
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED/FAILED) -- complete the quest, or fail it.
n = 0 -- and so on (variable)
Trigger(TRIGGER_NAME, nil) -- reset the trigger.


Thus, here is the complete script: (replace the red with your values):

n = 0

function xxx
...
SetObjectiveState ('obj1' , OBJECTIVE_ACTIVE)
n = 1
end

Trigger(NEW_DAY_TRIGGER , 'day')

function day
if n > 0 then
n = n + 1
end
if n == 11 and GetObjectiveState ('obj1') == OBJECTIVE_COMPLETED then
...
elseif n == 11 then
...
end
end

I don't think I wrote anything more complicated. ;)

Thank you very much :) You explained it clearly and understandably. I'll know now :)
Создаётся карта "Забытый Авангард (готовность 80%)
User Avatar
Auto-translated
Yes, nothing special. In reality, functions with variables are quite simple and don't require extensive scripting knowledge, but frequent use of them can easily lead to confusion and burden the game. I'm not that proficient in this area, so I do it this way. However, I'm not denying the fact that there are simpler methods than mine.

Whatever
User Avatar
Auto-translated
Perhaps this question has already been asked: how do you disable a specific skill for heroes on a map?
Кампании для Heroes V 3.1 (Трилогия):

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

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

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


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


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

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

Легендарная война
Сердце вулкана
Передел мира

Statistics

Welcome our newest member: Emil