Skip to content
#557
Auto-translated
Olegarkh
How do I make a non-player hero follow the main hero on the map?

local x, y = GetObjectPosition(MainHero);
MoveHero(hero, x+random(2), y-random(2), -1);

in an infinite loop

Alternatively, you can make it more complex by checking the distance between the heroes, and then use MoveHeroRealTime to move the hero, I think that's how it's done in the campaigns.

Statistics

Welcome our newest member: dodoD0D0