--Initial campaign triggers (static file, not updated)
--Copied to Status/camp_triggers.lua in first mission and subsequently read and updated there
--Campaign triggers are defined with conditions and actions
-------------------------------------------------------------------------------------------------------

--List of Return functions to build conditions:
--Return.Time()							returns time of day in seconds
--Return.Day()							returns day of month
--Return.Month()						returns month as number
--Return.Year()							returns year as number
--Return.Mission()						returns campaign mission number
--Return.CampFlag(flag-n)				returns value of campaign flag
--Return.AirUnitActive("UnitName")		returned boolean whether the air unit is active			
--Return.AirUnitReady("UnitName")		returns amount of ready aircraft in unit
--Return.AirUnitAlive("UnitName")		returns amount of ready and damaged aircraft in unit
--Return.AirUnitBase("UnitName")		returns the name of the airbase the unit operats from
--Return.AirUnitPlayer("UnitName")		returns boolean whether the air units is playable
--Return.TargetAlive("TargetName")		returns percentage of alive sub elements in target
--Return.GroupHidden("GroupName")		returns group hidden status
--Return.GroupProbability("GroupName")	returns group spawn probability value between 0 and 1

--List of Action functions for trigger actions:
--Action.None()
--Action.Text("your briefing text")
--Action.SetCampFlag(flag-n, boolean/number)
--Action.AddCampFlag(flag-n, number)
--Action.AddImage("filname.jpg")
--Action.CampaignEnd("win"/"draw"/"loss")
--Action.TargetActive("TargetName", boolean)
--Action.AirUnitActive("UnitName", boolean)
--Action.AirUnitBase("UnitName", "BaseName")
--Action.AirUnitPlayer("UnitName", boolean)
--Action.AirUnitReinforce("SourceUnitName", "DestinationUnitName", destNumber)
--Action.AirUnitRepair()
--Action.AddGroundTargetIntel("sideName")
--Action.GroupHidden("GroupName", boolean)
--Action.GroupProbability("GroupName", number 0-1)

--Important notes:
--for condition and action strings: outside with single quotes '', inside with double quotes ""!

