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

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


--info:top=160,left=60,allvis=0;
function StartMission()
  LineToStation:Delete();
  LineToStation = NIL;
  SetNormalTimeMode();
  MothershipFlight:Stop();
--------------------------------------------------------------------------------
--  StartDialog("Dialog1");
  count_or_go_on();
--------------------------------------------------------------------------------
end;


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function count_or_go_on()
  if (pilot_El) or (pilot_Ace) or (pilot_Astra) or (pilot_Bavard) or (pilot_Joker) then
    if (count_pilots() >= 6) then
      choose_pilot();
    else
      StartDialog("Dialog1");
    end;
  else
    StartDialog("Dialog1");
  end; 
end;

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


--info:top=200,left=60,allvis=0;
function finMission()
  SetQuestState("quest_12c_01", QUEST_DONE);
  mothership:AddModuleToInventory("Cargo_for_mission8a",2);
  mothership:AddModuleToInventory("T3",5);
  ship1 = CreateCarcass("Cleaner_m2", TRADE_STATION:GetPosition()+Vector3(-20, 10, 10), Vector3(-1,0,0)); 
  ship1:AssignPilot(AlexandraSpeaker);
  AlexandraFlight = Player_Group:CreateFlight("AlexandraFlight");
  AlexandraFlight:AddShip(ship1);
  AlexandraFlight:Escort(mothership);
  AddQuest("quest_12c_02", "#L_Quest_12c_02a", "#L_Quest_12c_02b", QUEST_PROCESS);
  LineToPortal = CreateLine(NP_TRADE_STATION, NP_PORTAL_L, RGB(20,80,220), .3, TRUE, .2, 1);
  CreateRoute("kadi", "prien", "nj3", "nj1", "altrabon");
  Long_Jump("altrabon", "nj1", "");
  Timer_Seq(5, While_Flying_1);
end;


--info:top=250,left=60,allvis=0;
function While_Flying_1()
  _FTrader_exclude();
  SedoySpeaker:Message("#L_Sedoy_01", 20, "While_Flying_2");
end;


--info:top=290,left=60,allvis=0;
function While_Flying_2()
  HeroSpeaker:Message("#L_Hero_01", 9, "While_Flying_3");
end;


--info:top=330,left=60,allvis=0;
function While_Flying_3()
  SedoySpeaker:Message("#L_Sedoy_02", 10, "While_Flying_4");
end;


--info:top=370,left=60,allvis=0;
function While_Flying_4()
  CheSpeaker:Message("#L_Che_01", 9, "While_Flying_5");
end;


--info:top=410,left=60,allvis=0;
function While_Flying_5()
  HeroSpeaker:Message("#L_Hero_02", 6, "While_Flying_6");
end;


--info:top=450,left=60,allvis=0;
function While_Flying_6()
  SedoySpeaker:Message("#L_Sedoy_03", 7);
  _FTrader_include();
end;


--info:top=120,left=130,allvis=0;
function StartInitMission()
  MothershipPilot = mothership:GetPilot();
  MothershipFlight = MothershipPilot:GetFlight();

  Player_Group = MothershipPilot:GetGroup();

  HeroSpeaker = GetPilot("Hero");
  SedoySpeaker = GetPilot("Sedoy");
  CheSpeaker = GetPilot("Che");
  AlexandraSpeaker = CreatePilot("Alexandra");

  ClearRoute();

  LineToStation = CreateLine(NP_PORTAL_R, NP_TRADE_STATION, RGB(20,80,220), .3, TRUE, .2, 1);
  NewTrigger("inside", TrueCondition, StartMission, mothership, TRADE_STATION:GetPosition(), 110);
end;


--info:top=80,left=130,allvis=0;
function ACTION_INIT()
  SetQuestLabel("CurrentQuest","12c");
  StartInitMission();

  return TRUE;
end;


--info:top=80,left=570,allvis=0;
function ACTION_LEAVELOCATION()
  _FTrader_include();
  if (LineToStation) then
    LineToStation:Delete();
  else
    LineToPortal:Delete();
    QuestActionDone();
  end;

  return TRUE;
end;


--info:top=80,left=470,allvis=0;
function ACTION_FINI()

  return TRUE;
end;
