Skip to content
#1878
Auto-translated
Citizens, comrades, ladies and gentlemen, I need your help. I've been struggling with one of the scripts on the map for quite some time, and it just won't let me rest. Here is its full code:
EnableHeroAI('Bersy',nil)
EnableHeroAI('Ingvar', nil)
EnableHeroAI('Vegeyr', nil)
DoNotGiveTurnToPlayerAIIfNoTownsAndActiveHeroes(PLAYER_3,true)


function Mystery_of_mount()
Trigger(OBJECT_TOUCH_TRIGGER, 'Thanes', nil)
MessageBox(dir..'dialog_1.txt')
sleep(5)
SetObjectEnabled('Thanes', true)
sleep(5)
MakeHeroInteractWithObject('Giovanni', 'Thanes')
sleep(3)
if IsObjectExists('Thanes') == not nil then
RemoveObject('Thanes')
sleep(3)
startThread(Thanes_2)
else startThread(Thanes_2)
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, 'Thanes', 'Mystery_of_mount')

function Thanes_2()
if IsObjectExists('Thanes') == nil then
MessageBox(dir..'dialog_2.txt')
sleep(5)
SetObjectiveState('Thun', OBJECTIVE_COMPLETED)
if GetTownHero('Shagarakti') == 'OrnellaNecro' then
flag = 1;
else TeachHeroSpell('OrnellaNecro',SPELL_TOWN_PORTAL)
SetObjectPosition('OrnellaNecro',28,34,0)
flag = 1;
flag3 = GetDate(DAY)
flag4 = flag3 + 3;
print('flag3')
print('flag4')
flag5 = flag3 + 7;
print('flag3')
print('flag5')
flag6 = flag3 + 14;
print('flag3')
print('flag6')
end;
end;
end;

function Attack_1()
if GetDate(DAY) == flag3 + 3 then
SetObjectPosition('Bersy',28,36,0,4)
SetAIHeroAttractor('Shagarakti','Bersy',2)
AddObjectCreatures('Garrison',40,18 +(flag2*5),7)
AddObjectCreatures('Garrison',42,5 +(flag2*5),6)
EnableHeroAI('Bersy',true)
end;
end;
Trigger(NEW_DAY_TRIGGER,'Attack_1')

function Attack_2()
if GetDate(DAY) == flag3 + 7 then
SetObjectPosition('Vegeyr',28,34,0,4)
SetAIHeroAttractor('Shagarakti','Vegeyr',2)
AddObjectCreatures('Shagarakti',40, 16 + (3*flag2))
AddObjectCreatures('Shagarakti',36, 50 +(10*flag2))
EnableHeroAI('Vegeyr',true)
end;
end;
Trigger(NEW_DAY_TRIGGER,'Attack_2')

function Attack_3()
if GetDate(DAY) == flag3 + 14 then
SetObjectPoistion('Ingvar',28,34,0,4)
SetAIHeroAttractor('Shagarakti','Ingvar',2)
TeachHeroSpell('OrnellaNecro',SPELL_SUMMON_HIVE)
AddObjectCreatures('Shagarakti',36, 30 + (flag2*10))
EnableHeroAI('Ingvar',true)
end;
sleep(1)
end;
Trigger(NEW_DAY_TRIGGER,'Attack_3')

function Attack_finished()
while 1 do
if IsHeroAlive('Ingvar') == nil then
MessageBox(dir..'fu.txt')
end;
sleep(1)
end;
end;
startThread(Attack_finished)

The essence of it is as follows: a quest is given to destroy a group of Thanes. After its completion, after a certain amount of time, the heroes, previously deactivated, should appear at a certain point and attack the player's city. However, this does not happen - the map either freezes, or continues to work normally, but the heroes do not appear. The game version is 3.1, and it doesn't work either on a clean version or with mods. Question to the experts: where is the bug?
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война

Statistics

Welcome our newest member: leyu