Mission = {

	Briefing = 0,
	Objective1  = 0,
	Objective2  = 0,
};


function Mission:OnInit()
	-- you may want to load a string-table etc. here...


	
end





function Mission:OnUpdate()
	local i;
	local bFinished=1;
	for i,objective in Mission do
		if (type(objective)~="function") then
			if (objective==0) then 
				bFinished=0;				
			else
			end
		end	
	end
	if (bFinished==1) then	
		self.Finish();
	end
end

-- this gets triggered after loading, only the first time the map changes
function Mission:OnMapChange()

	System:Log("TRAINING MISSION ON MAP CHANGE");

	if (g_MapChanged) then
		System:Log("PLAYING INTRO CUTSCENE");
		--UI:PlayCutScene('training_begin.bik', "EndCutScene");
		Movie:PlaySequence("first_cutscene",0);
		g_MapChanged=nil;
	end	
end

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

function Mission:Finish()
   
end

--------------------------------------------------------------------------------------------------------
-- Cutsequences

function Mission:Event_UBISOFT_INTRO()
	
end


--------------------------------------------------------------------------------------------------------
-- Ingame Cinematics


function Mission:Event_parrot_flyaway()
Movie:PlaySequence('parrot_flyaway');
end


function Mission:Event_falldown()
Movie:PlaySequence('falldown');
end




function Mission:Event_patrolboat_after_carrier()
Movie:PlaySequence('patrolboat_after_carrier');
end


function Mission:Event_crowe_talk_and_walk_away()
Movie:PlaySequence('crowe_talk_and_walk_away');
end


function Mission:Event_heli_with_val_taking_off()


--Hud:AddMessage('INGAME CUTSCENE: Mertz pushes Val in helicopter, helicopter is',17);
--Hud:AddMessage('taking off and flying to carrier',17);


	Movie:PlaySequence('heli_with_val_taking_off');
end


----------------------------------------------------------------------------------------------------
-- Ingame misc




----------------------------------------------------------------------------------------------------
-- Ingame Cutsequences


function Mission:Event_tower_fall()
	Movie:PlaySequence('tower_fall');	
end



function Mission:Event_patrolboat_passby()
	Movie:PlaySequence('patrolboat_passby');
end


function Mission:Event_start_flyby()
	Movie:PlaySequence('intro');
end

function Mission:Event_init_mission()
	
	-- r_checkSunVis=2;
	-- e_sky_box=0;
	 -- r_Contrast=0.6;
	-- fov=90;
	-- e_terrain_caustics=0;
	-- r_WaterRefractions=0;
	-- hud_panoramic=0;
	-- e_water_ocean=1;
	-- r_VolumetricFog=0;
	-- e_shadow_maps=0;
	-- r_Contrast=0.65;
end


function Mission:Event_MissionFinished()
	_localplayer.cnt:SavePlayerElements();
 	Game:SendMessage('StartLevelFade Carrier');
-- 	Game:SendMessage('EndDemo');
end


function Mission:Event_heli_down()
	Movie:PlaySequence('heli_down');	
end



--------------------------------------------------------------------------------------------------------
-- Ingame Messages (Mission Objectives)




function Mission:Event_1stmessage()
--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_J_1.wav");
--	Sound:PlaySound(self.audio);


-- if we want to skip training bunker with F2

	Hud.DisplayControl.bShowEnergyMeter = 1;
	Hud.DisplayControl.bShowRadar = 1;
	Hud.DisplayControl.bShowWeapons = 1;
	Hud.DisplayControl.bShowAmmo = 1;
	Hud.DisplayControl.bShowBreathOM = 1;
	Hud:AddMessage(Localize("NewObjective"),12); 
	Hud:PushObjective({},Localize("SearchTheHutsFor"));
--	Hud:SetRadarObjective("ammo");
end


function Mission:Event_help_key_for_compass()
	Hud:AddMessage(Localize("YouNeedAKey"),14);
	Hud:AddMessage(Localize("MaybeTheGuardHas"),14);
end
	





function Mission:Event_help_objectiv_tab()
	Hud:AddMessage(Localize("HintToDisplayYou"),12);
end
	

function Mission:Event_12ndmessage()

--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_pickup_A_17.wav");
--	Sound:PlaySound(self.audio);

	Hud:AddMessage(Localize("NewObjective"),17);
	Hud:PushObjective({},Localize("GoToTheHutOnTheH"));
	Hud:CompleteObjective(Localize("SearchTheHutsFor"));
	Hud:SetRadarObjective("binoculars");
	
end




function Mission:Event_2ndmessage()
	
--	self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_R_1.wav");
--	Sound:PlaySound(self.audio);

	Hud:AddMessage(Localize("NewObjective"),17);
	Hud:PushObjective({},Localize("GoToTheCamp"));
	Hud:CompleteObjective(Localize("GoToTheHutOnTheH"));
	Hud:SetRadarObjective("camp");
	 
