------------------------------------------------------------
--     2008 Elite Games Team (R) All Rights Reserved      --
--             "STAR WOLVES 2: CIVIL WAR"                 --
------------------------------------------------------------

------------------------------------------------------------
--   Auto-built activate-file created by "MapBuilder2"    --
------------------------------------------------------------
--      "MapBuilder2" v.2.6 Elite Games Team              --
------------------------------------------------------------



last_loc=GetLastLocation();
if(last_loc=="xt11") then	IncommingAnim(PORTAL_L,mothership); end;
if(last_loc=="xt26") then	IncommingAnim(PORTAL_R,mothership); end;
if(last_loc=="xt24") then	IncommingAnim(PORTAL_U,mothership); end;
----------------------------------------------------------------
--COORDINATES
----------------------------------------------------------------

xyz_portal_L = Vector3(-750, -200, -260);
xyz_portal_R = Vector3(800, 100, 500);
xyz_portal_U = Vector3(-700, 0, 800);
xyz_trade_station = Vector3(400, 20, -150);
xyz_STO = Vector3(0, 20, 400);
xyz_mine = Vector3(-192, -30, -512);
xyz_pir = Vector3(496, 50, 892);


-------------------------------------------------------------
--TRIGGERS                                       
-------------------------------------------------------------

--выводит сообщение о том что вы летите тудато с установленной задержкой
Teleporter = CreateTrigger();
Teleporter:AttachEvent(_EVENT_TIMER); 
Teleporter:SetTime(3);
Teleporter:AttachCondition(TrueCondition);
Teleporter:AttachAction(TeleporterAction);


--триггер для активации порталов через некоторое время после прибытия
PortalsActivateTrigger = CreateTrigger();
PortalsActivateTrigger:AttachEvent(_EVENT_TIMER);
PortalsActivateTrigger:SetTime(20);
PortalsActivateTrigger:AttachCondition(TrueCondition);
PortalsActivateTrigger:AttachAction(PortalsActivate_Action);
PortalsActivateTrigger:Activate();

--триггер для Портала PORTAL_L
PortalTrigger_PORTAL_L = CreateTrigger();
PortalTrigger_PORTAL_L:AttachEvent(_EVENT_INSIDEVOLUME);
PortalTrigger_PORTAL_L:SetObject(mothership);
PortalTrigger_PORTAL_L:SetVolume(PORTAL_L:GetPosition(), 15);
PortalTrigger_PORTAL_L:AttachCondition(PORTAL_L_Condition);
PortalTrigger_PORTAL_L:AttachAction(PORTAL_L_Action);



--триггер для Портала PORTAL_R
PortalTrigger_PORTAL_R = CreateTrigger();
PortalTrigger_PORTAL_R:AttachEvent(_EVENT_INSIDEVOLUME);
PortalTrigger_PORTAL_R:SetObject(mothership);
PortalTrigger_PORTAL_R:SetVolume(PORTAL_R:GetPosition(), 15);
PortalTrigger_PORTAL_R:AttachCondition(PORTAL_R_Condition);
PortalTrigger_PORTAL_R:AttachAction(PORTAL_R_Action);



--триггер для Портала PORTAL_U
PortalTrigger_PORTAL_U = CreateTrigger();
PortalTrigger_PORTAL_U:AttachEvent(_EVENT_INSIDEVOLUME);
PortalTrigger_PORTAL_U:SetObject(mothership);
PortalTrigger_PORTAL_U:SetVolume(PORTAL_U:GetPosition(), 15);
PortalTrigger_PORTAL_U:AttachCondition(PORTAL_U_Condition);
PortalTrigger_PORTAL_U:AttachAction(PORTAL_U_Action);



---------------------
-- Teams & Groups  --
---------------------
Pirates_Team = CreateTeam("Pirates");
PiratesGroup_1 = Pirates_Team:CreateGroup("PiratesGroup_1");
SetGroupRelation(PiratesGroup_1,PLAYER_GROUP,GetTeamRelation("Pirates",PLAYER_TEAM));



----------------------------------------------------------------
--STATIONS ACT
----------------------------------------------------------------
CreateRepairStationDocking(STO_Station,mothership,70,1);

CreateTradeStationDocking(TRADE_STATION,mothership);


---------------------
--     Flights     --
---------------------

