Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Mostovik
User Avatar
#772
Auto-translated
Mostovik
Good morning! Thank you for the answers.)
Another question:
Does HERO_REMOVE_SKILL_TRIGGER pass the skill to be removed as a parameter? And if so, does it follow the hero? Unfortunately, I won't be able to check until late in the evening, as the game is not installed, but I have time to write part of the code.
The all-powerful Google provided.
+ new triggers for heroes have been added: HERO_ADD_SKILL_TRIGGER, HERO_REMOVE_SKILL_TRIGGER, passed parameters: heroName, skill, mastery


Added 2 hours 31 minutes ago
Is there a function that returns an array of all equipped (currently in use) and unequipped (lying in the hero's inventory) artifacts?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
#773
Auto-translated
Dyrman
Is there a function that returns an array of all equipped (currently in use) and unequipped (in the hero's inventory) artifacts?
No, but it's easy to create.
function GetAllArtefacts(hero)
local array = {};
for artefact = 1, 96 do
if HasArtefact(hero, artefact, 1) then
array[artefact] = 2;
elseif HasArtefact(hero, artefact, 0) then
array[artefact] = 1;
else
array[artefact] = 0;
end;
end;
return array;
end;
For example, this function will return an array where the index = the artifact number, and the value = 0, 1, 2, respectively: none, present, equipped.
function GetAllArtefacts(hero)
local array = {[0] = {}, [1] = {}};
for artefact = 1, 96 do
if HasArtefact(hero, artefact, 1) then
array[1][length(array[1]) + 1] = artefact;
elseif HasArtefact(hero, artefact, 0) then
array[0][length(array[0]) + 1] = artefact;
end;
end;
return array;
end;
And this one will return an array where array[0] is an array of unequipped artifacts, and array[1] is an array of equipped artifacts. However, in both cases, if there are ≥2 artifacts of the same type, both functions will say that they are equipped.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#774
Auto-translated
RedHeavenHero
No, but it's not difficult to create.
It's already not quite the same. In my case, there will be 3 nested loops, with 100 elements in two of them. I'm afraid it will overload the script and the game :( There will be significant delays.
It's a pity that there isn't a developer function for this :(
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
#775
Auto-translated
Dyrman
It's already not quite right. In my case, there will be 3 nested loops, with two of them containing one hundred elements each. I'm afraid it will overload the game script and cause significant delays.
Can I take a look, if it's not a secret?
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#776
Auto-translated
RedHeavenHero
Could you take a look, if it's not a secret?
Not yet, the script is still just brewing in my head, and I'm a bit afraid of it for now :D
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#777
Auto-translated
PLEASE HELP! The scripts won't run!
Here's the script:
--COMBATS--

MessageBox ("/Maps/SingleMissions/ELO/zasada.txt");

function "Zasada1" (heroname)
sleep (5);
StartCombat ("Dyraya", nil, 3, 30, 50, 32, 30, 34, 20, nil, nil, nil, nil);
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "zasada1", nil);
end;

Trigger (REGION_ENTER_AND_STOP_TRIGGER, "zasada1", "Zasada1");

The console doesn't report anything about the combat. Regarding the message:
(Script) ERROR: Empty message text
(Although the text is there)
:smile45:
502 Bad Gateway
__________________________________
nginx/0.8.54
User Avatar
#778
Auto-translated
Perhaps the encoding is incorrect. This can happen if the text was created in Notepad. It should be saved in Unicode.
 

К А
Стикеры GBF в Telegram
#779
Auto-translated
I suspect that the function name should be without quotes:
function Zasada1(heroname)

I have another question: the function ControlHeroCustomAbility allows you to control the special abilities of a specified hero. What are the hero's special abilities? Specialization? Can I add Nura's ability to Dugalu using this function? Or some other way.
In reply to Mostovik
User Avatar
#780
Auto-translated
Ment
Perhaps the encoding is incorrect. This happens if you typed it in Notepad. You need to save it in Unicode.
It still doesn't work.
Mostovik
I suspect that the function name should be without quotes:
function Zasada1 (heroname)
That's correct.
502 Bad Gateway
__________________________________
nginx/0.8.54
User Avatar
#781
Auto-translated
Mostovik, this function tracks when a hero uses special scripted spells. There are only 4 of them, and two are dedicated to Zephyr: summoning Shahidiyah and calling to arms. If any of these are triggered, this function will let you know, and you can do something about it.
 

К А
Стикеры GBF в Telegram
#782
Auto-translated
So, is this a combat script? I found it on the "strategic" tab.
User Avatar
#783
Auto-translated
I don't know, maybe it works in combat too. But it's designed for the strategic map.
 

К А
Стикеры GBF в Telegram
User Avatar
#784
Auto-translated
Will anyone answer me?
502 Bad Gateway
__________________________________
nginx/0.8.54
In reply to Mostovik
User Avatar
#785
Auto-translated
Mostovik
So, is this a combat script? I found it on the "strategic" tab.
No. It's similar to an adventure-style additional spell, like "Portal to Town," "Astral Gate," "Call Reinforcements," or "Summon Boat." But when the spell is cast, it doesn't summon a castle ID; instead, it calls a specific script (written manually), to which you can attach a function using ControlHeroCustomAbility. It's likely that transmutations are done this way in the editor. In the NHF mod, for example, the hero Valafar can place portals on the map.


Added 6 minutes later
Warrior777
Will anyone answer me?
You've already received an answer.
I'll repeat (something from this):
-Incorrect file path (check the path carefully);
-Incorrect file encoding (copy a .txt file from another map, rename it, and re-enter the text if you don't know how to change the encoding).
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#786
Auto-translated
GENERALLY, SCRIPTS ARE NOT WORKING!!!!!!! NONE OF THEM!!!!!!!
--COMBATS--

MessageBox ("/Maps/SingleMissions/ELO/zasada.txt");

function Zasada1 (heroname)
sleep (5);
StartCombat ("Diraya", nil, 3, 30, 50, 32, 30, 34, 20, nil, nil, nil);
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "zasada1", nil);
end;

Trigger (REGION_ENTER_AND_STOP_TRIGGER, "zasada1", "Zasada1");

--PROPERTIES--

SetObjectEnabled ("rinok_samocvetov", false);

function Samocveti (heroname)
if GetPlayerRecource (1, 6, >=10000);
QuestionBox ("Maps/SingleMissions/ELO/pokupka.txt", "pokupka", nil);
end;
end;

Trigger (OBJECT_TOUCH_TRIGGER, "rinok_samocvetov", "Samocveti");

function pokupka (heroname)
sleep (5);
SetPlayerResource (6, -10000, 5, 10);
print ("PLAYER_1 shopping 10 gems");
end;

The message is not displayed, the battle does not start, the object works, the purchase request is not displayed. I AM COMPLETELY CONFUSED ABOUT WHAT TO DO???:confused: :confused: :confused: :smile33: :smile33: :smile33:
502 Bad Gateway
__________________________________
nginx/0.8.54

Statistics

Welcome our newest member: Emil

Users Online 3 users 1345 guests