end






function Mission:Event_3ndmessage()

	

	Hud:AddMessage(Localize("NewObjective"),17);
	Hud:PushObjective({},Localize("StealAVehicle")) ;
	Hud:CompleteObjective(Localize("GoToTheCamp"));
	Hud:SetRadarObjective("vehicle"); 
	
end


function Mission:Event_34ndmessage()

--	self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_D_16.wav");
--	Sound:PlaySound(self.audio);
	 


	Hud:AddMessage(Localize("NewObjective"),17);
	Hud:PushObjective({},Localize("GoToTheCarrier")) ;
	Hud:CompleteObjective(Localize("StealAVehicle"));
	Hud:SetRadarObjective("carrier"); 
	
end


function Mission:Event_4ndmessage()
	
--	self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_D_24.wav");
--	Sound:PlaySound(self.audio);
	 

		
--	Hud:AddMessage('Doyle: Find a way inside the wreck',9);
	-- Hud:AddMessage('the helicopter with valerie has landed to refuel',19);
	Hud:CompleteObjective(Localize("GoToTheCarrier"));
	Hud:PushObjective({},Localize("FindAWayInsideTh"));
	Hud:SetRadarObjective("hole"); 
	 
end





--------------------------------------------------------------------------------------------------------
-- Ingame Messages (Traing Camp Hints)



function Mission:Event_Hint_Handgrenades()

-- sound removed on jacks request		
--	self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_H_1.wav");
--	Sound:PlaySound(self.audio);

		
		Hud:AddMessage(Localize("PressGToThrowGre"),9);
		Hud:AddMessage(Localize("PressHToToggleGr"),9);
end

function Mission:Event_Hint_Stamina()


	Hud:AddMessage(Localize("HolddowntheSPRIN"),9);
	
end



function Mission:Event_Hint_change_grenades()
	
	Hud:AddMessage(Localize("PressHKeyToChang"),19);
end


function Mission:Event_Hint_Stamina2()
	
Hud.DisplayControl.bShowBreathOM = 1;
	Hud:AddMessage(Localize("NoticeYourStamin"),9);
end


function Mission:Event_Hint_use_vehicles()
	Hud:AddMessage(Localize("PressFORWARDKeyD"),12);
	Hud:AddMessage(Localize("PressF1KeyToChan"),12);
	Hud:AddMessage(Localize("PressLEFTMOUSEBU"),12);
	
end



function Mission:Event_Hint_use_humvee()
	
	Hud:AddMessage(Localize("PressRIGHTMOUSEB"),12);
	Hud:AddMessage(Localize("PressLEFTMOUSEBX"),12);

	
end



function Mission:Event_Hint_armor()
	Hud:AddMessage(Localize("TheOrangeArmorBa"),9);
	
end

function Mission:Event_Hint_health()
	Hud:AddMessage(Localize("TheGreenHealthBa"),9);
	
end



function Mission:Event_Hint_Fieldradio()
	Hud:AddMessage(Localize("HintDestroyTheFi"),9);
	 
end


function Mission:Event_Hint_Underwater()

	Hud:AddMessage(Localize("TheBreathOMeterS"),15);
	Hud:AddMessage(Localize("underwaterWithou"),15);



end


function Mission:Event_Hint_Crouch()


	Hud:AddMessage(Localize("HoldDownCTRLAndW"),4);
	 
end


function Mission:Event_Hint_Jump()
	
	Hud:AddMessage(Localize("PressSPACEKeyToJ"),4);


	 
end

function Mission:Event_Hint_Prone()
	Hud:AddMessage(Localize("PressVKeyToProne"),3);


end



function Mission:Event_Hint_Prone_up()
	Hud:AddMessage(Localize("PressVKeyAgainTo"),4);


end



function Mission:Event_Hint_Ladder()


	Hud:AddMessage(Localize("LookUpAndPressFo"),7);
	 --call audio 'Let's get to the other side'
	 

	 
end



function Mission:Event_Hint_dead_end()
--	self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_B_1.wav");
--	Sound:PlaySound(self.audio);
	 
end


function Mission:Event_Hint_radar_enable()
	Hud.DisplayControl.bShowRadar = 1;	
	--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_pickup_A_7.wav");
	--Sound:PlaySound(self.audio);


end


function Mission:Event_Hint_Pickup_Binocular()
	Hud:AddMessage(Localize("YouPickedUpTheBi"),5);
	Hud:AddMessage(Localize("PressTheBINOCULA"),5);
end


function Mission:Event_Hint_Usage_Flashlight()
	Hud:AddMessage(Localize("PressFLASHLIGHTK"),5);


 
end


function Mission:Event_Hint_Usage_Binocular()

	Hud:AddMessage(Localize("ZoomInOutWithThe"),15);
	Hud:AddMessage(Localize("PressRIGHTMOUSEB"),15);
	Hud:AddMessage(Localize("andPressRIGHTMOU"),15);
 
 
 
 

 