--
NewPirateFlight("PiratesGroup_1", "pir01", Vector3(0, -10, 0), 1, 14, Vector3(3, 0, 1));
flight_pir01:Patrol({Vector3(80,0,88),Vector3(-204,0,264),Vector3(-340,0,-72),Vector3(-148,0,-320)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir02", Vector3(744, 0, -780), 1, 12, Vector3(1, 0, 3));
flight_pir02:Patrol({Vector3(896,0,-532),Vector3(440,0,-416),Vector3(400,0,-884),Vector3(880,0,-880)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir03", Vector3(-244, 0, 412), 1, 13, Vector3(-1, 0, 1));
flight_pir03:Patrol({Vector3(-400,0,632),Vector3(-728,0,28),Vector3(-160,0,-144),Vector3(-100,0,492)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir04", Vector3(-176, 0, -836), 1, 10, Vector3(2, 0, 5));
flight_pir04:Patrol({Vector3(128,0,-352),Vector3(636,0,-720),Vector3(412,0,-908),Vector3(-408,0,-820),Vector3(56,0,-684)}, FALSE);

--
NewPirateFlight("PiratesGroup_1", "pir05", Vector3(-372, 0, -232), 1, 11, Vector3(0, 0, -1));
flight_pir05:Patrol({Vector3(-340,0,-568),Vector3(-620,0,-100),Vector3(-212,0,200),Vector3(96,0,-368)}, FALSE);

--
NewPirateFlight("PiratesGroup_1", "pir06", Vector3(440, 0, 272), 1, 12, Vector3(1, 0, 0));
flight_pir06:Patrol({Vector3(644,0,216),Vector3(250,0,400),Vector3(356,0,584)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir07", Vector3(-632, 0, -784), 1, 13, Vector3(-1, 0, 2));
flight_pir07:Patrol({Vector3(-844,0,-428),Vector3(-440,0,-432),Vector3(-232,0,-800),Vector3(-856,0,-924)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir08", Vector3(-232, 0, 804), 1, 10, Vector3(-1, 0, -1));
flight_pir08:Patrol({Vector3(-608,0,544),Vector3(-148,0,456),Vector3(124,0,828),Vector3(-360,0,948)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir09", Vector3(-612, 0, 328), 1, 12, Vector3(-1, 0, 1));
flight_pir09:Patrol({Vector3(-880,0,-136),Vector3(-200,0,-200),Vector3(-424,0,588),Vector3(-888,0,612)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir10", Vector3(244, 0, -584), 1, 13, Vector3(1, 0, -1));
flight_pir10:Patrol({Vector3(576,0,-880),Vector3(40,0,-852),Vector3(208,0,-432),Vector3(588,0,-572)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir11", Vector3(688, 0, -364), 1, 16, Vector3(2, 0, 1));
flight_pir11:Patrol({Vector3(980,0,-252),Vector3(428,0,-564),Vector3(912,0,-748)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir12", Vector3(272, 0, 928), 1, 14, Vector3(-1, 0, 0));
flight_pir12:Patrol({Vector3(72,0,932),Vector3(156,0,688),Vector3(532,0,564),Vector3(860,0,780),Vector3(432,0,776)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir13", Vector3(780, 0, 8), 1, 12, Vector3(2, 0, 1));
flight_pir13:Patrol({Vector3(964,0,252),Vector3(632,0,300),Vector3(708,0,-8),Vector3(888,0,-360)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir14", Vector3(328, 0, 780), 1, 14, Vector3(-1, 0, 0));
flight_pir14:Patrol({Vector3(112,0,764),Vector3(244,0,412),Vector3(652,0,372),Vector3(528,0,728)}, TRUE);

--
NewPirateFlight("PiratesGroup_1", "pir15", Vector3(712, 0, 716), 1, 15, Vector3(0, 0, -1));
flight_pir15:Patrol({Vector3(724,0,596),Vector3(352,0,604),Vector3(376,0,968),Vector3(656,0,924)}, TRUE);

-- END auto-build text --

----------------------------------------------------------------
--В данную (IN SYSTEM UNUSUAL) секцию писать только то, что не обрабатывает Mapbilder2
--IN SYSTEM UNUSUAL START
----------------------------------------------------------------

PORTAL_L:SetGodMode();
PORTAL_R:SetGodMode();
PORTAL_U:SetGodMode();
TRADE_STATION:SetGodMode();

-------------------------------------------------------------
-- защита станций -------------------------------------------
-------------------------------------------------------------
DefStation(STO_Station, "PiratesGroup_1");
DefStation(MINE, "PiratesGroup_1");
DefStation(PIR, "PiratesGroup_1");
DefStation(TRADE_STATION, "PiratesGroup_1");


-- предупреждалка перед ХТ24
if (GetQuestLabel("XT24Permit")~="yes") then
  CreateBeacon(PORTAL_U,mothership,"Neutral");
end;

Trade_Team = CreateTeam("Trade");
Trade_Group_1 = Trade_Team: CreateGroup("Trade_Group_1");
SetGroupRelation(Trade_Group_1,PLAYER_GROUP,GetTeamRelation("Trade",PLAYER_TEAM));
RegisterRandomContact(TRADER_FLIGHT, "Trade_Group_1", {PORTAL_L, PORTAL_R, PORTAL_U}, {xyz_trade_station+Vector3(0, 30, 0)}, 15, 17);

RegisterRandomContact(PIRATE_FLIGHT, "PiratesGroup_1", {PORTAL_U, PORTAL_R}, {xyz_trade_station+Vector3(0, 30, 0)}, 30, 13);

Uss_Team = CreateTeam("Uss");
UssGroup_1 = Uss_Team: CreateGroup("UssGroup_1");
SetGroupRelation(UssGroup_1,PLAYER_GROUP,GetTeamRelation("Uss",PLAYER_TEAM));

RegisterRandomContact(USS_FLIGHT, "UssGroup_1", {PORTAL_L}, {xyz_trade_station+Vector3(0, 30, 0)}, 10, 15);

StartRandomContacts(100, 120);

_Trader_Init(40,20,10,0);

--наемники 
--RegisterNaemnik("nomads", "naemn_11", 90, Vector3(0,0,0)+Vector3(100,0,0), 1, 12,Vector3(1,0,0));

--станции
CreateNoneStationDocking(PIR,mothership,120,"pirate");

CreateNoneStationDocking(MINE,mothership,100,"5"); 

--миниквест пират-вымогатель 
OutMissionActivity("RandomPiratGetMoney",120,30);

----------------------------------------------------------------
--IN SYSTEM UNUSUAL END
----------------------------------------------------------------

