Skip to content
User Avatar
#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.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация