Strata jednostki przez sojusznika - HELP

Wszystko o modach, patchach i błędach w OW oraz ogólnym programowaniu.
Avatar de l’utilisateur
Xero Rozbójca
Soldier level 6
Soldier level 6
Messages : 391
Inscription : dim. mars 08, 2009 5:13 pm
Localisation : Szukaj w kioskach...

Strata jednostki przez sojusznika - HELP

Message par Xero Rozbójca »

Witam, mam pewien problem, a mianowicie: nie wiem jak napisać warunek, po którym gdy zginie 1 jednostka sojusznika(losowa, bez identyfikatora) to przegrywamy misję. Mógłby ktoś pomóc? :P
"Osoby, stawiające więcej niż trzy znaki interpunkcyjne obok siebie, mają problemy ze zdrowiem psychicznym."

Image
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

Code : Tout sélectionner

export function IsAllyDead(side);
var allys, un;
begin 
   result := 0;
   allys = FilterAllUnits([[f_type, unit_human], [f_ally, side]]);
   for un in allys do
      if IsDead(un) then 
      begin
         result := 1;
         exit;
      end;
end;
i gdzies :

Code : Tout sélectionner

every 0$1 trigger IsAllyDead(naszaside) do
//kod
try that.
Avatar de l’utilisateur
Xero Rozbójca
Soldier level 6
Soldier level 6
Messages : 391
Inscription : dim. mars 08, 2009 5:13 pm
Localisation : Szukaj w kioskach...

Re: Strata jednostki przez sojusznika - HELP

Message par Xero Rozbójca »

Wyskakuje błąd dotyczący [f_ally]
"Osoby, stawiające więcej niż trzy znaki interpunkcyjne obok siebie, mają problemy ze zdrowiem psychicznym."

Image
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

Xero Rozbójca a écrit :Wyskakuje błąd dotyczący [f_ally]
wiesz nie jestem wrozka... przydala by sie tresc bledu.

a sprobuj moze zamienic [f_ally] na [f_ally, twojastrona], gdzie twojastrona to twoja strona ^^.

@down, hmm nawet nie wiem jak sie on tam znalazl xD, tak to jest jak sie robi cos na szybko ^^.
Radzio
Site Administrator
Site Administrator
Poland
Messages : 2898
Inscription : ven. juil. 28, 2006 10:58 am
Localisation : Bialystok, Poland

Re: Strata jednostki przez sojusznika - HELP

Message par Radzio »

A po unit_human nie trzeba przecinka!
Avatar de l’utilisateur
Xero Rozbójca
Soldier level 6
Soldier level 6
Messages : 391
Inscription : dim. mars 08, 2009 5:13 pm
Localisation : Szukaj w kioskach...

Re: Strata jednostki przez sojusznika - HELP

Message par Xero Rozbójca »

funkcja działa, ale warunek z nią zostaje spełniony tylko wtedy, gdy padną wszyscy ludzie sojusznika.
"Osoby, stawiające więcej niż trzy znaki interpunkcyjne obok siebie, mają problemy ze zdrowiem psychicznym."

Image
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

hmm, chyba zrobilem literowke jeszcze w filtrowaniu.
skopiuj teraz kod funkcji i sprawdz.
Avatar de l’utilisateur
Pablo Abruzzi
Soldier level 5
Soldier level 5
Messages : 269
Inscription : lun. juil. 28, 2008 3:09 pm
Localisation : Polska
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Pablo Abruzzi »

A jak zrobić, aby jeśli gracz zabije te jednostkę wtedy przegrywa, bo ten kod działa dla ogólnej śmierci jednostki. Tak jak to było w 3 misji Rus.
Si vis pacem, para bellum jeśli chcesz pokoju, gotuj się do wojny.

THE HEROES COMPANY MOD
[progress]100%[/progress]
DONE
http://forum.original-war.net/viewtopic ... 6&start=90
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

Pablo Abruzzi a écrit :A jak zrobić, aby jeśli gracz zabije te jednostkę wtedy przegrywa, bo ten kod działa dla ogólnej śmierci jednostki. Tak jak to było w 3 misji Rus.
//zly kod

