Skip to content
#2774
Auto-translated
There's a problem: I instructed Erling to go to point 15, 9, and if he can't go there for some reason, then to 121, 22, but if something prevents him from reaching the point, let's say a hero with a large army, he just runs back. How can I make it so that he runs to point 15, 9 no matter what?
The function is written using NEW_DAY_TRIGGER.
if GetDate(DAY) == DayErlingAttack and ErlingAttack == 1 then
DeployReserveHero(Erling,RegionToPoint("Erling_deploy"))
sleep(5)
local x, y = 15, 9
if CanMoveHero(Erling,x,y,0) then
MoveHero(Erling, x, y,0)
elseif CanMoveHero(Erling,121,22) then
MoveHero(Erling, 121, 22,0)
end
startThread(ErlingUpgrade)
end
end