camp_triggers = {
	
	----- CAMPAIGN INTRO ----
	["Campaign Briefing"] = {										--Trigger name
		active = true,												--Trigger is active
		once = true,												--Trigger is fired once
		condition = 'true',											--Condition of the trigger to return true or false embedded as string
		action = {													--Trigger action function embedded as string
			[1] = 'Action.Text("Operation Desert Storm, the campaign to drive the Iraqi dictator Saddam Hussein out of Kuwait, has begun with the initiation of a large scale air offensive. Coalition air power is tasked to strike the Iraqi war machine in preparation of a ground offensive with the ultimate goal of liberating Kuwait and removing Iraq as a threat to its neighbor countries.")',
			[2] = 'Action.Text("The US Air Force has sent considerable forces to the Gulf in support of the operation. At the forefront are the F-15C Eagles of the 58th Tactical Fighter Squadron who are tasked to attain air superiority and protect coalition strike aircraft against the Iraqi Air Force. The brunt of daylight attack falls on the F-16C of the 17th Tactical Fighter Squadron, supported by F-4G Wild Weasels of the 561 TFS. Attack during the night is carried out by the F-15E Strike Eagles of the 335th Tactical Fighter Squadron, who are looking forward to the types combat debut. Of considerable interest to the USAF is the deployment of the F-117A Nighthawk stealth bomber with the 417th Tactical Fighter Squadron. Also operating under the cover of night are the 69th Bomb Squadron flying the veteran B-52 bomber. The USAF contingent is completed by a deployment of E-3A Sentry from the 7th Airborne Command and Control Squadron. Together these squadrons form a powerful and mighty force.")',
			[3] = 'Action.Text("The Iraqi Air Force is flying a mix of MiG-29, MiG-25, MiG-23 and MiG-21 fighters directed by ground based early warning radar. Air bases and target complexes of high value are protected by a variety of surface-air missile systems, such as the SA-6 Gainful, the SA-8 Gecko and the SA-3 Goa, as well as short-range IR-SAMs and AAA. As part of the coalition air offensive, the US Air Force is tasked with neutralizing the Iraqi Air Force, both in the air and on the ground, as well as destroying Iraqi strategic targets of highest importance.")',
			[4] = 'Action.AddImage("Newspaper_FirstNight.jpg")',
		},
	},
	
	
	----- CAMPAIGN END -----
	["Campaign End Victory 1"] = {
		active = true,
		once = true,
		condition = 'GroundTarget["blue"].percent < 1',
		action = {
			[1] = 'Action.CampaignEnd("win")',
			[2] = 'Action.Text("The USAF units deployed to the Gulf have successfully destroyed all the targets that they were assigned by US Central Command. With the complete destruction of the Iraqi infrastructure, the air campaign of this war comes to an end. US air power has once again proven its effectiveness and decisiveness. Well done.")',
			[3] = 'Action.AddImage("Newspaper_Victory.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
	["Campaign End Victory 2"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitReady("39 Sqn") + Return.AirUnitReady("96 Sqn") + Return.AirUnitReady("73 Sqn") + Return.AirUnitReady("57 Sqn") + Return.AirUnitReady("6 Sqn") + Return.AirUnitReady("14 Sqn") < 1',
		action = {
			[1] = 'Action.CampaignEnd("win")',
			[2] = 'Action.Text("The Iraqi Air Force is in ruins. After repeated air strikes and disastrous losses in air-air combat, the Iraqis are no longer able to produce any sorties or offer any resistance. The USAF now owns complete air superiority. With the disappearance of the air threat, the role of the F-15C Eagle in this war comes to an end. Once again the victorious Eagle has proved to be to leading fighter in the world. Well done.")',
			[3] = 'Action.AddImage("Newspaper_Victory.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
	["Campaign End Loss"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("58 TFS") < 2',
		action = {
			[1] = 'Action.CampaignEnd("loss")',
			[2] = 'Action.Text("Ongoing combat operations have exhausted the 58 Tactical Fighter Squadron. Loss rate has reached a level where reinforcements are no longer able to sustain combat operations. With the failure of USAF to attain air superiority, US Central Command has decided to call of the air campaign against the Iraqis. Without air power it seems unlikely that the coalition will be able to win this war. The failure of the F-15C Eagle to prevail in combat with the Iraqi Air Force raises many uncomfortable questions. The Air Force will have to go through a thorough review on the training of its pilots and the capabilities of the Eagle.")',
			[3] = 'Action.AddImage("Newspaper_Defeat.jpg")',
			[4] = 'NoMoreNewspaper = true',
		},
	},
	["Campaign End Draw"] = {
		active = true,
		once = true,
		condition = 'MissionInstance == 30',
		action = {
			[1] = 'Action.CampaignEnd("draw")',
			[2] = 'Action.Text("The air campaign has seen a sustained period of inactivity. Seemingly unable to complete the destruction of the Iraqi Air Force and the Iraqi infrastructure, US Central Command has called off all squadrons from offensive operations. The ground campaign will start shortly and the Army is eager to complete what the Air Force could not get done.")',
			[3] = 'NoMoreNewspaper = true',
		},
	},
	
	
	----- REPAIR AND REINFORCEMENTS -----
	["Repair"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitRepair("blue")',
	},
	["Reinforce 58 TFS"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/58 TFS", "58 TFS", 18)',
	},
	["Reinforce 335 TFS"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/335 TFS", "335 TFS", 12)',
	},
	["Reinforce 17 TFS"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/17 TFS", "17 TFS", 18)',
	},
	["Reinforce 561 TFS"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/561 TFS", "561 TFS", 12)',
	},
	["Reinforce 58 TFS"] = {
		active = true,
		condition = 'true',
		action = 'Action.AirUnitReinforce("R/69 BS", "69 BS", 5)',
	},
	
	
	----- AVIATION UNIT STATUS -----
	["58 TFS Alive 75%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("58 TFS") < 14',
		action = 'Action.Text("Aircraft strength of the 58th Tactical Fighter Squadron equipped with F-15C Eagle has fallen below 75%.")',
	},
	["58 TFS Alive 50%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("58 TFS") < 9',
		action = 'Action.Text("Aircraft strength of the 58th Tactical Fighter Squadron equipped with F-15C Eagle has fallen below 50%. If losses continue at the present rate, the combat capability of the squadron is in jeopardy.")',
	},
	["58 TFS Alive 25%"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("58 TFS") < 5',
		action = 'Action.Text("Aircraft strength of the 58th Tactical Fighter Squadron equipped with F-15C Eagle has fallen below 25%. The number of available airframes is critically low. The sqadron is short of destruction.")',
	},
	["Newspaper Nighthawk Down"] = {
		active = true,
		once = true,
		condition = 'Return.AirUnitAlive("417 TFS") < 6',
		action = {
			[1] = 'Action.AddImage("Newspaper_NighthawkDown.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	
	
	---- GROUND TARGET STATUS ---
	["Blue Ground Target Briefing Intel"] = {
		active = true,
		condition = 'true',
		action = 'Action.AddGroundTargetIntel("blue")',
	},
	["Red Ground Target Briefing Intel"] = {
		active = true,
		condition = 'true',
		action = 'Action.AddGroundTargetIntel("red")',
	},
	
	
	---- NEWSPAPER ----
	["Newspaper AWACS"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_AWACS.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper BUFF"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_BUFF.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Eagle"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Eagle.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Falcon"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Falcon.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Fishbed"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Fishbed.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Flogger"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Flogger.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Foxbat"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Foxbat.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Fulcrum"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Fulcrum.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Gainful"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Gainful.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Gecko"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Gecko.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Nighthawk"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Nighthawk.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Oil Wells"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_OilWells.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Patriot"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Patriot.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Scud"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Scud.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Strike Eagle"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_StrikeEagle.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Tanker"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_Tanker.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
	["Newspaper Wild Weasel"] = {
		active = true,
		once = true,
		condition = 'NoMoreNewspaper == nil and Return.Mission() > 1 and math.random(1,10) == 1',
		action = {
			[1] = 'Action.AddImage("Newspaper_WildWeasel.jpg")',
			[2] = 'NoMoreNewspaper = true',
		},
	},
}