Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
I set a trigger for leveling up. It seems something is still not working for it.
Console
[Script warning!] Value was NIL when getting global with name 'HERO_LEVEL_UP_TRIGGER'
(Script)ERROR: Invalid parameter type of trigget must be number
Script
function Call_of_Urgash()
if HasHeroSkill('Oddrema', 98) then
SetObjectiveState('SA', 3)
MessageBox(GetMapDataPath().. 'Call.txt')
ChangeHeroStat('Oddrema', STAT_EXPERIENCE,43119)
AddObjectCreatures('Oddrema', 27, 18)
flag = 1 ;
else flag = 2 ;
end;
end;
Trigger(HERO_LEVEL_UP_TRIGGER, 'Oddrema', 'Call_of_Urgash');
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
djulian13
I set a trigger for leveling up. He doesn't like something again.

Sincerely.
--
function NameFunction ()
sleep(5);
if HasHeroSkill("NameHero", DEMON_FEAT_ABSOLUTE_GATING)==true then
SetObjectiveState('SA', OBJECTIVE_COMPLETED,1);
MessageBox(GetMapDataPath().. "Call.txt");
ChangeHeroStat("NameHero", STAT_EXPERIENCE,43119);
AddObjectCreatures("NameHero", 27, 18,-1);
flag = 1 ;
else
flag = 2 ;
end;

end;
--
Trigger(HERO_LEVELUP_TRIGGER,"NameHero","NameFunction");
--
Something like that. Always be more careful; this is not the first mistake. Value was NIL when getting global with name - unknown argument, type (from the error, you can understand that the trigger name is incorrect). I didn't check the script, but it should work.
The only thing is, I don't remember if the trigger runs before, during, or after the level up.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
Auto-translated
Colleague Dyrman has thoroughly analyzed everything – in general, from the console line, it is clear that the error lies here: HERO_LEVEL_UP_TRIGGER ([Script warning!] Value was NIL when getting global with name 'HERO_LEVEL_UP_TRIGGER') – as they say, an extra space changes everything; he also provided the correct spelling of the trigger – HERO_LEVELUP_TRIGGER .
In reply to antonag07
User Avatar
Auto-translated
antonag07
Colleague Dyrman has thoroughly explained everything – in short, the console output shows that the error lies here: HERO_LEVEL_UP_TRIGGER ([Script warning!] Value was NIL when getting global with name 'HERO_LEVEL_UP_TRIGGER') – as they say, an extra space changes everything; he also provided the correct spelling of the trigger – HERO_LEVELUP_TRIGGER
Dyrman
(the error indicates that the trigger name is incorrect).
Ah, I already mentioned in the message that the trigger name was incorrect :) ...
And in the example, the trigger is written correctly ;)
Also, don't forget to reset the trigger if you don't want it to trigger every time the hero levels up.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
Auto-translated
Hello everyone. Does anyone know how to link a neutral unit to a player's faction (1st, 2nd, etc.)?:confused: :confused: :confused:
Auto-translated
Dyrman, thank you very much! The script finally worked for me! Thank you.
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
User Avatar
Auto-translated
Does anyone know how to link a neutral unit to a player's faction (1st, 2nd, etc.)?
Could you please provide more details?
 

К А
Стикеры GBF в Telegram
In reply to Dyrman
User Avatar
Auto-translated
Dyrman

SetObjectPosition(Object Name, Tile X coordinate, Tile Y coordinate, Underground level or surface level)
Everything is available online, in the search on this forum, and in the documentation. Here, you also need to remember to set one property of the object to true, if possible.
Thank you, but I found a more convenient way - the CreateArtifact command to create an artifact.
In reply to djulian13
Auto-translated
djulian13
There is a goal to obtain "Urghash's Call" with the OBJECTIVE_KIND_MANUAL parameter, script name - SA. It should be done so that as soon as the player receives the "Urghash's Call" ability, the aforementioned script is activated - giving the player experience up to level 26, completing this very task, and setting the "flag" variable to "1".
Best regards.

