I did as you said, and it worked.
But for some reason, all my other scripts placed in the new day function stopped working. What could be the problem?
This is the function that is triggered by NEW_DAY_TRIGGER.
function new_day_trigger()
haste_p1()
haste_p2()
if (GetDate(ABSOLUTE_DAY) == 2) then
Spawn_army()
end
if (GetDate(ABSOLUTE_DAY) == 3) then
day_3rd()
mentor_off()
Trigger(OBJECT_TOUCH_TRIGGER, 'mentor_1', 'mentor_message_p1');
Trigger(OBJECT_TOUCH_TRIGGER, 'mentor_2', 'mentor_message_p2');
end
endAnd this is the function you sent me, which breaks everything above.
function haste_p1()
while(1) do
local heroes = GetPlayerHeroes(PLAYER_1);
for i, hero in heroes do
if(HasHeroSkill(hero, 143) and (not KnowHeroSpell(hero, SPELL_HASTE))) then
TeachHeroSpell(hero, SPELL_HASTE);
end
end
sleep(50);
end
endPerhaps I placed the haste function incorrectly, and the script processing simply doesn't reach all the other functions?
Added 2 minutes ago
If the spell is not available for casting (insufficient level of light magic), then even if it is granted by the script, it will not be cast, unfortunately.
Strangely enough, it works, but the spell is only cast at the expert level of the school of light, even though there is no light in the skill tree.
But it breaks all the other scripts for some reason.