Index: data/trunk/scripts/vertical_scroller/vs1.lua
===================================================================
--- data/trunk/scripts/vertical_scroller/vs1.lua	(revision 4765)
+++ data/trunk/scripts/vertical_scroller/vs1.lua	(revision 4899)
@@ -2,305 +2,32 @@
 thisscript:addObject("SpaceShip", "Player")
 thisscript:addObject("CameraMan", "cameraManager")
+thisscript:addObjectAsName("GameWorld", "Mission 1", "gameWorld")
 
--- The Pirates
-thisscript:addObject("NPC", "Ragnar01")
---thisscript:addObject("NPC", "Ragnar02")
+triggerFadeOut = SpaceTrigger()
+triggerFadeOut:setScript("vs1.lua")
+triggerFadeOut:setFunction("fadeOut")
+triggerFadeOut:setRadius(250)
+triggerFadeOut:setTarget("Player")
+triggerFadeOut:setAbsCoor(3610, 116, -656)
+triggerFadeOut:setDebugDraw(true)
 
-thisscript:addObject("NPC", "Pirate01")
-thisscript:addObject("NPC", "Pirate02")
-thisscript:addObject("NPC", "Pirate03")
-thisscript:addObject("NPC", "Pirate53")
-thisscript:addObject("NPC", "Pirate54")
+triggerEndLevel = TimeTrigger()
+triggerEndLevel:setScript("vs1.lua")
+triggerEndLevel:setFunction("changeLevel")
+triggerEndLevel:setDelay(5)
 
-thisscript:addObject("NPC", "Pirate04")
-thisscript:addObject("NPC", "Pirate05")
-thisscript:addObject("NPC", "Pirate06")
-thisscript:addObject("NPC", "Pirate56")
-thisscript:addObject("NPC", "Pirate57")
+teststring = "asdf";
 
-thisscript:addObject("NPC", "Pirate07")
-thisscript:addObject("NPC", "Pirate08")
-thisscript:addObject("NPC", "Pirate09")
-thisscript:addObject("NPC", "Pirate59")
-thisscript:addObject("NPC", "Pirate49")
-thisscript:addObject("NPC", "Pirate79")
-
--- The Noxons
-thisscript:addObject("NPC", "Noxon01")
-thisscript:addObject("NPC", "Noxon02")
-thisscript:addObject("NPC", "Noxon03")
-thisscript:addObject("NPC", "Noxon04")
-thisscript:addObject("NPC", "Noxon05")
---thisscript:addObject("NPC", "Noxon06")
---thisscript:addObject("NPC", "Noxon07")
---thisscript:addObject("NPC", "Noxon08")
---thisscript:addObject("NPC", "Noxon09")
---thisscript:addObject("NPC", "Noxon10")
---thisscript:addObject("NPC", "Noxon11")
---thisscript:addObject("NPC", "Noxon12")
-
--- thisscript:addObjectAsName("GameWorld", "Mission 1", "gameWorld")
-
-triggerInit = TickTrigger()
-triggerInit:setScript("vs1.lua")
-triggerInit:setFunction("init")
-
--- Create the cutscene trigger
-triggerCutscene = SpaceTrigger()
-triggerCutscene:setScript("vs1.lua")
-triggerCutscene:setFunction("startSequence")
-triggerCutscene:setRadius(50)
-triggerCutscene:setTarget("Player")
-triggerCutscene:setAbsCoor(2300 , 0 , 0)
-triggerCutscene:setDebugDraw(false)
-
--- Create another cutscene trigger
-triggerCutscene02 = TickTrigger()
-triggerCutscene02:setScript("vs1.lua")
-triggerCutscene02:setFunction("switchToOtherPirate")
-
--- Create another cutscene trigger
-triggerCutscene03 = TickTrigger()
-triggerCutscene03:setScript("vs1.lua")
-triggerCutscene03:setFunction("surviver")
-
--- Create another cutscene trigger
-triggerCutscene04 = TickTrigger()
-triggerCutscene04:setScript("vs1.lua")
-triggerCutscene04:setFunction("onNoxons")
-
--- Create another cutscene trigger
-triggerCutscene05 = TickTrigger()
-triggerCutscene05:setScript("vs1.lua")
-triggerCutscene05:setFunction("changeFromNoxon")
-
-
--- Create another trigger
-triggerStop = SpaceTrigger()
-triggerStop:setScript("vs1.lua")
-triggerStop:setFunction("stopPlayer")
-triggerStop:setRadius(50)
-triggerStop:setTarget("Player")
-triggerStop:setAbsCoor(8000 , 0 , -2000)
-triggerStop:setDebugDraw(false)
-
--- Create the cool Ragnar trigger
-triggerRagnar = SpaceTrigger()
-triggerRagnar:setScript("vs1.lua")
-triggerRagnar:setFunction("startRagnar")
-triggerRagnar:setRadius(50)
-triggerRagnar:setTarget("Player")
-triggerRagnar:setAbsCoor(3600 , 0 , -15)
-triggerRagnar:setDebugDraw(false)
-
--- Create a great AI activater
---triggerAI01 = SpaceTrigger()
---triggerAI01:setScript("vs1.lua")
---triggerAI01:setFunction("activateGroup1")
---triggerAI01:setRadius(50)
---triggerAI01:setTarget("Player")
---triggerAI01:setAbsCoor(2600, 0, -10)
---triggerAI01:setDebugDraw(false)
---triggerAI01:setActiveOnCreation(false)
-
--- Create another great AI activater
---triggerAI02 = SpaceTrigger()
---triggerAI02:setScript("vs1.lua")
---triggerAI02:setFunction("activateGroup2")
---triggerAI02:setRadius(50)
---triggerAI02:setTarget("Player")
---triggerAI02:setAbsCoor(4900, 0, -45)
---triggerAI02:setDebugDraw(false)
-
--- Create another great AI activater
---triggerAI03 = SpaceTrigger()
---triggerAI03:setScript("vs1.lua")
---triggerAI03:setFunction("activateGroup3")
---triggerAI03:setRadius(50)
---triggerAI03:setTarget("Player")
---triggerAI03:setAbsCoor(5850, 0, -170)
---triggerAI03:setDebugDraw(false)
-
--- Create another great AI activater
---triggerAI04 = SpaceTrigger()
---triggerAI04:setScript("vs1.lua")
---triggerAI04:setFunction("startRagnar2")
---triggerAI04:setRadius(50)
---triggerAI04:setTarget("Player")
---triggerAI04:setAbsCoor(6500, 0, -350)
---triggerAI04:setDebugDraw(false)
-
-
-
--- Global Variables
-counter = 0
-cutsceneRunning = false
-cutscene2Running = false
-cutsceneEnd = false
-cutscene2End = false
-bossFight = false
-bossFightEnd = false
-time = 0
-time2 = 0
-
--- init function
-function init(timestep)
--- cameraManager:setCam("GameWorldCamera")
-cameraManager:attachCamera("CameraOne", "NPC", "Pirate01")
-cameraManager:attachCamera("CameraTwo", "NPC", "Noxon01")
-cameraManager:setRelCoor("CameraOne", 10, 8 , -5)
-cameraManager:setRelCoor("CameraTwo", 30, 15 , -10)
-
-
-Ragnar01:pause(true)
-
-return true
+function fadeOut(timestep)
+  cameraManager:toggleFade()
+  print(teststring)
+  triggerEndLevel:start()
+  return true
 end
 