zamienilem z isdied na isdying, bo nie wiem czy z isdied zadziala wantstoattack.

//zly kod

@edit: jednak to nie bedzie WantsToAttack...
@edit2: znalezlem cos nowego, SideShoot(un:integer)
@edit3: dobry kod nizej.
Avatar de l’utilisateur
Pablo Abruzzi
Soldier level 5
Soldier level 5
Messages : 269
Inscription : lun. juil. 28, 2008 3:09 pm
Localisation : Polska
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Pablo Abruzzi »

Code : Tout sélectionner

export function IsAllyDyingByOurUnit();
var allys, un;
begin
   result := 0;
   allys = FilterAllUnits([[f_type, unit_human], [f_ally, 6]]);
   for un in allys do
      if IsDying(un) and GetSide(WantsToAttack(un)) = 3 then
      begin
         result := 1;
         exit;
      end;
end;

every 0$1 trigger IsAllyDyingByOurUnit() do
begin                                     
Youlost('zdrajca');
end;
Nie chce działać. Jak wklepuje:

Code : Tout sélectionner

export function IsAllyDyingByOurUnit(moja strona, np:3);
To mi wywala błąd.
Si vis pacem, para bellum jeśli chcesz pokoju, gotuj się do wojny.

THE HEROES COMPANY MOD
[progress]100%[/progress]
DONE
http://forum.original-war.net/viewtopic ... 6&start=90
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

ok działajaca wersja:
wersja z warunkiem smierci sprzymierzenca:

Code : Tout sélectionner

export function IsAllyKilledByUs(side);
var allys, un;
begin 
   result := 0;
   allys = FilterAllUnits([[f_type, unit_human], [f_ally, side]]);
   for un in allys do
      if IsDead(un) and SideShoot(un) = side then 
      begin
         result := 1;
         exit;
      end;
end;
wersja z warunkiem umierania sprzymierzenca:

Code : Tout sélectionner

export function IsAllyDyingByUs(side);
var allys, un;
begin 
   result := 0;
   allys = FilterAllUnits([[f_type, unit_human], [f_ally, side]]);
   for un in allys do
      if IsDying(un) and SideShoot(un) = side then 
      begin
         result := 1;
         exit;
      end;
end;
Uzywanie:

Code : Tout sélectionner

every 0$1 trigger IsAllyKilledByUs( naszaside ) do
begin
   YouLost('zdrada');
end;

every 0$1 trigger IsAllyDyingByUs( naszaside ) do
begin
   YouLost('zdrada');
end;
A i pablo, nie dajesz wlasnego argumentu w definicji funkcji, tylko potem, przy jej uzywaniu...
Radzio
Site Administrator
Site Administrator
Poland
Messages : 2898
Inscription : ven. juil. 28, 2006 10:58 am
Localisation : Bialystok, Poland

Re: Strata jednostki przez sojusznika - HELP

Message par Radzio »

Po co sprawdzać IsDead dla jednostki z filtra, skoro filtr znajdzie tylko jednostki na mapie, a więc nie te martwe.
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

Radzio a écrit :Po co sprawdzać IsDead dla jednostki z filtra, skoro filtr znajdzie tylko jednostki na mapie, a więc nie te martwe.
filtr zwroci wszystkie jednostki danej strony, ktore sa ludzmi.
nie ma tu f_ok, ani f_alive, wiec nie widze powodu czemu to mialo by nie dzialac.
Radzio
Site Administrator
Site Administrator
Poland
Messages : 2898
Inscription : ven. juil. 28, 2006 10:58 am
Localisation : Bialystok, Poland

Re: Strata jednostki przez sojusznika - HELP

Message par Radzio »

To sobie sprawdź, jeśli nie wierzysz..
Filtr zwróci tylko jednostki na mapie, więc nie martwe!
Avatar de l’utilisateur
Gothuk
Site Administrator
Site Administrator
Poland
Messages : 983
Inscription : mar. sept. 04, 2007 6:10 pm
Localisation : Poland, Warsaw
Contact :

Re: Strata jednostki przez sojusznika - HELP

Message par Gothuk »

No dobra ... masz racje.

Image
Répondre