Table of Contents

CalcHeroMoveCost()

Syntax

CalcHeroMoveCost(heroName, x, y, floorID = -1);

heroName – the hero’s name x, y – the target tile’s coordinates floorID – the floor number (-1 by default, which means the floor in which the hero is located)

Description

This function calculates the hero’s movement cost to the specified point, using movement points as the calculating unit. If the floor is not specified, the one in which the hero is currently located is used. This function can only be invoked for heroes controlled by the AI players. Only static objects are taken into account when the path is formed. If the specified point can’t be reached, the function returns -1.