Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
#727
Auto-translated
RemoveHeroCreatures()

How can I use this function to remove all creatures from a hero's army? Please explain with an example. I'm having trouble understanding the first argument, creatureID.
Will CREATURE_UNKNOWN help?
I'll have to call RemoveHeroCreatures() 7 times.
How should I handle the quantity? Should I specify 9999?
Why is everything so unclear?
How should I handle the slots? -1, 0, 1...?

готовность 70% PAUSED
Don't pretend to be a victim.
In reply to Vulpes93
User Avatar
#728
Auto-translated
for i=1,179 do
RemoveHeroCreatures('Hero',i,1E6)
end
Only one creature will remain in the army.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#729
Auto-translated
function armyrunF()
i=0;
i=i+1;
while i<=176 do
if heroname == "Brem" then
MessageBoxForPlayers(GetPlayerFilter(GetCurrentPlayer()),GetMapDataPath().."armyrun.txt");
RemoveHeroCreatures("Brem", i, 1E6);
MoveHeroRealTime('Brem', 87, 20, -1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "armyrun", nil);
else sleep (1);
end;
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "armyrun", "armyrunF");

Please check it.

And how can I trick the system to remove all creatures, but leave only one angel?

Added 43 minutes later
Also, I have a question about the complex function TalkBoxForPlayers.

I need the following: display text and three answer options.
When the first answer is selected, call a function that displays text and awards the player who called TalkBoxForPlayers with a victory.
When the second answer is selected, call a function that displays text2 and awards the player who called TalkBoxForPlayers with a victory.
When the third answer is selected, call a function that displays text3 and awards the player who called TalkBoxForPlayers with a victory

готовность 70% PAUSED
Don't pretend to be a victim.
User Avatar
#730
Auto-translated
function kirassad(heroname)
gold=GetPlayerResource(1,6);
if gold>= 10000 then
QuestionBox(GetMapDataPath().."yeskir.txt","yes","no");
else
MessageBox(GetMapDataPath().."netgolds.txt");
end;
end;

function yes(heroname)
SetPlayerResource(1,6,gold-10000);
sleep(3);
GiveArtefact(heroname,48,0);
sleep(3);
RemoveObject("dvk");
Trigger(OBJECT_ENTER_AND_STOP_TRIGGER,"regdvk",nil);
end;

Trigger(OBJECT_ENTER_AND_STOP_TRIGGER,"regdvk","kirassad");

Take a look, what could be wrong here? I've already checked everything, all the names, and it still doesn't work.
In reply to jackysm
User Avatar
#731
Auto-translated
jackysm
function kirassad(heroname)
gold=GetPlayerResource(1,6);
if gold>= 10000 then
QuestionBox(GetMapDataPath().."yeskir.txt","yes","no");
else
MessageBox(GetMapDataPath().."netgolds.txt");
end;
end;

function yes(heroname)
SetPlayerResource(1,6,gold-10000);
sleep(3);
GiveArtefact(heroname,48,0);
sleep(3);
RemoveObject("dvk");
Trigger(OBJECT_ENTER_AND_STOP_TRIGGER,"regdvk",nil);
end;

Trigger(OBJECT_ENTER_AND_STOP_TRIGGER,"regdvk","kirassad");

Take a look, what could be wrong here. I've already checked everything, all the names, and it still doesn't work.

ERROR: Attempt to call a Nil value?

готовность 70% PAUSED
Don't pretend to be a victim.
User Avatar
#732
Auto-translated
Vulpes93, and what does that mean? It seems the script is written the same way in the manual. I don't understand what the problem is.
In reply to Ment
User Avatar
#734
Auto-translated
function armyRun(hero) if hero=='Brem' then MessageBoxForPlayers(GetPlayerFilter(GetCurrentPlayer()),GetMapDataPath().."armyrun.txt") MoveHeroRealTime('Brem',87,20) for i=1,179 do if i==13 or i==14 then RemoveHeroCreatures('Brem',i,GetHeroCreatures('Brem',i)-1) else RemoveHeroCreatures('Brem',i,1E6) end end Trigger(6,'armyrun',nil) end end Trigger(6,'armyrun','armyRun') ```

jackysm, in the first function, write something like kirassadHero=heroname remove heroname from the parentheses of the second function and replace heroname with kirassadHero in GiveArtifact.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#735
Auto-translated
RedHeavenHero, thanks, but I managed to do it a little differently.
Does anyone know the "Town type IDs" for the Dwarf and Orc towns? I've searched through the entire manual, but it doesn't seem to be listed. Also, could you tell me about the "Class skills" for Dwarves and Orcs?
In reply to jackysm
User Avatar
#736
Auto-translated
jackysm
RedHeavenHero, thanks, but I managed to do it a little differently.
Does anyone know the "Town type IDs" for the Dwarf and Stronghold towns? I've searched through the entire manual, but it doesn't seem to be listed.
It shouldn't be too hard to figure out ;)
Original: Hammers of Fate - Tribes of the East :)
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#737
Auto-translated
Dyrman, I only have "Tribes of the East," and it's not there. If it's not too much trouble, could you share the IDs for the cities and the basic skills of the Orcs and Dwarves?
In reply to jackysm
User Avatar
#738
Auto-translated
jackysm
Dyrman, I only have "Tribes of the East," and it's not there. If it's not too much trouble, could you share the IDs for the towns?
Well, think about it. There were 6 factions, 0...5, then dwarves appeared -> id = 6, then orcs -> id = 7 :)
It's definitely something like that, but I'm not sure :)
Or:
TOWN_FORTRESS dwarves
TOWN_STRONGHOLD orcs
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
#739
Auto-translated
You’re right, I didn’t immediately understand what you were hinting at:smile20:
In reply to jackysm
User Avatar
#740
Auto-translated
Is there a command to change a hero’s name?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
#741
Auto-translated
There is no hero. Although some names can be changed, but not the hero's name.
 

К А
Стикеры GBF в Telegram

Statistics

Welcome our newest member: Emil