------------------------------------------------------------
--     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=80,allvis=0;
function StartMission()
  SetNormalTimeMode();
  MothershipFlight:Stop();
  LineToStation:Delete();
--------------------------------------------------------------------------------
--  StartDialog("Dialog2");
  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("Dialog2");
    end;
  else
    StartDialog("Dialog2");
  end; 
end;

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



--info:top=200,left=80,allvis=0;
function Add_Validol()
  RemovePost("mail_009a_2");
  RemovePost("mail_009a_3");
  PilotValidol = CreatePilot("Validol");
  AddPilotToPlayer(PilotValidol);

  ship1 = CreateCarcass("Hammerhead_pl1",KASINO_STATION:GetPosition()+Vector3(20, 10, -10), Vector3(0,0,1)); 
  ship1:AssignPilot(PilotValidol);
  Flight1 = Player_Group:CreateFlight("Flight1");
  Flight1:AddShip(ship1);
  Flight1:Escort(mothership);
  LineToPortal = CreateLine(np_Kasino, NP_PORTAL_D, RGB(20,80,220), .3, TRUE, .2, 1);
  SetQuestState("quest_9a_03", QUEST_DONE);
  NewTrigger("outside", TrueCondition, Restart_Kasino_Docking, mothership, KASINO_STATION:GetPosition(), 150);
  Timer_Seq(4, Validol_Dialog_1);
end;


--info:top=250,left=80,allvis=0;
function Validol_Dialog_1()
  StartDialog("Dialog3");
end;


--info:top=230,left=120,allvis=0;
function Restart_Kasino_Docking()
  StartDocking(KASINO_STATION);
end;


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

  Player_Group = MothershipPilot:GetGroup();
  
  StopDocking(KASINO_STATION);
  LineToStation = CreateLine(NP_PORTAL_D, np_Kasino, RGB(20,80,220), .3, TRUE, .2, 1);
  NewTrigger("inside", TrueCondition, StartMission, mothership, KASINO_STATION:GetPosition(), 120);
end;


--info:top=80,left=80,allvis=0;
function ACTION_INIT()
  StartInitMis();

  return TRUE;
end;


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

  return TRUE;
end;


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

  return TRUE;
end;
