Skip to content
User Avatar
#558
Auto-translated
KioM
local x, y = GetObjectPosition(MainHero);
MoveHero(hero, x+random(2), y-random(2), -1);

in an infinite loop

P.S. It can be made more complex with a check for the distance between heroes, and then the hero can be moved using MoveHeroRealTime; I think this is how it is done in the campaigns.
How to create an infinite loop?

local x, y = GetObjectPosition("Hero2");

function Moov()
while h==1 do
MoveHeroRealTime("Hero3", x+1, y, -1);
end;

I wrote it like this, but the script doesn't work; it says something about x in the line MoveHeroRealTime("Hero3", x+1, y, -1);. As far as I understand, there should be a number there, but instead, it's a variable.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля

Statistics

Welcome our newest member: artem

Users Online 1 users 1542 guests