<?xml version="1.0" standalone="yes" ?> 
<scenario>
<difficulty value="2"/>
<players>
	<player control="human" faction="goths" team="1"/>--0
	<player control="cpu"  faction="aztec" team="3"/>--1
	<player control="cpu" faction="goths" team="3"/>--2
	<player control="cpu" faction="goths" team="3"/>--3
</players>
<map value="forest_hunt"/>
<tileset value="desert"/>
<tech-tree value="vbros_pack_5"/>
	<default-resources value="true"/>	
	<default-units value="false"/>
	<default-victory-conditions value="false"/>
	<scripts>
		<startup>
			--disable AI
			disableAi(1)
			disableAi(2)
			disableAi(3)
			disableAi(0)

			--units

			createUnit('bull_pen', 0, startLocation(2))
			createUnit('kochi_camp', 0, startLocation(2))
			campUnit= lastCreatedUnit()
			createUnit('shadow_knight', 0, startLocation(2))	
			drUnit= lastCreatedUnit()
			createUnit('spider', 3, startLocation(0))
			createUnit('spider', 3, startLocation(0))
			createUnit('bull_pen', 3, startLocation(0))
			createUnit('sonrab', 3, startLocation(0))
			createUnit('sonrab', 3, startLocation(3))
			        sree2Unit= lastCreatedUnit()
			createUnit('bull_pen', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('bull', 3, startLocation(3))
			createUnit('pyramid', 1, startLocation(0))	
			mainUnit= lastCreatedUnit()
			setCameraPosition(unitPosition(drUnit))

			--create enemy attackers
			for i=1, 1 do
				createUnit('spider', 3, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(1))	
			end

			for i=1, 12 do
				createUnit('spider', 3, startLocation(1))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(3))	
			end

			for i=1, 8 do
				createUnit('spider', 3, startLocation(1))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(3))	
			end

			for i=1, 8 do
				createUnit('spider', 3, startLocation(0))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(3))	
			end

			for i=1, 1 do
				createUnit('spider', 3, startLocation(2))
				givePositionCommand(lastCreatedUnit(), 'move', startLocation(0))	
			end

			for i=1, 50 do
				createUnit('spider', 2, startLocation(0))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(1))	
			end

			--objectives
			objective='destroy_all_living_beings'
			showMessage('Brief1', 'brain')
			showMessage('Brief2', 'brain')
			showMessage('Brief3', 'brain')
			showMessage('Brief4', 'brain')
			showMessage('Brief5', 'brain')
			showMessage('Brief6', 'brain')
			showMessage('Brief7', 'brain')
			setDisplayText('lesson1')

		</startup>	
		
		<unitDied>
			--check for camp dying
			if lastDeadUnit()==campUnit then
				clearDisplayText()
				setPlayerAsWinner(1)
				setPlayerAsWinner(2)
				setPlayerAsWinner(3)				
				endGame()
			end

			--check for drake dying
			if lastDeadUnit()==drUnit then
				clearDisplayText()
				setPlayerAsWinner(1)
				setPlayerAsWinner(2)
				setPlayerAsWinner(3)				
				endGame()
			end
	
			--check for first village destroyed
			if lastDeadUnit()==mainUnit then	
		
				
				--create next village
			createUnit('priest', 2, startLocation(0))	
			createUnit('buzau', 2, startLocation(0))
			createUnit('bull', 2, startLocation(0))
			createUnit('spider', 3, startLocation(0))
			createUnit('forest_golem', 1, startLocation(0))	
			createUnit('pyramid', 1, startLocation(0))	
			        pyUnit= lastCreatedUnit()

			for i=1, 9 do
				createUnit('spider', 3, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(1))	
			end

			for i=1, 9 do
				createUnit('spider', 3, startLocation(1))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(3))	
			end


				--change objective
				objective='destroy_all_things'
				setDisplayText('lesson1')				
			end
	
			--check for first village destroyed
			if lastDeadUnit()==pyUnit then	
		
				
				--create next village
			createUnit('torch', 2, startLocation(1))
			deathUnit= lastCreatedUnit()

			for i=1, 10 do
				createUnit('spider', 3, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(1))	
			end

			for i=1, 2 do
				createUnit('spider', 2, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(0))	
			end

				--change objective
				objective='destroy_all_things'
			showMessage('Brief9', 'brain')
				setDisplayText('lesson1')				
			end

			--check for first village destroyed
			if lastDeadUnit()==deathUnit then	
		
				
				--create next village
			createUnit('sonrab', 0, startLocation(2))
			createUnit('servant', 0, startLocation(2))

				--create enemy village
			createUnit('sonrab', 2, startLocation(0))
			createUnit('bull_pen', 3, startLocation(0))
			createUnit('bull', 3, startLocation(0))
			createUnit('bull', 3, startLocation(0))
			createUnit('bull', 3, startLocation(0))
			createUnit('priest', 2, startLocation(0))
			createUnit('bull_pen', 2, startLocation(0))
			createUnit('sonrab', 3, startLocation(0))	
			        sreeUnit= lastCreatedUnit()

			for i=1, 12 do
				createUnit('spider', 3, startLocation(1))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(3))	
			end

			for i=1, 12 do
				createUnit('spider', 3, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(2))	
			end

			for i=1, 1 do
				createUnit('spider', 2, startLocation(3))
				givePositionCommand(lastCreatedUnit(), 'attack', startLocation(0))	
			end

				--change objective
				objective='destroy_all_things'
			showMessage('Brief8', 'brain')
				setDisplayText('lesson1')				
			end

			--check for last village destroyed
			if lastDeadUnit()==sreeUnit then
				clearDisplayText()
				setPlayerAsWinner(0)			
				endGame()
			end

			--check for last village destroyed
			if lastDeadUnit()==sree2Unit then
				clearDisplayText()
				setPlayerAsWinner(0)			
				endGame()
			end

			
		</unitDied>
	</scripts>		
</scenario>
