scripttable.NextLevelTrigger=function()
	TeleportToLevel("level9",1)
end

scripttable.TeleporterDoorTrigger=function()
	ForeachNamedObject("TeleporterDoor",function(o) o:Unlock() end)
end

scripttable.BossTrigger=function()
	ForeachNamedObject("BossLights",function(o) o:SetFrame(0) end)
	ForeachNamedObject("BossDoors",function(o) o:Lock() end)
	ForeachNamedObject("Boss",function(o) o:SetPosition(o:GetStartPos()) end)

	local pl=player.GetPlayer()
	pl:SetStartPos(scripttable.TeleportDest[1]:GetPosition())
	
	scripttable.BossTrigger=function() end
	while #scripttable.Boss>0 do
		Wait(0.5)
	end

	ForeachNamedObject("BossLights",function(o) o:SetFrame(1) end)
	ForeachNamedObject("BossDoors",function(o) o:Unlock() end)
end


scripttable.LevelStart=function()
	ForeachNamedObject("LargeSpawners",function(o) o:SetRange(8) end)
	ForeachNamedObject("BossLights",function(o) o:SetFrame(1) end)
	ForeachNamedObject("Boss",function(o) o:SetPosition(10000,10000) end)
	ForeachNamedObject("TeleporterDoor",function(o) o:Lock() end)
	StandardIntro()
end

scripttable.OpenDoorSwitch=function()
	ForeachNamedObject("BigDoor",function(o) o:Delete() end)
	ForeachNamedObject("DoorLights",function(o) o:SetFrame(1) end)
	
	local ch=PlaySound("suur_uks",1)
	Wait(0.2)
	for i=0,10000 do
		if not ChannelIsPlaying(ch) then
			StopChannel(ch)
			break
		end
		Wait(1/30)
		if i<30*4.6 then
			ShakeScreen(0.2)
		end
	end
	ShowSmallMessage("BLAST DOORS OPENED")
end
