He can move far away from the hero after pressing "end turn," and then he won't have enough movement points to be near the main character.
Then you can add before MoveHeroRealTime:
ChangeHeroStats("Hero3", 7, 3500);In general, I advise you to take a look at how it's done in the developers' campaigns, in the first mission of the Hammers of Fate, if I'm not mistaken, Laszlo follows Frida... They created an in-script function to check the distance, so the heroes constantly stay close to each other.
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация