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

scripttable.SecretLevelTrigger=function()
	TeleportToLevel("level5",1)
end

scripttable.TeleporterText=function()
	ShowMessage([[Double-range teleport to facility sector V
...note by Transport protocol #2...
I have installed an additional teleporter 
for jumping straght to the 5th level of the facility.
Device installed due to increased shipments of necrotic
tissue. Please do not spill necrotic tissue on the floor. 
Thank you, and have a nice day.]])
end

scripttable.LevelStart=function()
	ForeachNamedObject("SecretPipes",function(v) v:SetPosition(10000,10000) end)
	StandardIntro()
end

scripttable.PipeTrigger=function()
	Wait(2.5)
	ForeachNamedObject("SecretPipes",function(v) v:SetPosition(v:GetStartPos()) end)
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

scripttable.BossInitTrigger=function()
	ForeachNamedObject("BossDoorLight",function(v) v:SetFrame(1) end)
	ForeachNamedObject("SecretBoss",function(v) 
										v:SetPosition(10000,10000)
									end)
	
end

scripttable.BossStartTrigger=function()
	ForeachNamedObject("BossDoors",function(v) v:Lock() end)
	ForeachNamedObject("BossDoorLight",function(v) v:SetFrame(0) end)
	ForeachNamedObject("SecretBoss",function(v) v:SetPosition(v:GetStartPos()) end)
	while true do
		if #scripttable.SecretBoss==2 and not scripttable.spawned then
			ForeachNamedObject("BossZombieSpawner",function(v) 
				local x,y=v:GetPosition()
				local a=v:GetAngle(0)
				CreateZSpawner(x,y,a,15)
				scripttable.spawned=true
			end)
		end
		Wait(1/3)
		if #scripttable.SecretBoss==0 then
			ForeachNamedObject("BossDoors",function(v) v:Unlock() end)
			ForeachNamedObject("BossDoorLight",function(v) v:SetFrame(1) end)
			break
		end
	end
	
end