As far as I remember, obtaining Super Abilities through scripts was a troublesome task - using the editor, you can give a Super Ability to even a level 1 hero, but with scripts, certain conditions must be met.

Provide the entire script - then we can see what's not working (i.e., I don't understand yet - do you want to give a Super Ability, or do you want to give experience for a Super Ability, or do you want to give experience when the hero has a Super Ability???)
In reply to Олегарх
User Avatar
Auto-translated
Olegarkh
Thank you, but I found a more convenient way - the CreateArtifact command to create an artifact.
Well, here you go :) I even figured it out myself.

Added 45 seconds ago
ARCHI_XXI_
Hello everyone.
Does anyone know how to link a neutral unit to a player's faction (1st, 2nd, etc.)?:confused: :confused: :confused:
Yes, indeed, as Ment pointed out, it would be good to elaborate.

Added 3 minutes ago
antonag07
As far as I remember, obtaining Super Abilities through scripts was a complicated process - but through the editor, you can give a Super Ability to even a level 1 hero, while with scripts, certain conditions must be met.

Provide the entire script - then we can see what's not working there.
But it seems like it's working now. Moreover, obtaining a super perk probably depends on the hero's development, and is not given through scripts.
Even the difficulties in obtaining it should take into account how developed the hero is. (The initial skill - 1 perk, the advanced one - you can add another, here you don't even need to strictly follow the skill tree, if you don't completely block the perks:) )
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Ment
Auto-translated
Ment
Could you elaborate?
I assume the person wants to use a script to assign a racial affiliation to a neutral unit based on the player's race – i.e., when interacting with this unit, a function should be triggered to check the player's hero's race, and based on the result of the check, a unit (a composite unit) should be generated at that location according to the specified conditions; perhaps this function should be included at the very beginning – the mechanism is the same: check the race, create a new unit based on the result of the check.

Added 1 minute later
Dyrman
="1"]So, it seems to be working already anyway))
Well, that's great :)

p.s. By the way, there may be difficulties in obtaining special units (SUs) via script if the hero's development does not match or contradicts the conditions for obtaining the SU – similar difficulties arise when learning or forgetting skills from a mentor (skills that are present from the start and added in the editor cannot be learned again – for example: we have "Runic Shield" for a dwarf (without the intermediate "Master of the Earth" and "Exorcism") – when forgetting "Runic Shield" from the mentor, we can only learn it again after obtaining the corresponding intermediate skills, even though we had it before without them); so, you need to be aware of these nuances.
User Avatar
Auto-translated
I believe the person wants to use a script to assign a racial affiliation to a neutral unit based on the player's race – that is, when interacting with this unit, a function should be triggered to check the player's hero's race and, based on the check result, generate a unit (a mixed unit) at that location according to the specified conditions; perhaps this function should be included at the very beginning – the mechanism is the same: check the race, create a new unit based on the check result.
Ah, now it's clear. Well, some people just have too much free time...
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
How can I link a neutral unit guarding, for example, the key of player 1, to the faction of player 1 in the editor? For example: Player 1 is Inferno, and I want devils, etc., to guard the key. :confused:
User Avatar
Auto-translated
Okay, I understand. I don't know how to make it look nice, but a clumsy approach is always at your service. First, call `hero=GetTownHero(town name)`. Then, do the following:
if `HasHeroSkill(hero, ID of the main class skill of Knights, for example)` then
`CreateMonster('m1', ID of some Knights, quantity, two coordinates separated by a comma, level number (top 0, bottom 1), aggressiveness, possibility of joining, rotation angle);`
end;
Similarly for all other cases. All IDs can be found in the manual, in the Editor_Documentation folder.
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
Hey, could you please help me out? I've added a message box to a multiplayer map that appears when a player interacts with an object. However, when player 1 interacts with the object and receives the message box, all other players see the same message box on their next turn. Is there a way to make it so that only the hero who interacted with the object sees the message box, while still allowing any player to interact with the object and see their own message box?

Statistics

Welcome our newest member: Emil