Actions
getDistance
Calculer la distance (en cellules) entre deux positions.
Calculer la distance (en cellules) entre deux positions.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Calculer la distance (en cellules) entre deux positions.
fightAction:getDistance(cellIdStart, cellIdEnd)
| Nom | Type | Description |
|---|---|---|
cellIdStart | int | Cellule de départ. |
cellIdEnd | int | Cellule de destination. |
| Type | Description |
|---|---|
int | Distance en nombre de cellules. |
local myCell = fightCharacter:getCellId()
local enemyCell = fightAction:getNearestEnemy()
local dist = fightAction:getDistance(myCell, enemyCell)
if dist > 1 then
fightAction:moveToWardCell(enemyCell)
end
if dist == 1 then
fightDebug:print("Portée corps-à-corps !")
end