Polski Česky English Français Русский Español
Home Site Original War Support Community Forums Facebook YouTube Discord
Your first time here? View this!
» Index > Modding Archive > SAIL - Sprawdzanie czy cel jest osiągalny

SAIL - Sprawdzanie czy cel jest osiągalny

Serpent pisze: ↑ndz wrz 03, 2017 11:34 pm Napisałem kodzik który sprawdza czy cel jest osiągalny. Jeśli tak to jednostka podąża w podane miejsce i funkcja zwraca TRUE, w przeciwnym razie funkcja zwraca FALSE.

Kod:

//Destination Reachable Function by Serpent
Export unreachableList;
On DestinationUnreachable(unit) Do
begin
if not unit in unreachableList then
   unreachableList := Insert(unreachableList, unreachableList+1, unit);
end;

Export Function DestinationReachable(unit, x, y);
begin
if unit in unreachableList then
  unreachableList := unreachableList diff unit;

   ComMoveXY(unit, x, y);

   Wait(1);

if unit in unreachableList then
   result := false
    else
     result := true;
End;

Author: Serpent
Topic: https://forum.original-war.net/viewtopic.php?f=42&t=5633

» Index > Modding Archive > SAIL - Sprawdzanie czy cel jest osiągalny