Polski Česky English Français Русский Español
Home Site Original War Support Community Forums Facebook YouTube Discord
Votre premičre visite? Regardez ça!
» Index > Modding Archive > SAIL - GetTechNation - Zwraca technologie nacji dla zadanej strony

SAIL - GetTechNation - Zwraca technologie nacji dla zadanej strony

Serpent pisze: ↑ndz cze 23, 2019 1:41 am Funkcja zwraca technologie nacji dla zadanej parametrem strony. Dodatkowo można ograniczyć liczbę zwracanych techów bazując na ich konkretnym stanie.

Kod:

Export Function GetTechNation(side, nation, state);
var i;
begin
if not side or not nation then
   exit;

case nation of
     nation_american: result := [35, 45, 46, 47, 1, 2, 6, 15, 16, 7, 12, 13, 10, 14, 20, 25, 36, 69, 39, 34, 40, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62];
     nation_arabian: result := [35, 45, 46, 47, 70, 1, 11, 3, 4, 5, 6, 15, 18, 7, 17, 8, 20, 72, 26, 69, 39, 40, 41, 42, 43, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 66, 67, 68];
     nation_russian: result := [46, 47, 1, 2, 11, 9, 20, 19, 21, 24, 22, 25, 28, 29, 31, 37, 38, 32, 27, 33, 69, 39, 34, 40, 71, 23, 44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 63, 64, 65];
end;

if state > -1 and state < 3 then
   for i in result do
       if GetTech(i, side) <> state then
          result := result diff i;
End;

Parametry:
side - strona ( 1 - 8 )
nation - nacja ( 1 - 3 )
state - status

  • state_disabled lub 0 - technologie zablokowane
  • state_enabled lub 1 - technologie odblokowane
  • state_researched lub 2 - technologie zbadane
  • inna dowolna wartość - wszystkie technologie

Przykład:
Gracz niebieski (side = 1, nation = 2) posiada zbadaną technologię energii słonecznej (35). Pozostałe technologie są odblokowane, zatem funkcja:

Kod:

techy := GetTechNation(1, 2, state_enabled);

Zwróci tablicę wszystkich arabskich techów za wyjątkiem technologii energii słonecznej.

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

» Index > Modding Archive > SAIL - GetTechNation - Zwraca technologie nacji dla zadanej strony