DZMSInit runs

DZMSMajorTimeoutRUN = true;
DZMSMajorTimeoutEXPIRED = false;
DZMSMajorAcceptanceTestRunning = true;
DZMSMajorAccepted = false;

spawns major timer!

DZMSMajDone = false;

DONE!




DZMSMajTimer.sqf is running!

infinite loop

	wait

	checks to see if there are major missions
		if not, terminate

	picks a major mission

	nukes units and hostages arrays

	spawns major timeout timer

	spawns mission

	waits until done flag DZMSMajDone is TRUE ( set within mission code )

	resets done flag DZMSMajDone to FALSE

end loop




mission timeout timer runs

	DZMSMajorTimeoutRUN = true;
	DZMSMajorTimeoutEXPIRED = false;

	runs until

		(1) timer expires -->  DZMSMajorTimeoutRUN = false AND DZMSMajorTimeoutEXPIRED = true
		(2) OR DZMSMajorTimeoutRUN is set externally to FALSE -->  DZMSMajorTimeoutRUN = false AND DZMSMajorTimeoutEXPIRED = false
		(3) OR DZMSMajorAccepted is set externally to TRUE --> DZMSMajorTimeoutRUN = false AND DZMSMajorTimeoutEXPIRED = false




mission script runs

	sets up mission marker

	sets up mission scenery

	sets up mission vehicles

	sets up mission AI

	spawn mission acceptance test script

	spawn mission completion test

	waits until mission passes completion test

	completion test returns

	if the timer expired
		kill all the AI
		nuke all the AI
		nuke all the scenery and vehicles
		let everyone know the mission timed out

	if the mission was accepted
		set the persistent flag on any vehicles that were designated loot	
		attempt to save any vehicles
		let everyone know the mission is over
		
	nukes mission marker
	resets mission complete flag to TRUE




mission acceptance test script runs

	DZMSMajorAcceptanceTestRunning = true;
	DZMSMajorAccepted = false;

	runs until

		(1) DZMSMajorAcceptanceTestRunning  is set externally to FALSE --> DZMSMajorAcceptanceTestRunning = false AND DZMSMajorAccepted = false
		(2) OR any major AI unit is killed --> DZMSMajorAcceptanceTestRunning = false AND DZMSMajorAccepted = true



	
mission completion test script runs

	calculates number of units spawned

	calculates number of units killed required

	runs until

		(1) player is near object AND required units are killed
		(2) OR DZMSMajorTimeoutEXPIRED is TRUE





So what happens?

kill any unit --> timeout timer quits --> mission runs until player is near object and required units are killed

don't kill any units --> timeout timer fires --> completion test fires --> mission ends

kill any units --> timeout timer quits --> kill all units and apporach objective --> completion test fires --> mission ends
