Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
With posters, it has the most beautiful implementation and is best perceived. Unfortunately, no one responded to my request for help on heroesleague, although many people play RTA :( I'll have to do it myself.
User Avatar
Auto-translated
Yeah... My map is full of errors and misunderstandings:D
Here's the script:
function VisitDeviltavern (heroname)
if heroname == 'Biara' then
if visiter_deviltavern == 0 then
BlockGame ();
GiveHeroSkill ('Biara', 98);
visiter_deviltavern = 1;
SetObjectiveState ('saobj', OBJECTIVE_COMPLETED, 1);
GiveExp ('Biara', 12000);
sleep (30);
UnblockGame ();
else MessageBox (map_path..'deviltavern-visited.txt');
end;
else MessageBox (map_path..'deviltavern-visiternobiara.txt');
end;
end;
Everything works perfectly, but the skill isn't being granted. Why?
502 Bad Gateway
__________________________________
nginx/0.8.54
User Avatar
Auto-translated
So, should all the necessary skills be present? And is there any way to do without them?
502 Bad Gateway
__________________________________
nginx/0.8.54
User Avatar
Auto-translated
Please advise. I have many identical objects on my map, and a hero can buy creatures from them using a script. The object names are: "dw1", "dw2", "dw3", etc. Is it possible to assign the same trigger to all of them, so that the function receives the object number as a parameter, representing the object the hero entered, as a number. Then, I could define the type, quantity, and cost of creatures for each object using an array.
for i=1,15 do
Trigger(OBJECT_TOUCH_TRIGGER,"dw"..i,"dwellingF")
end;

cr_count={10,30,20.....20}
cr_type={92,94,96.....105}
cr_cost={20,40,80.....1000}

function dwellingF(hero, obj_name)
n=<how do I get the object number here?>
AddHeroCreatures(hero,cr_type[n],cr_count[n])
SetPlayerResource(1,GOLD,GetPlayerResource(1,GOLD)-cr_count[n]*cr_cost[n]);
end;
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Spectral
Please advise. I have many identical objects on the map, and a hero can buy creatures from them using a script. The object names are "dw1", "dw2", "dw3", etc. Can I assign the same trigger to them so that the function receives the object number as a parameter, represented as a number, when the hero enters. Then, I can define the type, quantity, and cost of creatures for each object using an array.
for i=1,15 do
Trigger(OBJECT_TOUCH_TRIGGER,"dw"..i,"dwellingF")
end;

cr_count={10,30,20.....20}
cr_type={92,94,96.....105}
cr_cost={20,40,80.....1000}

function dwellingF(hero, obj_name)
n=<how do I get the object number here?>
AddHeroCreatures(hero,cr_type[n],cr_count[n])
SetPlayerResource(1,GOLD,GetPlayerResource(1,GOLD)-cr_count[n]*cr_cost[n]);
end;
This is what needs to be inserted where 'n' is defined.

for i=1,15 do
if obj_name=="dw"..i then
n=i
end
end


Added 4 minutes later
Warrior777
That is, should all the skills necessary for it be present? And is there any way to do it without that?
The solution is "script cheating":
consoleCmd('enable_cheats')
consoleCmd('add_skill 98')
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
I need to pass functions with parameter `` to the `MessageBox` and `QuestionBox` commands. How can I do this?
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Spectral
I need to pass functions with parameter to the MessageBox and QuestionBox commands. How can I do this?
Example:
MessageBox(textPath.."vopros.txt", "function_ok('"..parametr1.."')");
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
Auto-translated
I can't disable the circles under the monsters. Here's the code: SetObjectEnabled("archer1",0) SetMonsterSelectionType("archer1",0) The console says: ScriptError: Monster "archer1" is not disabled, cant change selection type.
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Spectral
I can't disable the circles under the monsters.
Here's what I tried:
SetObjectEnabled("archer1",0)
SetMonsterSelectionType("archer1",0)

The console says:
ScriptError: "archer1" is not disabled
Put a sleep(1) between them.
Also, the second argument in SetObjectEnabled should be nil.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to Dyrman
User Avatar
Auto-translated
Dyrman
Is there a script that sets the maximum number of movement points? It must be above the nominal value.
For example, a standard 2500 would become 5000, but it wouldn't immediately fill the green bar, meaning it would move only halfway, even though it doesn't actually have more movement points.

Try this one:

function movenext()
while GetHeroStat("Ossir",STAT_MOVE_POINTS)>1000 do
sleep(7)
end
print( 'movepoints<1000')
ChangeHeroStat("Ossir",STAT_MOVE_POINTS,1500)
end
function add_move_points()
startThread(movenext)
end

Trigger(NEW_DAY_TRIGGER,"add_move_points");
Adds 1500 points each day.
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Spectral
Try this:

function movenext()
while GetHeroStat("Ossir",STAT_MOVE_POINTS)>1000 do
sleep(7)
end
print( 'movepoints<1000')
ChangeHeroStat("Ossir",STAT_MOVE_POINTS,1500)
end
function add_move_points()
startThread(movenext)
end

Trigger(NEW_DAY_TRIGGER,"add_move_points");
It adds 1500 movement points each day.
This isn't quite right (it doesn't have the mandatory condition of exceeding the maximum MP value). Abysside from NHF adds MP in a similar way, but it's very clunky – we can't know in advance how far we can move.

Added 2 hours 33 minutes later
Is there a command that clears a single line in the console?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
Auto-translated
Dyrman
Is there a command that clears a single line in the console?
What do you mean by "clears"? Does it delete the previous line?
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
In what sense does it "clear"? Does it delete the previous one?
Yes.
So that it doesn't appear in the console.
For example, the line "Hitler is kaput" appears in the console. I want to delete it, without affecting the lines before it.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

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

Statistics

Welcome our newest member: Emil