Auto-translated
you could simply loop the MoveHeroRealTime function to make the enemy constantly move towards the desired hero's position. However, it's better not to loop CalcHeroMoveCost, as the game will start to lag if you create an infinite loop with this function.