Bestia - wątek roboczy

Wszelkie pytania na temat SAIL'a i modowania OW.
Post Reply
User avatar
Don Hard
Soldier level 5
Soldier level 5
Nepal
Posts: 242
Joined: Thu May 28, 2015 7:40 pm
Location: Lechia

Bestia - wątek roboczy

Post by Don Hard »

Tak, tak to znowu ja. :D
Od teraz każdy mój problem będę opisywał tutaj, by nie zaśmiecać forum. :wink:
Dzisiaj miałem bardzo dużo wolnego czasu i nie miałem za bardzo co robić, więc usiadłem przy moim modzie i zacząłem pisać moją drugą misję. :)
Problem w tym, że napisałem już kod, jak ta misja mogłaby wyglądać i chciałem ją przetestować ale wywala mi taki piękny błąd. Zamieszczam załącznik. :)
Z tego co wyczytałem chodzi coś z komendą CreateHuman i z płciami. Sprawdziłem moje wszystkie moduły z tą funkcją i nie mam tam błędów. Po prostu ładnie się wszystko kompiluje.
Poniżej zamieszczam kody z komendą CreateHuman, ale wątpię czy one są tu potrzebne. :)
Spoiler:
var x;

every 0$1 do
for x=1 to 4 do
begin

uc_side := 4;
uc_nation := nation_american;
hc_class := 1;
hc_skills := [2,1,0,0];
hc_sex := Rand(sex_male,sex_female);
ams1 := CreateHuman;
PlaceHumanInUnit(ams1,arm1);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := 'Jason Green';
hc_class := 1;
hc_skills := [4,2,0,1];
hc_sex := sex_male;
porucznik := CreateHuman;
PlaceUnitArea(porucznik,AreaPorucznik,false);
ComTurnXY(porucznik,80,13);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := 'Samantha Freeman';
hc_class := 1;
hc_skills := [2,0,1,0];
hc_sex := sex_female;
samantha := CreateHuman;
PlaceUnitArea(samantha,AreaSamantha,false);
ComTurnXY(samantha,66,15);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := '';
hc_class := 2;
hc_sex := Rand(sex_male,sex_female);
hc_skills := [1,3,0,1];
eng := CreateHuman;
PlaceUnitArea(eng,AreaBaza,false);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := '';
hc_class := 3;
hc_sex := Rand(sex_female, sex_male);
hc_skills := [0,1,2,0];
mech := CreateHuman;
PlaceHumanInUnit(mech,work1);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := '';
hc_class := 4;
hc_sex := Rand(sex_male, sex_female);
hc_skills := [0,0,1,2];
nau := CreateHuman;
PlaceHumanInUnit(nau,lab1);
end;

every 0$1 do
begin
uc_side := 4;
uc_nation := nation_american;
hc_name := '';
hc_class := 2;
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,0,0,0];
ams2 := CreateHuman;
PlaceHumanInUnit(ams2,brs1);
end;
Spoiler:
EXPORT rus1, rus2, rus3, rueng, rumech1, rudowodca;
var y;

every 0$1 do
for y=1 to 2 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [Rand(2,1),0,1,0];
hc_class := 1;
rus1 := CreateHuman;
PlaceHumanInUnit(rus1,ruarm1);
end;


every 0$1 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,0,1,0];
hc_class := 1;
rus2 := CreateHuman;
PlaceHumanInUnit(rus2,rubrs1);
end;

every 0$1 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,0,1,0];
hc_class := 1;
rus2 := CreateHuman;
PlaceHumanInUnit(rus3,rubrst3);
end;

every 0$1 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,2,0,0];
hc_class := 2;
rueng := CreateHuman;
PlaceUnitArea(rueng,AreaRuEng,false);
end;

every 0$1 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [4,0,2,1];
hc_class := 1;
rudowodca := CreateHuman;
PlaceHumanInUnit(rudowodca,rudepot1);
end;

every 0$1 do
begin
uc_side := 3;
uc_nation := nation_russian;
hc_name := '';
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,0,2,1];
hc_class := 3;
rumech1 := CreateHuman;
PlaceHumanInUnit(rumech1,work1);
end;
Spoiler:
EXPORT rusol1, veh1, rumech2;
var z;

