Oh Lord! This MoveHero doesn't work either!! I can understand these two heroes – no one wants to die, but they should work with scripts!!! My enemy heroes either do whatever they want (until I set up blocks) or just stand there (as in the last three cases). I've already tried calling them with MoveHero and attracting them with AiAttractor, but no – they're stuck!
Posts from Scripts
function Gar(hero)
if hero=="bla-bla" then
MakeHeroInteractWithObject("bla-bla","Garnison");
end;
end;
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"
Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
Well, I figured it out. The heroes simply didn't want to attack cities at close range. I just placed the heroes from the cities on an adjacent tile.
Do I have special scripts? :)
Цикл кампаний "Дыхание Смерти" из трёшки в четвёртом исполнении
Учебная карта
Астралия
За Королеву!
Подземелья и Дьяволы
Отголоски войны
Освобождение
MoveHero is quite a tricky thing. It might not work if the destination point for the hero is on a "green" cell. For example, in Gnomania, I couldn't get the heroes to attack a garrison using this function. I did it like this: I sent them to an adjacent cell, and there's a region there, and a trigger is defined for it:
function Gar(hero)
if hero=="bla-bla" then
MakeHeroInteractWithObject("bla-bla","Garnison");
end;
end;
Does this function only work if the hero is next to the object?
If not, then you don't even need to set up a region and trigger.
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"
Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
Could you please provide information on how to define a condition that triggers when a unit or an enemy hero is defeated?
if GetSavedCombatArmyHero(a1,0)=="Giovanni" then
Loose();
end;
if (GetSavedCombatArmyHero(a1,1)=="Giovanni") and (GetSavedCombatArmyHero(a1,0)=="Zehir") then
MessageBox(GetMapDataPath().."talk_of_grigorio_6.txt");
SetObjectiveState("kill_pl5", OBJECTIVE_COMPLETED, PLAYER_1 );
SetPlayerResource(PLAYER_1 ,GOLD, GetPlayerResource(PLAYER_1 , GOLD)+20000);
end;if flag_bad_grig==1 then
if (GetSavedCombatArmyHero(a1,1)=="Giovanni") and (GetSavedCombatArmyHero(a1,0)=="Duncan") then
SetObjectiveState("kill_pl6", OBJECTIVE_COMPLETED, PLAYER_1 );
MessageBox(GetMapDataPath().."talk_of_grigorio_5.txt");
SetObjectEnabled("portal1", true);
end;
else
if (GetSavedCombatArmyHero(a1,1)=="Giovanni") and (flag_britt==1) then
count_stacks = GetSavedCombatArmyCreaturesCount(a1,0);
for i=0,count_stacks-1 do
cr, numer, dead = GetSavedCombatArmyCreatureInfo(a1,0,i);
if cr==cr_ded then
Strelki_dead= Strelki_dead + dead;
end;
end;
Here are some code examples. If you understand them, you'll get it; if not, ask for an explanation.This is a specific example where one hero defeats another, or a unit is destroyed, and their numbers are tallied.
Or do you need it to account for any enemy death?
Then, here's:
Procedure call format:
void sProc( sHeroName )
Stop:
Trigger(PLAYER_REMOVE_HERO_TRIGGER, nPlayerID, nil)
The procedure is called when player nPlayerID loses a hero. The name of this hero is passed to the procedure as a parameter.
NHF 0.90 : NHF - группа в VK
Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
OpenCircleFog(83, 14, 0, 4, PLAYER_1); -- works,
but three lines below:
SetPlayerResource(PLAYER_1, GOLD, 5000); -- doesn't. Both lines are without functions, and I saw them working in other maps. What could be the problem?
P.S.: Nothing works, starting from the line
SetRegionBlocked("AntiAI", true, PLAYER_2);
Could it have "spoiled" everything that comes after it?
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"
Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
P.S.: It seemed to me that the code stopped working after the line
MessageBox("/Maps/SingleMissions/***********/msg1.txt");
If it's incorrect, could it block everything that comes after it?
Check the encoding in the text file, verify the correctness of the path (and also the correctness of other function names), and it's better to use the GetMapDataPath() function, because if you change the map file name, the specified paths will become invalid.
GetMapDataPath() - determines the path to the main map files.
.. - string concatenation
example:
MessageBox(GetMapDataPath().."talk_of_grigorio_6.txt");Added 17 minutes later
P.S.: Nothing works, starting from the line
SetRegionBlocked("AntiAI", true, PLAYER_2);
Could it have "spoiled" everything that comes after it?
Post the entire script.
What does the console say? The console is a good helper in catching bugs ;)
And one more request: usually edit messages, not like a modder, because the time of the change is not visible, and I end up answering non-existent questions(( :(
NHF 0.90 : NHF - группа в VK
Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
void - function name? - ( -name of the killed hero- )
-what happens when the hero dies?-
Trigger(PLAYER_REMOVE_HERO_TRIGGER, nPlayerID, nil)
end;
end;
-another trigger with the procedure name?-
P.S.: I fixed the errors in the previous code, thanks again for your help.
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"
Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
Could you please explain in more detail how to format the function you posted in the previous message?
void - function name? - ( -name of the killed hero- )
-what happens when the hero dies?-
Trigger(PLAYER_REMOVE_HERO_TRIGGER, nPlayerID, nil)
end;
end;
-another trigger with the procedure name?-
P.S.: I fixed the errors in the previous code, thanks again for your help.
DedF (GGDed)
if GGded == "Zosya" then
..........code here
end;
end;
Trigger(PLAYER_REMOVE_HERO_TRIGGER, 1, "DedF")Something like that.
NHF 0.90 : NHF - группа в VK
Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
Script ERROR: attempt to call a nil value
This happens at the very end – it seems to be related to the function in question.
P.S.: The script editor complained about the second "end," so I removed it. Maybe we need to add an "else" statement?
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"
Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
The console is complaining :(. It says:
Script ERROR: attempt to call a nil value
This happens at the very end – it seems to be the function in question.
P.S.: The script editor complained about the second 'end', so I removed it. Maybe I need to add some kind of 'else'?
You're calling 'nil' instead of something. Check if the hero, function, or parameters exist. Unless, of course, the problem isn't with the word 'function' itself. :)
"Zosya" is obviously a fictional name. It should be the name of the enemy hero. If the enemy hero's name can be anything, just remove the condition.
NHF 0.90 : NHF - группа в VK
Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
Весьма хороший попутчик... До первого перекрестка.