Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/contentcreation/pps/MichiVonKaenel/scripts/moonstation/intro.lua @ 5222

Last change on this file since 5222 was 4835, checked in by vkaenemi, 18 years ago

a lot of scripting(intro/quests) +destroyed introroom

File size: 2.9 KB
Line 
1-- Get objects from orxonox
2thisscript:addObject("FPSPlayer", "Player")
3thisscript:addObject("CameraMan", "cameraManager")
4thisscript:addObject("NPC", "IntroSpaceship")
5thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle
6
7-- Initialisation
8triggerInit = ScriptTrigger()
9triggerInit:setScript("intro.lua")
10triggerInit:setFunction("startIntro")
11triggerInit:setActiveOnCreation(true)
12
13-- Camera2MoonstationCenter
14triggerMoonstation = ScriptTrigger()
15triggerMoonstation:setScript("intro.lua")
16triggerMoonstation:setFunction("showMoonstation")
17triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807)
18triggerMoonstation:setTarget("CameraIntro")
19triggerMoonstation:setRadius(150)
20triggerMoonstation:setDebugDraw(true)
21
22-- Camera2MoonstationCenter
23triggerShowCrash = ScriptTrigger()
24triggerShowCrash:setScript("intro.lua")
25triggerShowCrash:setFunction("showCrashingSpaceship")
26triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926)
27triggerShowCrash:setTarget("CameraIntro")
28triggerShowCrash:setRadius(200)
29triggerShowCrash:setDebugDraw(true)
30
31--hide crashing ship
32triggerShowCrash = ScriptTrigger()
33triggerShowCrash:setScript("intro.lua")
34triggerShowCrash:setFunction("hideCrashingSpaceship")
35triggerShowCrash:setAbsCoor(-100, -400, -110)
36triggerShowCrash:setTarget("IntroSpaceship")
37triggerShowCrash:setRadius(60)
38triggerShowCrash:setDebugDraw(true)
39
40-- End of Intro
41triggerEndIntro = ScriptTrigger()
42triggerEndIntro:setScript("intro.lua")
43triggerEndIntro:setFunction("stopIntro")
44triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880)
45triggerEndIntro:setTarget("CameraIntro")
46triggerEndIntro:setRadius(110)
47triggerEndIntro:setDebugDraw(true)
48
49
50-- Functions --------------------------------------------------
51-- globals
52introRunning = false
53spaceshipCrashDelay = 2
54
55-- init function
56function startIntro(timestep)
57        gameWorld:showText("Moon Surface 2042");
58        cameraManager:setCam("CameraIntro")
59        cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780)
60        cameraManager:changeCurrTarget("Planet", "Earth")
61        cameraManager:initFadeBlack()
62        cameraManager:toggleFade()
63       
64        IntroSpaceship:pause(true)
65        --Player:pause(true)
66        introRunning = true
67       
68        return true --just once
69end
70
71function showMoonstation(timestep)
72        cameraManager:changeCurrTarget("Building", "MoonstationCenterHack")
73        return true
74end
75
76function showCrashingSpaceship(timestep)
77        cameraManager:changeCurrTarget("NPC", "IntroSpaceship")
78        spaceshipCrashDelay = spaceshipCrashDelay - timestep
79        if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate
80                IntroSpaceship:pause(false)
81                return true
82        end
83        return false
84end
85
86function hideCrashingSpaceship(timestep)
87        --IntroSpaceship:setVisibility(false) --BUG affects all npc
88        IntroSpaceship:pause(true)
89        return true
90end 
91
92function stopIntro(timestep)
93        cameraManager:setCam("GameWorldCamera")
94        --Player:pause(false)
95        introRunning = false
96        return true
97end
98
Note: See TracBrowser for help on using the repository browser.