every 5$00+2$00 marked 001 do
for z=1 to 6 do
begin
enable(001);
uc_side := 3;
uc_nation := nation_russian;
hc_sex := Rand(sex_male, sex_female);
hc_skills := [Rand(1,3),0,1,0];
hc_class := 1;
rusol1 := CreateHuman;
PlaceUnitArea(rusol1,AreaSpawn,false);
uc_side := 3;
uc_nation := nation_russian;
hc_sex := Rand(sex_male, sex_female);
hc_skills := [1,0,2,0];
hc_class := 3;
rumech2 := CreateHuman;
PlaceHumanInUnit(rumech2,veh1);
vc_chassis := ru_heavy_wheeled;
vc_engine := engine_combustion;
vc_control := control_manual;
vc_weapon := ru_heavy_machine_gun;
veh1 := CreateVehicle;
PlaceUnitArea(veh1,AreaSpawn,false);
ComAgressiveMove(rusol1,80,9);
ComAgressiveMove(rumech2,80,9);
end;
Attachments
Piękny błąd.png
(404.96 KiB) Not downloaded yet
Last edited by Don Hard on Sat Nov 05, 2016 7:53 pm, edited 2 times in total.
User avatar
Gravitr
Throwback Developer
Czech Republic
Posts: 238
Joined: Fri Jul 27, 2012 12:00 pm
Location: CZ Prague
Contact:

Re: Wszytkie moje problemy

Post by Gravitr »

This line

Code: Select all

hc_sex := Rand(sex_female, sex_male);
is the issue. This rand will return false. Second number in Rand must be greater than first one, which is not in your case (const. sex_male = 1, sex_female = 2). That's why it fails.

Just do hc_sex := Rand(sex_male, sex_female); and it will fix your problem.
[MOD] Arabian History - 9 missions
Show post with download

[MOD] Vsevolod Mission - 4 pro missions
Show post with download

[MP-MOD] Throwback - over 35 new missions
Official site (+download)
User avatar
Don Hard
Soldier level 5
Soldier level 5
Nepal
Posts: 242
Joined: Thu May 28, 2015 7:40 pm
Location: Lechia

Re: Wszytkie moje problemy

Post by Don Hard »

Thanks for help again, I will remember this.
User avatar
Don Hard
Soldier level 5
Soldier level 5
Nepal
Posts: 242
Joined: Thu May 28, 2015 7:40 pm
Location: Lechia

Re: Wszytkie moje problemy

Post by Don Hard »

Witam po raz kolejny. :arhello:
Zacząłem pracować nad trzecią misją moda, ale mam problemy z wczytaniem postaci.

Zrobiłem taki kod:

Code: Select all

EXPORT porucznik, blackmen, apeman;

STARTING
begin

uc_side := 1;
porucznik=CreateCharacter('porucznik');
blackmen=CreateCharacter('blackmen');
apeman=CreateCharacter('apeman');
PlaceUnitArea(porucznik,AreaStart,false);
PlaceUnitArea(blackmen,AreaStart,false);
PlaceUnitArea(apeman,AreaStart,false);

SetBName(bravo,'Baza Bravo');
end;
I gra nie wczytuje moich postaci, po prostu jest cała czarna mapa. :arcry:

Kod na zapis postaci:

Code: Select all

SaveCharacters(porucznik,'porucznik');
SaveCharacters(blackmen,'blackmen');
SaveCharacters(apeman,'apeman');
AddMedal('medal1',1);
AddMedal('medal2',1);
AddMedal('medal3',1);
GiveMedals('MAIN');
YouWin;
end;
Map Preferences mam ustawione na fog side number 1,a opis mam na AM kampanie, misja trzecia. :arlol:
Smok
Soldier level 1
Soldier level 1
Posts: 10
Joined: Fri May 13, 2016 8:26 pm

Re: Wszytkie moje problemy

Post by Smok »

Testujesz to w edytorze? Nie wiem czy dobrze piszę, ale wydaje mi się, że postacie przetrzymywane są w zapisie gry. Edytor z takowego nie korzysta, więc wczytanie zapisanych postaci zadziała ci tylko z poziomu gry.
Post Reply