-function startSequence(timestep)
-
-Player:pause(true)
-cameraManager:setCam("CameraOne")
-cutsceneRunning = true
-return true
+function changeLevel(timestep)
+  print("changelvl now\n\n\n\n\n\n")
+  gameWorld:setNextStoryName("Moonstation")
+  gameWorld:stop()
+  return true
 end
-
-function switchToOtherPirate(timestep)
-
-if cutsceneRunning then
-counter = counter + timestep
-end
-
-if counter > 5 and counter < 6 then
-cameraManager:attachCamera("CameraOne", "NPC", "Pirate03")
-cameraManager:setRelCoorSoft("CameraOne", 10, 8 , 5, 6)
-
-end
-
-if counter > 11 then
-cutsceneEnd = true
-Player:pause(false)
-cameraManager:setCam("GameWorldCamera")
-end
-
-return cutsceneEnd
-end
-
-
-function startRagnar(timestep)
-
-Ragnar01:pause(false)
-return true
-end
-
-
---function activateGroup1(timestep)
-
---Pirate01:setAI(true)
---Pirate02:setAI(true)
---Pirate03:setAI(true)
---Pirate53:setAI(true)
---Pirate54:setAI(true)
-
---return true
---end
-
-
---function activateGroup2(timestep)
-
---Pirate04:setAI(true)
---Pirate05:setAI(true)
---Pirate06:setAI(true)
---Pirate56:setAI(true)
---Pirate57:setAI(true)
-
---return true
---end
-
-
---function activateGroup3(timestep)
-
---Pirate07:setAI(true)
---Pirate08:setAI(true)
---Pirate09:setAI(true)
---Pirate59:setAI(true)
---Pirate49:setAI(true)
---Pirate79:setAI(true)
-
---return true
---end
-
-
-function startRagnar2(timestep)
-
---Ragnar02:setAI(true)
-bossFight = true
-cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 140, 0, 20)
--- Player:setCameraDist(140)
-Player:pause(true)
-return true
-end
-
-
-function surviver(timestep)
-
-if bossFight then
-time = time + timestep
-end
-
-if time > 25 then
---Ragnar02:setAI(false)
-bossFight = false
-bossFightEnd = true
-end
-
-return bossFightEnd
-end
-
-
-function onNoxons(timestep)
-
-if bossFightEnd then
-cameraManager:setCam("CameraTwo")
-cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0)
-end
-
-return false
-end
-
-function changeFromNoxon(timestep)
-if bossFightEnd then
-time2 = time2 + timestep
-end
-
-if time2 > 6 and time2 < 8 then
-Noxon01:fire()
-Noxon02:fire()
-Noxon03:fire()
---cameraManager:attachCameraToWorldEntity("CameraTwo", "NPC", "Ragnar02")
-cameraManager:setRelCoorSoft("CameraTwo", 60, 20 , -10, 6)
-end
-
-if time2 > 9 and time2 < 10 then
---Ragnar02:destroy()
-end
-
-if time2 > 11 then
-bossFightEnd = false
-cutscene2End = true
-
-cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0)
-cameraManager:setCam("GameWorldCamera")
-
-Player:pause(false)
-end
-
-return cutscene2End
-end
-
-function stopPlayer(timestep)
-
-Player:pause(true)
-
-return true
-end
