-- Main trigger trigger = TickTrigger() -- Create the trigger trigger:setScript("cutscene.lua") -- Tell the trigger which script to call trigger:setFunction("tick") -- Tell the trigger which scriptfunction to call -- Cameraswitchzero triggerZero = SpaceTrigger() triggerZero:setScript("cutscene.lua") triggerZero:setFunction("switchCamToBomber") triggerZero:setAbsCoor(37 , 0 , -200) triggerZero:setTarget("CameraOne") triggerZero:setRadius(10) --triggerZero:setDebugDraw(true) -- Cameraswitchone triggerOne = SpaceTrigger() triggerOne:setScript("cutscene.lua") triggerOne:setFunction("switchCamTargetToEarth") triggerOne:setAbsCoor(5 , 0 , -140) triggerOne:setTarget("CameraOne") triggerOne:setRadius(10) --triggerOne:setDebugDraw(true) -- Cameraswitchtwo triggerTwo = SpaceTrigger() triggerTwo:setScript("cutscene.lua") triggerTwo:setFunction("switchCamToSpaceship") triggerTwo:setAbsCoor(0, 0 , -25) triggerTwo:setTarget("CameraOne") triggerTwo:setRadius(5) --triggerTwo:setDebugDraw(true) -- Cameraswitchthree triggerThree = SpaceTrigger() triggerThree:setScript("cutscene.lua") triggerThree:setFunction("switchCamToStation") triggerThree:setAbsCoor(-125, 0 , -25) triggerThree:setTarget("CameraOne") triggerThree:setRadius(5) --triggerThree:setDebugDraw(true) -- startScenery triggerFour = SpaceTrigger() triggerFour:setScript("cutscene.lua") triggerFour:setFunction("startSceneryOne") triggerFour:setAbsCoor(125,0,-245) triggerFour:setTarget("CameraOne") triggerFour:setRadius(5) --triggerFour:setDebugDraw(true) -- Scroller triggerScr = TimeTrigger() triggerScr:setScript("cutscene.lua") triggerScr:setFunction("startScrolling") triggerScr:setDelay(10) -- Get objects from orxonox thisscript:addObject("CameraMan", "cameraManager") thisscript:addObject("NPC", "shutleOne") thisscript:addObject("NPC", "bomberOne") thisscript:addObject("NPC", "fighterOne") thisscript:addObject("NPC", "bomberTwo") thisscript:addObject("NPC", "fighterTwo") thisscript:addObject("NPC", "pirateOne") thisscript:addObject("NPC", "pirateTwo") thisscript:addObject("NPC", "fighterThree") thisscript:addObject("NPC", "bomberThree") thisscript:addObject("NPC", "bomberFour") thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") -- Global Variables time = 0 fadeout = false bInit = 0 bInit2 = 0 sceneryOneStopped = false sceneryOneRunning = false stationReached = false -- Switch cam functions function switchCamTargetToEarth(timestep) cameraManager:changeCurrTarget("Planet", "Earth") return true end function switchCamToSpaceship(timestep) cameraManager:attachCurrCamera( "NPC", "shutleOne") return true end function switchCamToStation(timestep) cameraManager:attachCurrCamera("Building", "zhara") stationReached = true time = 0 --cameraManager:detachCurrCamera() return true end function switchCamToBomber(timestep) cameraManager:changeCurrTarget( "NPC", "fighterTwo") return true end -- Start function startSceneryOne(timestep) --shutleOne:unhide() --bomberOne:unhide() --fighterOne:unhide() --bomberTwo:unhide() --fighterTwo:unhide() --pirateOne:unhide()) --pirateTwo:unhide() --fighterThree:unhide() --bomberThree:unhide() shutleOne:pause(false) bomberOne:pause(false) fighterOne:pause(false) bomberTwo:pause(false) fighterTwo:pause(false) pirateOne:pause(false) pirateTwo:pause(false) fighterThree:pause(false) bomberThree:pause(false) bomberFour:pause(false) sceneryOneRunning = true time = 0 return true end -- Stop function stopSceneryOne(timestep) --shutleOne:hide() --bomberOne:hide() --fighterOne:hide() --bomberTwo:hide() --fighterTwo:hide() --pirateOne:hide()) --pirateTwo:hide() --fighterThree:hide() --bomberThree:hide() shutleOne:pause(true) bomberOne:pause(true) fighterOne:pause(true) bomberTwo:pause(true) fighterTwo:pause(true) pirateOne:pause(true) pirateTwo:pause(true) fighterThree:pause(true) bomberThree:pause(true) bomberFour:pause(true) return true end -- Start the scrolling screen function startScrolling(timestep) scrollingScreen:start() return true end -- THE tick function function tick(timestep) time = time + timestep triggerScr:start() if not sceneryOneStopped then sceneryOneStopped = stopSceneryOne(timestep) end if bInit == 0 then cameraManager:initFadeBlack() gameWorld:showText("Earth Solar System"); bInit = 1 end if time > 2 and bInit2 == 0 then cameraManager:toggleFade() bInit2 = 1 end if time > 8 and time < 8.5 and sceneryOneRunning then fighterThree:fire() end if not cameraSwitched then cameraManager:setCam("CameraOne") cameraManager:jumpCurrCam(125,0,-245) --cameraManager:attachCurrCamera("NPC", "transporterOne") cameraManager:changeCurrTarget("Building", "zhara") cameraSwitched = true end if time > 4 and stationReached and not fadeout then cameraManager:toggleFade() fadeout = true end if time > 6 and stationReached then gameWorld:setNextStoryName( "Space Station 1" ) gameWorld:stop() return true end return false end