end


function Mission:Event_Hint_Shooting_Basic1()

	-- self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/Hint_Shooting_Basic1.wav");
	-- Sound:PlaySound(self.audio);


	-- Hud:AddMessage('Walk up to the pistol to pick it up',15);


end





function Mission:Event_Hint_Shooting_show_ammo_counter()
	Hud.DisplayControl.bShowAmmo = 1;
	Hud.DisplayControl.bShowWeapon = 1;

	
end



function Mission:Event_Hint_Shooting_Basic3_aim()

--	Hud.DisplayControl.bShowBreathOM = 1;
	

	Hud:AddMessage(Localize("PressLeftMouseBu"),19);
	Hud:AddMessage(Localize("HoldDownTheRight"),19);
	Hud:AddMessage(Localize("PressRToReload"),19);

end








function Mission:Event_Hint_Shooting_MountedWeapon()

-- audio 'Ohh thats my favorite part, that a mounted vulcan minigun, have some fun'

	--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/Hint_Shooting_MountedWeapon.wav");
	--Sound:PlaySound(self.audio);


	Hud:AddMessage(Localize("GoToTheMountedMa"),9);
	

end



function Mission:Event_Hint_Shooting_Aim_mode()
	Hud:AddMessage(Localize("HoldDownTheRIGHT"),9);
	Hud:AddMessage(Localize("thisWillAllowYou"),9);

end


function Mission:Event_Hint_Shooting_Firemodes()
	Hud:AddMessage(Localize("PressXToSwitchTo"),19);
	
end


function Mission:Event_Hint_Shooting_Reload()
	Hud:AddMessage(Localize("PressTheRELOADKe"),9);
	
end





function Mission:Event_Hint_wow_scene()
--	Hud:AddMessage('Jack: Wow!!!',9);
	
end




function Mission:Event_Hint_Shooting_Reload_and_pickup_ammo()
	Hud:AddMessage(Localize("PressTheRELOADKe"),19);
	Hud:AddMessage(Localize("bulletsGoToTheAm"),19);
	
end




function Mission:Event_hint_training_start()

	Hud.DisplayControl.bShowEnergyMeter = 1;
	Hud.DisplayControl.bShowRadar = 1;
	Hud.DisplayControl.bShowWeapons = 0;
	Hud.DisplayControl.bShowAmmo = 0;
	Hud.DisplayControl.bShowBreathOM = 1;
	
end

function Mission:Event_hint_mouse_movement()
	
	Hud:AddMessage(Localize("UseYourMouseToLo"),6);
	
	

end



function Mission:Event_hint_keys_movement()

Hud:AddMessage(Localize("PressWToMoveForw"),12);
Hud:AddMessage(Localize("PressSToMoveBack"),12);
	
	
	
end




function Mission:Event_hint_keys2_movement()

		
	Hud:AddMessage(Localize("PressAAndDToStra"),6);
	
	
end






function Mission:Event_hint_checkpoints()

Hud:AddMessage(Localize("TheGameSavesChec"),8);
Hud:AddMessage(Localize("respawnAtTheseCh"),8);
	
end




function Mission:Event_Hint_Sneaking1_around_corner()

	

	Hud:AddMessage(Localize("UseQAndEKeysToLe "),9);
	
	
	
end

function Mission:Event_Hint_Sneaking1_around_corner2()

	Hud:AddMessage(Localize("HoldDownCTRLAndW"),9);

end



function Mission:Event_Hint_need_weapon()

	Hud:AddMessage(Localize("YouMustSearchFor"),15);
end


function Mission:Event_Hint_Sneaking3_som()

	 Hud:AddMessage(Localize("NoticeTheStealth"),15);
	
end



function Mission:Event_Hint_Sneaking4_throw_the_rock()

	
-- call audio 'Pick up the rock on the crate throw it to distract the guard, when he looks away grab the machete'

	Hud:AddMessage(Localize("ThrowTheRockToDi"),7);
	Hud.DisplayControl.bShowWeapons = 1;	
	
end


function Mission:Event_Hint_machete()
	
	
	Hud:AddMessage(Localize("Press2ToSwitchYo"),5);
	--self.audio = Sound:LoadSound("LANGUAGES/missiontalk/training/training_specific_U_1.wav");
	--Sound:PlaySound(self.audio);
	 
	
	
end



function Mission:Event_Hint_driving_3rdpersonview()
	Hud:AddMessage(Localize("TipPressRIGHTMOU"),5);
		 
end



function Mission:Event_Hint_open_doors()
	Hud:AddMessage(Localize("PressTheUSEKeyDe"),5);
		 
end












-- Ingame Messages (Hints, Mercs conversations...)



function Mission:Event_Story_Info_Destroyed_Islanders_Hut()
--	Hud:AddMessage('Jack: Those basters have killed all the islanders',15);
	
	
		
end


	
		

