<?xml version="1.0" standalone="yes" ?> 
<scenario>
	<difficulty value="3"/>
	<players>
		<!--Players-->
		<player control="human" faction="tech" team="1"/>000
		<player control="cpu" faction="tech" team="1"/>1111
		<player control="cpu" faction="tech" team="1"/>2222
		<!--CPU-->
		<player control="cpu" faction="tech" team="1"/>	3333
		<player control="cpu" faction="tech" team="2"/>4444 
		<player control="cpu" faction="tech" team="2"/>5555
		<player control="cpu-ultra" faction="bee" team="2"/>6666 (bees)
		<player control="cpu" faction="tech" team="2"/>	7777
	</players>
	<map value="map3beta1"/>
	<tileset value="stranded2"/>
	<tech-tree value="stranded"/>
	<default-resources value="false"/>
	<default-units value="false"/>
	<fog-of-war value="true"/>
	<default-victory-conditions value="false"/>
	<scripts>
		<global>
		kiwi_players = {}
		kiwi_count = 0

		af_players = {}
		af_count = 0

		crab_players = {}
		crab_count = 0
		</global>
		<startup>

			--disableSpeedChange()
			setAttackWarningsEnabled(0)
			showMessage('m0', 'intro')
			showMessage('m1', 'intro')
			showMessage('m2', 'you')
			showMessage('m3', 'you')
			showMessage('m4', 'intro')
			setDisplayText('ob1')
					togglePauseGame(1);

			objective='objective_shelter'

			monsters='null'
			monsters2='null'
			monsters3='null'
			monsters4='null'
			monstershealth='null'

			skeleton1='null'
			skeleton2='null'

			disableConsume(1)
			disableConsume(2)
			disableConsume(3)
			disableConsume(4)
			disableConsume(5)
			disableConsume(6)
			disableConsume(7)
			disableAi(7)
			disableAi(4)

			createUnit('you', 0, {61, 489})
			you= lastCreatedUnit()


			<!--TEMP>
			createUnit('small_wooden_house', 0, {66, 486})
			createUnit('large_wooden_house', 0, {66, 486})
			createUnit('furnace', 0, {66, 486})
				objective='objective_iron_chest'
			createUnit('crab', 0, {66, 486})
			crab01= lastCreatedUnit()
			createUnit('advanced_defence_tower', 0, {66, 486})
			giveResource('wood', 0, 1000); 
			giveResource('stone', 0, 1000); 
			giveResource('iron', 0, 1000); 
			giveResource('furs', 0, 100); 
			createUnit('simple_defence_tower', 0, {66, 486})
			<TEMP-->

			setCameraPosition(unitPosition(you))

			createUnit('wooden_chest', 0, {67, 481})

			createUnit('wreck', 1, {62, 492})
			createUnit('wooden_chest', 1, {67, 493})
			createUnit('wooden_chest', 2, {56, 488})

			giveResource('food', 0, 1000); 
			giveResource('water', 0, 1000); 
			giveResource('furs', 0, 1); 


			createUnit('water_source', 7, {82, 442})
			water= lastCreatedUnit()


                        registerDayNightEvent()

			
		</startup>

                <unitTriggerEvent>

                        if hive == lastUnitTriggerEventUnit() then
				if hivehealth == 'full' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 900 then
							print ('Monster 7 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							hivehealth='half'
			playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/wreck/sounds/wood1.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee1.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee2.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee3.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee1.wav')
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})

		        	                end
					end

				elseif hivehealth == 'half' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 400 then
							print ('Monster 6 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							hivehealth='less'
			playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/wreck/sounds/wood1.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee1.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee2.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee3.wav')
			playStaticSound('{SCENARIOPATH}/stranded/factions/bee/units/bee/sounds/bee1.wav')

			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})
			createUnitNoSpacing('bee', 6, {191, 468})

						end
					end

                	        end
                       end


                        if fboss == lastUnitTriggerEventUnit() then
				if fbosshealth == 'full' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 2200 then
							print ('Monster 7 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							fbosshealth='half'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/field_creature/sounds/die.wav')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')
		                			--unregisterUnitTriggerEvent(fboss)

		        	                end
					end

				elseif fbosshealth == 'half' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 1100 then
							print ('Monster 6 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							fbosshealth='less'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/field_creature/sounds/die.wav')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')
							giveProductionCommand(fboss, 'wheat_monster')

						end
					end

                	        end
                       end
			<!---->


                        if wo == lastUnitTriggerEventUnit() then
				if monstershealth == '7' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 7000 then
							print ('Monster 7 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							monstershealth='6'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health70.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

		        	                end
					end

				elseif monstershealth == '6' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 6000 then
							print ('Monster 6 ' .. getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()))
							monstershealth='5'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health80.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

				elseif monstershealth == '5' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 5000 then
							monstershealth='4'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health60.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

				elseif monstershealth == '4' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 4000 then
							monstershealth='3'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health90.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

				elseif monstershealth == '3' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 3000 then
							monstershealth='2'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health80.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

				elseif monstershealth == '2' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 2000 then
							monstershealth='1'
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health70.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

				elseif monstershealth == '1' then
					if lastUnitTriggerEventType() == 1 then -- hp changed
						if getUnitProperty(lastUnitTriggerEventUnit(),lastUnitTriggerEventType()) &lt;= 1000 then
							playStaticSound('{SCENARIOPATH}/stranded/factions/tech/units/monster_king/sounds/health60.wav')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
							giveProductionCommand(wo, 'monster')
		                			--unregisterUnitTriggerEvent(wo)

						end
					end

                	        end
				--registerUnitTriggerEvent(wo)
                       end

                </unitTriggerEvent>

	        <dayNightTriggerEvent>
			print('daynight toggle isnight = ' .. getIsNightTime() .. ' monsters = ' .. monsters)
			if monsters=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
						createUnit('monster', 7, {77, 360})
							z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							z2= lastCreatedUnit()
							giveAttackCommand(z, you)
							giveAttackCommand(z2, you)
					elseif rtime == 2 then
						createUnit('monster', 7, {118, 354})
							z3= lastCreatedUnit()
							giveAttackCommand(z3, you)
					elseif rtime == 3 then
						createUnit('monster', 7, {123, 355})
							z= lastCreatedUnit()
							giveAttackCommand(z, you)
					elseif rtime == 4 then
						createUnit('monster', 7, {123, 355})
							z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							z2= lastCreatedUnit()
						createUnit('monster', 7, {113, 357})
							z3= lastCreatedUnit()
							giveAttackCommand(z, you)
							giveAttackCommand(z2, you)
							giveAttackCommand(z3, you)
					end
				end

			print('daynight toggle isnight = ' .. getIsNightTime() .. ' monsters2 = ' .. monsters2)
			if monsters2=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
						createUnit('monster', 7, {77, 360})
							a6z6= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a6z2= lastCreatedUnit()
							giveAttackCommand(a6z6, you)
							giveAttackCommand(a6z2, you)

						createUnit('monster', 7, {112, 354})
							a6z01= lastCreatedUnit()
							giveAttackCommand(a6z01, defence)

						createUnit('monster', 7, {112, 354})
							a6z02= lastCreatedUnit()
							giveAttackCommand(a6z02, defence)

					elseif rtime == 2 then
						createUnit('monster', 7, {118, 354})
							a7z3= lastCreatedUnit()
						createUnit('monster', 7, {118, 354})
							a7z4= lastCreatedUnit()
						createUnit('monster', 7, {118, 354})
							a7z5= lastCreatedUnit()
							giveAttackCommand(a7z3, you)
							giveAttackCommand(a7z4, you)
							giveAttackCommand(a7z5, you)

						createUnit('monster', 7, {112, 354})
							a7z01= lastCreatedUnit()
							giveAttackCommand(a7z01, defence)

						createUnit('monster', 7, {112, 354})
							a7z02= lastCreatedUnit()
							giveAttackCommand(a7z02, defence)

						createUnit('monster', 7, {123, 355})
							a7z03= lastCreatedUnit()
							giveAttackCommand(a7z03, defence)

					elseif rtime == 3 then
						createUnit('monster', 7, {123, 355})
							a7z= lastCreatedUnit()
							giveAttackCommand(a7z, you)

						createUnit('monster', 7, {112, 354})
							a7z02= lastCreatedUnit()
							giveAttackCommand(a7z02, defence)

					elseif rtime == 4 then
						createUnit('monster', 7, {123, 355})
							a8z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a8z2= lastCreatedUnit()
						createUnit('monster', 7, {113, 357})
							a8z3= lastCreatedUnit()
							giveAttackCommand(a8z, you)
							giveAttackCommand(a8z2, you)
							giveAttackCommand(a8z3, you)

						createUnit('monster', 7, {112, 354})
							a8z01= lastCreatedUnit()
							giveAttackCommand(a8z01, defence)

						createUnit('monster', 7, {112, 354})
							a8z02= lastCreatedUnit()
							giveAttackCommand(a8z02, defence)

					end
				end

			if monsters3=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
						createUnit('monster', 7, {77, 360})
							a5z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a5z2= lastCreatedUnit()
							giveAttackCommand(a5z, house2)
							giveAttackCommand(a5z2, you)
					elseif rtime == 2 then
						createUnit('monster', 7, {118, 354})
							a5z3= lastCreatedUnit()
							giveAttackCommand(a5z3, you)
					elseif rtime == 3 then
						createUnit('monster', 7, {123, 355})
							a5z= lastCreatedUnit()
							giveAttackCommand(a5z, house2)
					elseif rtime == 4 then
						createUnit('monster', 7, {123, 355})
							a4z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a4z2= lastCreatedUnit()
						createUnit('monster', 7, {113, 357})
							a4z3= lastCreatedUnit()
							giveAttackCommand(a4z, you)
							giveAttackCommand(a4z2, house2)
							giveAttackCommand(a4z3, house2)
					end
				end

			if monsters4=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
						createUnit('monster', 7, {77, 360})
							a3z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a3z2= lastCreatedUnit()
							giveAttackCommand(a3z, you)
							giveAttackCommand(a3z2, you)

						createUnit('monster', 7, {112, 354})
							aaz01= lastCreatedUnit()
							giveAttackCommand(aaz01, defence)

						createUnit('monster', 7, {112, 354})
							a3z02= lastCreatedUnit()
							giveAttackCommand(a3z02, defence)

					elseif rtime == 2 then
						createUnit('monster', 7, {118, 354})
							a2z3= lastCreatedUnit()
						createUnit('monster', 7, {118, 354})
							a2z4= lastCreatedUnit()
						createUnit('monster', 7, {118, 354})
							a2z5= lastCreatedUnit()
							giveAttackCommand(a2z3, you)
							giveAttackCommand(a2z4, you)
							giveAttackCommand(a2z5, you)

						createUnit('monster', 7, {112, 354})
							a2z01= lastCreatedUnit()
							giveAttackCommand(a2z01, defence)

						createUnit('monster', 7, {112, 354})
							a2z02= lastCreatedUnit()
							giveAttackCommand(a2z02, defence)

						createUnit('monster', 7, {123, 355})
							az03= lastCreatedUnit()
							giveAttackCommand(az03, defence)

					elseif rtime == 3 then
						createUnit('monster', 7, {123, 355})
							a1z= lastCreatedUnit()
							giveAttackCommand(a1z, you)

						createUnit('monster', 7, {112, 354})
							a1z02= lastCreatedUnit()
							giveAttackCommand(a1z02, defence2)

					elseif rtime == 4 then
						createUnit('monster', 7, {123, 355})
							a0z= lastCreatedUnit()
						createUnit('monster', 7, {112, 354})
							a0z2= lastCreatedUnit()
						createUnit('monster', 7, {113, 357})
							a0z3= lastCreatedUnit()
						createUnit('monster', 7, {113, 357})
							a0z4= lastCreatedUnit()
							giveAttackCommand(a0z, you)
							giveAttackCommand(a0z2, you)
							giveAttackCommand(a0z3, you)
							giveAttackCommand(a0z4, you)
						createUnit('monster', 7, {112, 354})
							az001= lastCreatedUnit()
							giveAttackCommand(az001, defence2)
						createUnit('monster', 7, {112, 354})
							az002= lastCreatedUnit()
							giveAttackCommand(az002, defence2)
						createUnit('monster', 7, {112, 354})
							az003= lastCreatedUnit()
							giveAttackCommand(az003, defence2)

					end
				end

			if skeleton1=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 2)
					if rtime == 1 then
							createUnit('skeleton_', 7, {445, 283})
							skelly1= lastCreatedUnit()
							giveAttackCommand(skelly1, you)

							createUnit('skeleton_', 7, {445, 283})


					elseif rtime == 2 then
							createUnit('skeleton_', 7, {445, 283})
							skelly1= lastCreatedUnit()
							giveAttackCommand(skelly1, you)
							createUnit('skeleton_', 7, {445, 283})
							skelly2= lastCreatedUnit()
							giveAttackCommand(skelly2, defence)


					end
				end

			if skeleton2=='start' and getIsNightTime() == 1 then

					math.randomseed(os.time())
					rtime = math.random(1, 2)
					if rtime == 1 then
							createUnit('skeleton_', 7, {445, 283})
							skelly3= lastCreatedUnit()
							giveAttackCommand(skelly3, stonetower1)

							createUnit('skeleton_', 7, {445, 283})
							skelly4= lastCreatedUnit()
							giveAttackCommand(skelly4, stonetower1)

					elseif rtime == 2 then
							createUnit('skeleton_', 7, {445, 283})
							skelly5= lastCreatedUnit()
							giveAttackCommand(skelly5, you)


					end
				end

                </dayNightTriggerEvent>

		<unitCreatedOfType type="shelter">
			if objective=='objective_shelter' and unitCountOfType(0, 'shelter')>=1 then

			showMessage('m1p1', 'you')
			setDisplayText('ob2')

    			 cell_event_water = registerCellTriggerEventForUnitToUnit(you,water)

			--objective='objective_storage'

			end		
		</unitCreatedOfType>

		<unitCreatedOfType type="large_wooden_chest">
			if objective=='objective_large_wooden_chest' and unitCountOfType(0, 'large_wooden_chest')>=1 then

			showMessage('m1p6', 'message')
			setDisplayText('ob5')

			objective='objective_stone1'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="stone_chest">
			if objective=='objective_stone_chest' and unitCountOfType(0, 'stone_chest')>=1 then

			showMessage('m1p8', 'you')
			showMessage('m1p9', 'you')
			setDisplayText('ob7')

			objective='objective_campfire'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="campfire">
			if objective=='objective_campfire' and unitCountOfType(0, 'campfire')>=1 then

			showMessage('m1p10', 'you')
			showMessage('m2p1', 'you')
			setDisplayText('ob8')

			objective='objective_large_stone_chest'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="large_stone_chest">
			if objective=='objective_large_stone_chest' and unitCountOfType(0, 'large_stone_chest')>=1 then

				showMessage('m2p2', 'you')
				showMessage('m2p3', 'you')
				setDisplayText('ob9')

				objective='objective_small_wooden_house'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="small_wooden_house">
			if objective=='objective_small_wooden_house' and unitCountOfType(0, 'small_wooden_house')>=1 then

				showMessage('m2p4', 'you')
				showMessage('m2p5', 'you')
				setDisplayText('ob10')

				objective='objective_flowers'
				monsters='start'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="flower_patch">
			if objective=='objective_flowers' and unitCountOfType(0, 'flower_patch')>=4 then

				showMessage('m2p6', 'you')
				setDisplayText('ob11')

				objective='objective_well'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="small_well">
			if objective=='objective_well' and unitCountOfType(0, 'small_well')>=1 then

				showMessage('m2p7', 'you')
				setDisplayText('ob12')

				objective='objective_iron_ore'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="furnace">
			if objective=='objective_furnace' and unitCountOfType(0, 'furnace')>=1 then

				showMessage('m2p9', 'you')
				setDisplayText('ob14')

				objective='objective_iron_chest'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="iron_chest">
			if objective=='objective_iron_chest' and unitCountOfType(0, 'iron_chest')>=1 then

				showMessage('m2p10', 'you')
				setDisplayText('ob15')

				objective='objective_simple_defence_tower'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="simple_defence_tower">
			if objective=='objective_simple_defence_tower' and unitCountOfType(0, 'simple_defence_tower')>=1 then


			defence= lastCreatedUnit()
				showMessage('m3p1', 'you')
				showMessage('m3p2', 'you')
				setDisplayText('ob16')

				monsters2='start'
				objective='objective_large_wooden_house'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="large_wooden_house">
			if objective=='objective_large_wooden_house' and unitCountOfType(0, 'large_wooden_house')>=1 then


			house2= lastCreatedUnit()
			monsters3='start'
				showMessage('m3p3', 'you')
				setDisplayText('ob17')

				objective='objective_wooden_walls'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="wooden_wall">
			if objective=='objective_wooden_walls' and unitCountOfType(0, 'wooden_wall')>=5 then

				showMessage('m3p4', 'you')
				setDisplayText('ob18')

				objective='objective_wooden_gate'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="wooden_gate">
			if objective=='objective_wooden_gate' and unitCountOfType(0, 'wooden_gate')>=1 then

				showMessage('m3p5', 'you')
				setDisplayText('ob19')

				objective='objective_advanced_defence_tower'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="advanced_defence_tower">
			if objective=='objective_advanced_defence_tower' and unitCountOfType(0, 'advanced_defence_tower')>=1 then

				defence2= lastCreatedUnit()
				showMessage('m3p52', 'you')
				setDisplayText('ob20')
				monsters4='start'

				objective='objective_wheat_garden'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="wheat_garden">
			if objective=='objective_wheat_garden' and unitCountOfType(0, 'wheat_garden')>=1 then

				showMessage('m3p6', 'you')
				showMessage('m3p7', 'you')
				setDisplayText('ob21')

				objective='objective_shack'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="wooden_shack">
			if objective=='objective_shack' and unitCountOfType(0, 'wooden_shack')>=1 then

				showMessage('m3p8', 'you')
				setDisplayText('ob22')

				objective='objective_trap'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="small_animal_trap">
			if objective=='objective_trap' and unitCountOfType(0, 'small_animal_trap')>=2 then

				showMessage('m3p9', 'you')
				showMessage('m3p10', 'you')
				setDisplayText('ob23')

				objective='objective_explore1'

			createUnit('dog_', 4, {55, 284})
			dog= lastCreatedUnit()

    			 cell_event_dog = registerCellTriggerEventForUnitToUnit(you,dog)


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="workbench">
			if objective=='objective_craft' and unitCountOfType(0, 'workbench')>=1 then

				showMessage('m4p4', 'you')
				setDisplayText('ob25')

				objective='objective_craftknife'


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="knife">
			if objective=='objective_craftknife' and unitCountOfType(0, 'knife')>=1 then

				showMessage('m4p5', 'you')
				setDisplayText('ob26')

				objective='objective_beach'

			createUnit('_', 7, {424, 282})
			camp= lastCreatedUnit()

    			 cell_event_7 = registerCellTriggerEventForUnitToUnit(you,camp)


			end	
	
		</unitCreatedOfType>

		<unitCreatedOfType type="simple_stone_defence_tower">
			if objective=='objective_stonetower' and unitCountOfType(0, 'simple_stone_defence_tower')>=1 then

			stonetower1= lastCreatedUnit()

			skeleton2='start'

				showMessage('m4p8', 'you')
			showMessage('end1', 'game')
			showMessage('end2', 'game')
				setDisplayText('obip')

				objective='objective_dmine'


			end	
	
		</unitCreatedOfType>

		<resourceHarvested>

			if objective=='objective_stone1' and resourceAmount('stone', 0)>=25 then

				showMessage('m1p7', 'message')
				setDisplayText('ob6')
				objective='objective_stone_chest'

			end

			if objective=='objective_iron_ore' and resourceAmount('iron_ore', 0)>=100 then

				showMessage('m2p8', 'message')
				setDisplayText('ob13')
				objective='objective_furnace'

			end

		</resourceHarvested>


		
		<unitCreated>					
		</unitCreated>

		<cellTriggerEvent> 

		       if triggeredCellEventId() == cell_event_7 then 
 		         unregisterCellTriggerEvent(cell_event_7)

			showMessage('m4p6', 'you')
			showMessage('m4p7', 'you')

			setDisplayText('ob27')

			createUnit('broken_tent', 1, {445, 283})
			createUnit('skeleton', 1, {442, 286})
			createUnitNoSpacing('wooden_wall', 1, {447, 288})
			createUnitNoSpacing('wooden_wall', 1, {445, 288})
			createUnitNoSpacing('wooden_wall', 1, {443, 288})
			createUnitNoSpacing('broken_wooden_wall', 1, {441, 288})

			skeleton1='start'

			objective='objective_stonetower'

		       end

		       if triggeredCellEventId() == cell_event_dog then 
 		         unregisterCellTriggerEvent(cell_event_dog)

			showMessage('m4p1', 'you')
			showMessage('m4p2', 'you')
			showMessage('m4p3', 'game')
			setDisplayText('ob24')

			objective='objective_craft'

			destroyUnit(dog);

			createUnit('dog', 0, {55, 284})
			dog2= lastCreatedUnit()

		       end


		       if triggeredCellEventId() == cell_event_6 then 
 		         unregisterCellTriggerEvent(cell_event_6)

			showMessage('m5p3', 'you')
			showMessage('m5p4', 'you')
			showMessage('m5p5', 'you')
			showMessage('m5p6', 'you')
			setDisplayText('fire')

			objective='objective_campfire'

		       end

		       if triggeredCellEventId() == cell_event_5 then 
 		         unregisterCellTriggerEvent(cell_event_5)

			createUnit('cave', 2, {124, 80})
			cave= lastCreatedUnit()

			showMessage('p5m2', 'you')
			setDisplayText('look')

    			 cell_event_6 = registerCellTriggerEventForUnitToUnit(you,cave)

		       end


		       if triggeredCellEventId() == cell_event_water then 
			giveResource('water', 0, 1000); 
			addConsoleText('atig')

			createUnit('_', 0, {82, 442})

			showMessage('m1p2', 'you')
			showMessage('m1p3', 'you')
			setDisplayText('ob3')
			giveResource('water', 0, 1000); 
			objective='objective_crab'

			createUnit('crab', 4, {64, 487})
			crab01= lastCreatedUnit()

			--objective='objective_large_wooden_chest'
					timer_event_water = startTimerEvent()
 		         unregisterCellTriggerEvent(cell_event_water)

		       end

		       if triggeredCellEventId() == cell_event_water2 then 
			giveResource('water', 0, 1000); 
			addConsoleText('atig')
 		         unregisterCellTriggerEvent(cell_event_water2)

		       end

		       if triggeredCellEventId() == cell_event_1 then 

			showMessage('p2m1', 'message')
			showMessage('p2m2', 'message')
			showMessage('p2m3', 'message')
			showMessage('p2m4', 'message')
			setDisplayText('get_food')

			createUnit('chimpanzee', 3, startLocation(0))
			chimp= lastCreatedUnit()

			setCameraPosition(unitPosition(chimp))
					togglePauseGame(1);

 		        unregisterCellTriggerEvent(cell_event_1)

		       end  

		       if triggeredCellEventId() == cell_event_2 then 

			showMessage('p3m2', 'message')
			showMessage('p3m3', 'message')
			setDisplayText('water')

    			 cell_event_3 = registerCellTriggerEventForUnitToUnit(you,water)

 		        unregisterCellTriggerEvent(cell_event_2)

		       end  

		       if triggeredCellEventId() == cell_event_3 then 

			addConsoleText('atig2')

    			 cell_event_4 = registerCellTriggerEventForUnitToUnit(you,survivor)

 		        unregisterCellTriggerEvent(cell_event_3)

		       end  

		       if triggeredCellEventId() == cell_event_4 then 

					togglePauseGame(1);

			destroyUnit(survivor);
			disableAi(3)

			createUnit('survivor_', 2, startLocation(3))
			survivor2= lastCreatedUnit()

			showMessage('p4m4', 'Sam')
			showMessage('p4m5', 'you')
			showMessage('p4m6', 'Sam')
			showMessage('p4m7', 'you')
			showMessage('p4m8', 'Sam')
			showMessage('p4m9', 'you')
			showMessage('p4m10', 'Sam')
			showMessage('p4m11', 'you')
			showMessage('p4m12', 'you')
			setDisplayText('big_storage')

			objective='objective_bigstorage'

			givePositionCommand(survivor2, 'move', startLocation(0))

 		        unregisterCellTriggerEvent(cell_event_4)

		       end  

		</cellTriggerEvent> 

		<timerTriggerEvent>

			if triggeredTimerEventId() == timer_event_hive then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 320 then

				createUnit('bee_hive', 6, {191, 468})
				hive= lastCreatedUnit()

			giveResource('zpollen', 6, 200); 

				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})

				hivehealth='full'
                        	registerUnitTriggerEvent(hive)

					stopTimerEvent(timer_event_hive)
				end
			end

			if triggeredTimerEventId() == timer_event1d then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 40 then

			createUnit('dog', 0, {66, 486})
			dog2= lastCreatedUnit()

			showMessage('dogrespawn', 'game')

					stopTimerEvent(timer_event1d)
				end
			end


			if triggeredTimerEventId() == timer_event_water then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 5 then
    			 cell_event_water2 = registerCellTriggerEventForUnitToUnit(you,water)

					stopTimerEvent(timer_event_water)
					timer_event_water = startTimerEvent()
				end
			end


			if triggeredTimerEventId() == timer_event1 then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 20 then

			createUnit('you', 0, {66, 486})
			you= lastCreatedUnit()

			giveResource('food', 0, 12); 
			giveResource('water', 0, 20); 

			showMessage('respawn', 'game')
			setCameraPosition(unitPosition(you))

					stopTimerEvent(timer_event1)
				end
			end

			if triggeredTimerEventId() == timer_eventwm1 then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 20 then

				createUnit('wheat_monster', 7, {180, 416})
				wm1= lastCreatedUnit()

					stopTimerEvent(timer_eventwm1)
				end
			end


			if triggeredTimerEventId() == timer_eventlion1 then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 20 then

					createUnit('large_lion', 7, {198, 283})
					lion1= lastCreatedUnit()

					createUnit('baby_lion', 7, {198, 283})
					blion4= lastCreatedUnit()

					stopTimerEvent(timer_eventlion1)
				end
			end

			if triggeredTimerEventId() == timer_eventwheatm then
				if timerEventSecondsElapsed(triggeredTimerEventId()) >= 20 then

				createUnit('wheat_monster', 7, {13, 253})
				wm7= lastCreatedUnit()

				createUnit('wheat_monster', 7, {5, 253})
				wm6= lastCreatedUnit()

				createUnit('wheat_monster', 7, {166, 180})
				wm5= lastCreatedUnit()
					stopTimerEvent(timer_eventwheatm)
				end
			end

		</timerTriggerEvent>  	
		
		<unitDied>

			if lastDeadUnit()==bear then

			showMessage('bear', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 20); 

				math.randomseed(os.time())
				rtime = math.random(1, 4)
				if rtime == 1 then
			createUnit('bear', 7, {440, 305})
			bear= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('bear', 7, {233, 427})
			bear= lastCreatedUnit()
				elseif rtime == 3 then
			createUnit('bear', 7, {184, 351})
			bear= lastCreatedUnit()
				elseif rtime == 4 then
			createUnit('bear', 7, {304, 273})
			bear= lastCreatedUnit()
				end

			end

			if lastDeadUnit()==deernew1 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 

				createUnit('deer', 7, {271, 399})
				deernew1= lastCreatedUnit()

		end

			if lastDeadUnit()==deernew2 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==rabbit01 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 

				createUnit('rabbit', 7, {259, 348})
				rabbit1= lastCreatedUnit()

			end

			if lastDeadUnit()==rabbit02 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 

				createUnit('rabbit', 7, {274, 402})
				rabbit2= lastCreatedUnit()

			end

			if lastDeadUnit()==rabbit1 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 

				createUnit('rabbit', 7, {258, 383})
				rabbit01= lastCreatedUnit()

			end

			if lastDeadUnit()==rabbit2 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 

				createUnit('rabbit', 7, {308, 368})
				rabbit02= lastCreatedUnit()

			end

			if lastDeadUnit()==rabbit3 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 
			end

			if lastDeadUnit()==rabbit4 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 
			end

			if lastDeadUnit()==rabbit5 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 
			end

			if lastDeadUnit()==rabbit6 then

				showMessage('rabbit', 'message')
					giveResource('furs', 0, 1); 
					giveResource('food', 0, 12); 
			end


			if lastDeadUnit()==fboss then

			showMessage('fboss1', 'you')
			showMessage('fboss2', 'message')
			giveResource('furs', 0, 50); 
			giveResource('diamond', 0, 2); 
		end

			for k,v in pairs(af_players) do
				if lastDeadUnit() == v then

					showMessage('articwolf', 'message')
					giveResource('food', 0, 10); 
					giveResource('furs', 0, 3); 

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
					elseif rtime == 2 then
			createUnit('artic_fox', 7, {30, 93})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
					elseif rtime == 3 then
			createUnit('artic_fox', 7, {102, 103})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
					elseif rtime == 4 then
			createUnit('artic_fox', 7, {43, 73})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {120, 28})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
					end
				end
			end

			if lastDeadUnit()==you then

				showMessage('die', 'game')
				timer_event1 = startTimerEvent()

			end

			if lastDeadUnit()==dog2 then

				showMessage('dogdie', 'game')
				timer_event1d = startTimerEvent()

			end

			if lastDeadUnit()==lion1 then

				showMessage('lion', 'message')
				timer_eventlion1 = startTimerEvent()
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 
			end

			if lastDeadUnit()==lion2 then

				showMessage('lion', 'message')
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 

			createUnit('large_lion', 7, {327, 376})
			lion3= lastCreatedUnit()

			end
			if lastDeadUnit()==lion3 then

				showMessage('lion', 'message')
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 
			end
			if lastDeadUnit()==lion4 then

				showMessage('lion', 'message')
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 
			end
			if lastDeadUnit()==lion5 then

				showMessage('lion', 'message')
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 
			end
			if lastDeadUnit()==lion6 then

				showMessage('lion', 'message')
					giveResource('furs', 0, 20); 
					giveResource('food', 0, 50); 
			end

			if lastDeadUnit()==blion1 then

				showMessage('blion', 'message')
					giveResource('furs', 0, 5); 
					giveResource('food', 0, 8); 

			createUnit('baby_lion', 7, {202, 283})
			blion1= lastCreatedUnit()

			end

			if lastDeadUnit()==blion2 then

				showMessage('blion', 'message')
					giveResource('furs', 0, 5); 
					giveResource('food', 0, 8);
			end

			if lastDeadUnit()==blion3 then

				showMessage('blion', 'message')
					giveResource('furs', 0, 5); 
					giveResource('food', 0, 8);
			end

			if lastDeadUnit()==blion4 then

				showMessage('blion', 'message')
					giveResource('furs', 0, 5); 
					giveResource('food', 0, 8);
			end

			if lastDeadUnit()==wm5 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 
				timer_eventwheatm = startTimerEvent()

			end

			if lastDeadUnit()==wm6 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==wm7 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==wm1 then

				showMessage('wheatmonster', 'message')
				timer_eventwm1 = startTimerEvent()
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==wm2 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==wm3 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==wm4 then

				showMessage('wheatmonster', 'message')
					giveResource('furs', 0, 10); 
					giveResource('wheat', 0, 50); 

			end

			if lastDeadUnit()==duck1 then

				showMessage('duck', 'message')
					giveResource('food', 0, 10); 

				math.randomseed(os.time())
				rtime = math.random(1, 4)
				if rtime == 1 then
				createUnit('duck', 7, {254, 300})
				duck1= lastCreatedUnit()
				elseif rtime == 2 then
				createUnit('duck', 7, {265, 313})
				duck1= lastCreatedUnit()
				elseif rtime == 3 then
				createUnit('duck', 7, {278, 298})
				duck1= lastCreatedUnit()
				elseif rtime == 4 then
				createUnit('duck', 7, {2283, 314})
				duck1= lastCreatedUnit()
				end

			end

			if lastDeadUnit()==duck2 then

				showMessage('duck', 'message')
					giveResource('food', 0, 10); 

			end

			if lastDeadUnit()==duck3 then

				showMessage('duck', 'message')
					giveResource('food', 0, 10); 

				createUnit('duck', 7, {151, 306})
				duck3= lastCreatedUnit()

				createUnit('duck', 7, {153, 313})
				duck5= lastCreatedUnit()

			end

			if lastDeadUnit()==duck4 then

				showMessage('duck', 'message')
					giveResource('food', 0, 10); 

			end

			if lastDeadUnit()==duck5 then

				showMessage('duck', 'message')
					giveResource('food', 0, 10); 

			end

			if lastDeadUnit()==hive then

				showMessage('hive', 'message')
					giveResource('food', 0, 200); 
					giveResource('gold', 0, 100); 

				timer_event_hive = startTimerEvent()

			end

			if lastDeadUnit()==crab01 then

			<!--Version1.1-->

				createUnit('bear', 7, {277, 403})
				bear= lastCreatedUnit()

				createUnit('rabbit', 7, {280, 343})
				rabbit1= lastCreatedUnit()
				createUnit('rabbit', 7, {276, 360})
				rabbit2= lastCreatedUnit()
				createUnit('rabbit', 7, {283, 364})
				rabbit3= lastCreatedUnit()
				createUnit('rabbit', 7, {290, 342})
				rabbit4= lastCreatedUnit()
				createUnit('rabbit', 7, {289, 352})
				rabbit5= lastCreatedUnit()
				createUnit('rabbit', 7, {287, 359})
				rabbit6= lastCreatedUnit()

				createUnit('duck', 7, {254, 296})
				duck1= lastCreatedUnit()

				createUnit('duck', 7, {265, 313})
				duck2= lastCreatedUnit()

				createUnit('duck', 7, {278, 298})
				duck3= lastCreatedUnit()

				createUnit('duck', 7, {283, 314})
				duck4= lastCreatedUnit()

				createUnit('bee_hive', 6, {191, 468})
				hive= lastCreatedUnit()

			giveResource('zpollen', 6, 200); 

				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})
				createUnit('bee', 6, {191, 468})

				hivehealth='full'
                        	registerUnitTriggerEvent(hive)

				createUnit('field_creature', 7, {310, 324})
				fboss= lastCreatedUnit()
				fbosshealth='full'
                        	registerUnitTriggerEvent(fboss)

			<!--Version1.1-->

			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {49, 73})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {22, 32})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {122, 28})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {166, 31})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {30, 93})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {102, 103})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {30, 93})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {102, 103})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {108, 71})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {49, 73})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {22, 32})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {122, 28})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {166, 31})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {30, 93})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {102, 103})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {30, 93})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()
			createUnit('artic_fox', 7, {102, 103})
				af_count=af_count+1
				af_players[af_count]= lastCreatedUnit()

				createUnit('baby_lion', 7, {202, 283})
				blion1= lastCreatedUnit()
				createUnit('baby_lion', 7, {222, 267})
				blion2= lastCreatedUnit()
				createUnit('baby_lion', 7, {203, 263})
				blion3= lastCreatedUnit()

				createUnit('large_lion', 7, {198, 283})
				lion1= lastCreatedUnit()
				createUnit('large_lion', 7, {207, 278})
				lion2= lastCreatedUnit()
				createUnit('large_lion', 7, {222, 269})
				lion3= lastCreatedUnit()
				createUnit('large_lion', 7, {201, 275})
				lion4= lastCreatedUnit()
				createUnit('large_lion', 7, {213, 286})
				lion5= lastCreatedUnit()
				createUnit('large_lion', 7, {208, 264})
				lion6= lastCreatedUnit()

				createUnit('monster_king', 7, {415, 377})
				wo= lastCreatedUnit()

				monstershealth='7'

                        	registerUnitTriggerEvent(wo)

				createUnit('wheat_monster', 7, {180, 416})
				wm1= lastCreatedUnit()

				createUnit('wheat_monster', 7, {68, 396})
				wm2= lastCreatedUnit()

				createUnit('wheat_monster', 7, {13, 253})
				wm3= lastCreatedUnit()

				createUnit('wheat_monster', 7, {5, 253})
				wm4= lastCreatedUnit()

				createUnit('wheat_monster', 7, {166, 180})
				wm5= lastCreatedUnit()

				showMessage('m1p4', 'you')
				showMessage('m1p5', 'you')
				setDisplayText('ob4')
				giveResource('food', 0, 1000); 
				objective='objective_large_wooden_chest'

				createUnit('large_turtle', 7, {72, 492})
				lt= lastCreatedUnit()

				createUnit('small_turtle', 7, {52, 482})
				st= lastCreatedUnit()

				createUnit('wolf', 7, {48, 448})
				wolf= lastCreatedUnit()
				createUnit('wolf', 7, {53, 461})
				wolf2= lastCreatedUnit()

				createUnit('chimpanzee', 7, {74, 471})
				chimp2= lastCreatedUnit()

				createUnit('kiwi', 7, {86, 467})
				kiwi_count=kiwi_count+1
				kiwi_players[kiwi_count] = lastCreatedUnit()
				createUnit('kiwi', 7, {66, 476})
				kiwi_count=kiwi_count+1
				kiwi_players[kiwi_count]= lastCreatedUnit()
				createUnit('kiwi', 7, {100, 442})
				kiwi_count=kiwi_count+1
				kiwi_players[kiwi_count]= lastCreatedUnit()
				createUnit('kiwi', 7, {81, 435})
				kiwi_count=kiwi_count+1
				kiwi_players[kiwi_count]= lastCreatedUnit()

				createUnit('crab', 7, {52, 483})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()
				createUnit('crab', 7, {82, 490})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()
				createUnit('crab', 7, {64, 484})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()

				createUnit('crab', 7, {96, 486})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()
				createUnit('crab', 7, {115, 487})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()
				createUnit('crab', 7, {103, 487})
				crab_count=crab_count+1
				crab_players[crab_count]= lastCreatedUnit()


				createUnit('deer', 7, {60, 464})
				deer= lastCreatedUnit()

				createUnit('deer', 7, {195, 365})
				deer01= lastCreatedUnit()

				createUnit('deer', 7, {195, 365})
				deer02= lastCreatedUnit()

				createUnit('deer', 7, {195, 365})
				deer03= lastCreatedUnit()

				createUnit('deer', 7, {195, 365})
				deer04= lastCreatedUnit()

				createUnit('deer', 7, {195, 365})
				deer05= lastCreatedUnit()

				createUnit('deer', 7, {282, 404})
				deernew1= lastCreatedUnit()

				createUnit('deer', 7, {303, 411})
				deernew2= lastCreatedUnit()


			end

			for k,v in pairs(kiwi_players) do
				if lastDeadUnit() == v then

					showMessage('kiwi', 'message')
					giveResource('food', 0, 8); 

					math.randomseed(os.time())
					rtime = math.random(1, 4)
					if rtime == 1 then
						createUnit('kiwi', 7, {81, 435})
						kiwi_count=kiwi_count+1						
						kiwi_players[kiwi_count] = lastCreatedUnit()
					elseif rtime == 2 then
						createUnit('kiwi', 7, {86, 467})
						kiwi_count=kiwi_count+1						
						kiwi_players[kiwi_count] = lastCreatedUnit()
					elseif rtime == 3 then
						createUnit('kiwi', 7, {66, 476})
						kiwi_count=kiwi_count+1						
						kiwi_players[kiwi_count] = lastCreatedUnit()
					elseif rtime == 4 then
						createUnit('kiwi', 7, {100, 442})
						kiwi_count=kiwi_count+1						
						kiwi_players[kiwi_count] = lastCreatedUnit()
					end
				end
			end

			for k,v in pairs(crab_players) do
				if lastDeadUnit() == v then

					showMessage('crab', 'message')
					giveResource('food', 0, 6); 

					math.randomseed(os.time())
					rtime = math.random(1, 12)
					if rtime == 1 then
						createUnit('crab', 7, {52, 483})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 2 then
						createUnit('crab', 7, {82, 490})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 3 then
						createUnit('crab', 7, {64, 484})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 4 then
						createUnit('crab', 7, {96, 486})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 5 then
						createUnit('crab', 7, {115, 487})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 6 then
						createUnit('crab', 7, {103, 487})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 7 then
						createUnit('crab', 7, {103, 487})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 8 then
						createUnit('crab', 7, {96, 486})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 9 then
						createUnit('crab', 7, {53, 483})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 10 then
						createUnit('crab', 7, {45, 474})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 11 then
						createUnit('crab', 7, {69, 489})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()
					elseif rtime == 12 then
						createUnit('crab', 7, {84, 491})
						crab_count=crab_count+1
						crab_players[crab_count]= lastCreatedUnit()

					end
				end
			end

			if lastDeadUnit()==chimp2 then

			showMessage('chimp', 'message')
			giveResource('food', 0, 20); 
			giveResource('furs', 0, 2);

				math.randomseed(os.time())
				rtime = math.random(1, 4)
				if rtime == 1 then
			createUnit('chimpanzee', 7, {74, 471})
			chimp2= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('chimpanzee', 7, {107, 479})
			chimp2= lastCreatedUnit()
				elseif rtime == 3 then
			createUnit('chimpanzee', 7, {57, 475})
			chimp2= lastCreatedUnit()
				elseif rtime == 4 then
			createUnit('chimpanzee', 7, {110, 458})
			chimp2= lastCreatedUnit()
				end
		end

			if lastDeadUnit()==deer01 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==deer02 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==deer03 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==deer04 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==deer05 then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 
		end

			if lastDeadUnit()==deer then

			showMessage('deer', 'message')
			giveResource('food', 0, 30); 
			giveResource('furs', 0, 8); 

				math.randomseed(os.time())
				rtime = math.random(1, 3)
				if rtime == 1 then
			createUnit('deer', 7, {88, 438})
					deer= lastCreatedUnit()
			createUnit('deer', 7, {141, 452})
					deer01= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('deer', 7, {60, 464})
					deer= lastCreatedUnit()
				elseif rtime == 3 then
			createUnit('deer', 7, {55, 445})
					deer= lastCreatedUnit()
				end
		end

			if lastDeadUnit()==wolf then

			showMessage('wolf', 'message')
			giveResource('food', 0, 10); 
			giveResource('furs', 0, 3);

				math.randomseed(os.time())
				rtime = math.random(1, 4)
				if rtime == 1 then
			createUnit('wolf', 7, {99, 433})
			wolf= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('wolf', 7, {55, 445})
			wolf= lastCreatedUnit()
				elseif rtime == 3 then
			createUnit('wolf', 7, {148, 458})
			wolf= lastCreatedUnit()
				elseif rtime == 4 then
			createUnit('wolf', 7, {53, 461})
			wolf= lastCreatedUnit()
				end
		end

			if lastDeadUnit()==wolf2 then

			showMessage('wolf', 'message')
			giveResource('food', 0, 10); 
			giveResource('furs', 0, 3);

				math.randomseed(os.time())
				rtime = math.random(1, 4)
				if rtime == 1 then
			createUnit('wolf', 7, {99, 433})
			wolf2= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('wolf', 7, {153, 461})
			wolf2= lastCreatedUnit()
				elseif rtime == 3 then
			createUnit('wolf', 7, {48, 188})
			wolf2= lastCreatedUnit()
				elseif rtime == 4 then
			createUnit('wolf', 7, {130, 461})
			wolf2= lastCreatedUnit()
				end
		end

			if lastDeadUnit()==st then

			showMessage('smallturtle', 'message')
			giveResource('food', 0, 10); 


				math.randomseed(os.time())
				rtime = math.random(1, 2)
				if rtime == 1 then
			createUnit('small_turtle', 7, {106, 484})
					st= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('small_turtle', 7, {52, 482})
					st= lastCreatedUnit()
				end
		end

			if lastDeadUnit()==lt then

			showMessage('largeturtle', 'message')
			giveResource('food', 0, 18); 


				math.randomseed(os.time())
				rtime = math.random(1, 2)
				if rtime == 1 then
			createUnit('large_turtle', 7, {82, 489})
					lt= lastCreatedUnit()
				elseif rtime == 2 then
			createUnit('large_turtle', 7, {45, 452})
					lt= lastCreatedUnit()
				end
		end

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