SAIL - UnitGoingTo

Gotowe kody SAIL'a, informacje na temat moddingu, itd.

Moderator: zoNE

Post Reply
User avatar
zoNE
The Great Uniter & Site Administrator
The Great Uniter & Site Administrator
Posts: 2059
Joined: Fri Feb 17, 2006 3:44 pm
Location: Poland
Contact:

SAIL - UnitGoingTo

Post by zoNE »

Serpent wrote:Funkcja zwraca prawdę jeśli jednostka (unit) zmierza na hexa o koordynatach x,y:

Code: Select all

Export Function UnitGoingToXY(unit, x, y);
begin

     if GetTaskList(unit) then
        begin
        if 'M' = GetTaskList(unit)[1][1] and
             x = GetTaskList(unit)[1][2] and
             y = GetTaskList(unit)[1][3] then
           result := true
            else
             result := false;
        end
         else
          result := false;
End;

Funkcja zwraca prawdę jeśli jednostka (unit) zmierza do arei (area):

Code: Select all

Export Function UnitGoingToArea(unit, area);
var x, y;
begin

     if GetTaskList(unit) then
        begin
        if 'M' = GetTaskList(unit)[1][1] then
           begin
           x = GetTaskList(unit)[1][2];
           y = GetTaskList(unit)[1][3];

           if HexInArea(x, y, area) then
              result := true
               else
                result := false;
           end
            else
             result := false;
        end;
End;
Uwaga:
Wymaga zadeklarowania funkcji HexInArea:
https://forum.original-war.net/viewtopi ... =42&t=4544

Funkcja sprawdza czy unit chce wejść do budynku (building):

Code: Select all

Export Function UnitGoingToBuilding(unit, building);
var x, y;
begin
x := GetX(building);
y := GetY(building);

     if GetTaskList(unit) then
        begin
        if 'e' = GetTaskList(unit)[1][1] and
             x = GetTaskList(unit)[1][2] and
             y = GetTaskList(unit)[1][3] then
          result := true
           else
            result := false;
        end
         else
          result := false;
End;
Funkcja sprawdza czy unit chce wejść do pojazdu (veh):

Code: Select all

Export Function UnitGoingToVehicle(unit, veh);
var x, y;
begin
x := GetX(veh);
y := GetY(veh);

     if GetTaskList(unit) then
        begin
        if 'E' = GetTaskList(unit)[1][1] and
             x = GetTaskList(unit)[1][2] and
             y = GetTaskList(unit)[1][3] then
          result := true
           else
            result := false;
        end
         else
          result := false;
End;
Author: Serpent
Topic: https://forum.original-war.net/viewtopi ... =42&t=4545
Post Reply