В процессе написания скрипта для очередной карты столкнулся с редкой проблемой, которую до этого я видел в "Лиепае" за немцев. Суть в том, что с определенного момента - после уничтожения войск игрока в береговых укреплениях - игра начинает все больше и больше тормозить, пока, наконец, не вылетает. Я догадываюсь, что дело в зацикливании скрипта, но вот где именно оно происходит - понять не могу.
function Tarara_amtrac_reinf_0()
LandReinforcement(2010);
RunScript("Tarara_amtrac_attack_0",3000);
Suicide();
end;function Tarara_amtrac_attack_0()
Cmd(3,2010,GetScriptAreaParams("beach_defence_1"));
Cmd(3,2012,GetScriptAreaParams("beach_defence_1"));
Cmd(3,2011,GetScriptAreaParams("2011a"));
RunScript("Tarara_amtrac_disembark_2010",2000);
RunScript("Tarara_amtrac_disembark_2012",2000);
RunScript("Tarara_amtank_to_position_0",1000);
Cmd(3,2013,GetScriptAreaParams("beach_defence_0"));
Cmd(3,2015,GetScriptAreaParams("beach_defence_0"));
Cmd(3,2014,GetScriptAreaParams("2014a"));
RunScript("Tarara_amtrac_disembark_2013",2000);
RunScript("Tarara_amtrac_disembark_2015",2000);
RunScript("Tarara_amtank_to_position_1",1000);
Suicide();
end;function Tarara_amtrac_disembark_2010()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2010
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2010",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2010()
local a;
a = 2010
Cmd(3,a,GetScriptAreaParams("beach_defence_1"));
Cmd(3,a*10,GetScriptAreaParams("beach_defence_1"));
RunScript("Tarara_amtrac_to_position_2010",1000);
Suicide();
end;function Tarara_amtrac_to_position_2010()
if GetNUnitsInArea(0,"beach_defence_1")==0 then
Cmd(3,2010,GetScriptAreaParams("2010"));
QCmd(50,2010);
Cmd(3,20100,GetScriptAreaParams("2010"));
QCmd(50,20100);
end;
end;function Tarara_amtrac_disembark_2012()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2012
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2012",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2012()
local a;
a = 2012
Cmd(3,a,GetScriptAreaParams("beach_defence_1"));
Cmd(3,a*10,GetScriptAreaParams("beach_defence_1"));
RunScript("Tarara_amtrac_to_position_2012",1000);
Suicide();
end;function Tarara_amtrac_to_position_2012()
if GetNUnitsInArea(0,"beach_defence_1")==0 then
Cmd(3,2012,GetScriptAreaParams("2012"));
QCmd(50,2012);
Cmd(3,20120,GetScriptAreaParams("2012"));
QCmd(50,20120);
end;
end;function Tarara_amtank_to_position_0()
if GetNUnitsInArea(0,"beach_defence_1")==0 then
Cmd(3,2011,GetScriptAreaParams("2011"));
QCmd(50,2011);
Suicide();
end;
end;function Tarara_amtrac_disembark_2013()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2013
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2013",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2013()
Cmd(3,2013,GetScriptAreaParams("beach_defence_0"));
Cmd(3,20130,GetScriptAreaParams("beach_defence_0"));
RunScript("Tarara_amtrac_to_position_2013",1000);
end;function Tarara_amtrac_to_position_2013()
if GetNUnitsInArea(0,"beach_defence_0")==0 then
Cmd(3,2013,GetScriptAreaParams("2013"));
QCmd(50,2013);
Cmd(3,20130,GetScriptAreaParams("2013"));
QCmd(50,20130);
end;
end;function Tarara_amtrac_disembark_2015()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2015
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2015",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2015()
Cmd(3,2015,GetScriptAreaParams("beach_defence_0"));
Cmd(3,20150,GetScriptAreaParams("beach_defence_0"));
RunScript("Tarara_amtrac_to_position_2015",1000);
Suicide();
end;function Tarara_amtrac_to_position_2015()
if GetNUnitsInArea(0,"beach_defence_0")==0 then
Cmd(3,2015,GetScriptAreaParams("2015"));
QCmd(50,2015);
Cmd(3,20150,GetScriptAreaParams("2015"));
QCmd(50,20150);
end;
end;function Tarara_amtank_to_position_1()
if GetNUnitsInArea(0,"beach_defence_0")==0 then
Cmd(3,2014,GetScriptAreaParams("2014"));
QCmd(50,2014);
Suicide();
end;
end;function Tarara_amtrac_reinf_1()
LandReinforcement(2016);
RunScript("Tarara_amtrac_attack_1",3000);
Suicide();
end;function Tarara_amtrac_attack_1()
Cmd(3,2016,GetScriptAreaParams("beach_defence_2"));
Cmd(3,2018,GetScriptAreaParams("beach_defence_2"));
Cmd(3,2017,GetScriptAreaParams("2017a"));
RunScript("Tarara_amtrac_disembark_2016",2000);
RunScript("Tarara_amtrac_disembark_2018",2000);
RunScript("Tarara_amtank_to_position_3",1000);
Cmd(3,2019,GetScriptAreaParams("beach_defence_1"));
Cmd(3,2021,GetScriptAreaParams("beach_defence_1"));
Cmd(3,2020,GetScriptAreaParams("2020a"));
RunScript("Tarara_amtrac_disembark_2019",2000);
RunScript("Tarara_amtrac_disembark_2021",2000);
RunScript("Tarara_amtank_to_position_4",1000);
Suicide();
end;function Tarara_amtrac_disembark_2016()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2016
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2016",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2016()
Cmd(3,2016,GetScriptAreaParams("beach_defence_2"));
Cmd(3,20160,GetScriptAreaParams("beach_defence_2"));
RunScript("Tarara_amtrac_to_position_2016",1000);
end;function Tarara_amtrac_to_position_2016()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2016,GetScriptAreaParams("2016"));
QCmd(50,2016);
Cmd(3,20160,GetScriptAreaParams("2016"));
QCmd(50,20160);
end;
end;function Tarara_amtrac_disembark_2018()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2018
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2018",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2018()
Cmd(3,2018,GetScriptAreaParams("beach_defence_2"));
Cmd(3,20180,GetScriptAreaParams("beach_defence_2"));
RunScript("Tarara_amtrac_to_position_2018",1000);
end;function Tarara_amtrac_to_position_2018()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2018,GetScriptAreaParams("2018"));
QCmd(50,2018);
Cmd(3,20180,GetScriptAreaParams("2018"));
QCmd(50,20180);
end;
end;function Tarara_amtank_to_position_2()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2017,GetScriptAreaParams("2017"));
QCmd(50,2017);
Suicide();
end;
end;function Tarara_amtrac_disembark_2019()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2019
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2019",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2019()
Cmd(3,2019,GetScriptAreaParams("beach_defence_2"));
Cmd(3,20190,GetScriptAreaParams("beach_defence_2"));
RunScript("Tarara_amtrac_to_position_2019",1000);
end;function Tarara_amtrac_to_position_2019()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2019,GetScriptAreaParams("2019"));
QCmd(50,2019);
Cmd(3,20190,GetScriptAreaParams("2019"));
QCmd(50,20190);
end;
end;function Tarara_amtrac_disembark_2021()
local k,b,e,r,x,y;
k=0;
r=1450;
b=2021
x,y=GetObjCoord(b);
k=k+x;
e=GetNUnitsInCircle(0,x,y,r);
if e>0 then
Cmd(5,b,x,y);
RunScript("Tarara_amtrac_inf_attack_2021",2000);
end;
if k<0 then
Suicide();
end;
end;function Tarara_amtrac_inf_attack_2021()
Cmd(3,2021,GetScriptAreaParams("beach_defence_2"));
Cmd(3,20210,GetScriptAreaParams("beach_defence_2"));
RunScript("Tarara_amtrac_to_position_2021",1000);
end;function Tarara_amtrac_to_position_2021()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2021,GetScriptAreaParams("2021"));
QCmd(50,2021);
Cmd(3,20210,GetScriptAreaParams("2021"));
QCmd(50,20210);
end;
end;function Tarara_amtank_to_position_3()
if GetNUnitsInArea(0,"beach_defence_2")==0 then
Cmd(3,2020,GetScriptAreaParams("2020"));
QCmd(50,2020);
Suicide();
end;
end;