-- Get objects from orxonox thisscript:addObject("FPSPlayer", "Player") thisscript:addObject("CameraMan", "cameraManager") thisscript:addObject("NPC", "IntroSpaceship") thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle -- Initialisation triggerInit = TickTrigger() --ScriptTrigger() triggerInit:setScript("intro.lua") triggerInit:setFunction("startIntro") --triggerInit:setActiveOnCreation(true) -- Camera2MoonstationCenter triggerMoonstation = SpaceTrigger() triggerMoonstation:setScript("intro.lua") triggerMoonstation:setFunction("showMoonstation") triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807) triggerMoonstation:setTarget("CameraIntro") triggerMoonstation:setRadius(150) triggerMoonstation:setDebugDraw(true) -- Camera2MoonstationCenter triggerShowCrash = SpaceTrigger() triggerShowCrash:setScript("intro.lua") triggerShowCrash:setFunction("showCrashingSpaceship") triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926) triggerShowCrash:setTarget("CameraIntro") triggerShowCrash:setRadius(200) triggerShowCrash:setDebugDraw(true) --hide crashing ship triggerShowCrash = SpaceTrigger() triggerShowCrash:setScript("intro.lua") triggerShowCrash:setFunction("hideCrashingSpaceship") triggerShowCrash:setAbsCoor(-100, -400, -110) triggerShowCrash:setTarget("IntroSpaceship") triggerShowCrash:setRadius(60) triggerShowCrash:setDebugDraw(true) -- End of Intro triggerEndIntro = SpaceTrigger() triggerEndIntro:setScript("intro.lua") triggerEndIntro:setFunction("stopIntro") triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880) triggerEndIntro:setTarget("CameraIntro") triggerEndIntro:setRadius(110) triggerEndIntro:setDebugDraw(true) -- Functions -------------------------------------------------- -- globals introRunning = false spaceshipCrashDelay = 2 -- init function function startIntro(timestep) gameWorld:showText("Moon Surface 2102"); cameraManager:setCam("CameraIntro") cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780) cameraManager:changeCurrTarget("Planet", "Earth") cameraManager:initFadeBlack() cameraManager:toggleFade() IntroSpaceship:pause(true) --Player:pause(true) introRunning = true return true --just once end function showMoonstation(timestep) cameraManager:changeCurrTarget("Building", "MoonstationCenterHack") return true end function showCrashingSpaceship(timestep) cameraManager:changeCurrTarget("NPC", "IntroSpaceship") spaceshipCrashDelay = spaceshipCrashDelay - timestep if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate IntroSpaceship:pause(false) return true end return false end function hideCrashingSpaceship(timestep) --IntroSpaceship:setVisibility(false) --BUG affects all npc IntroSpaceship:pause(true) return true end function stopIntro(timestep) cameraManager:setCam("GameWorldCamera") --Player:pause(false) introRunning = false return true end