Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/cutscene/cutscene.lua @ 4721

Last change on this file since 4721 was 4671, checked in by snellen, 18 years ago

Added quests to spacestation hangar

File size: 5.0 KB
Line 
1-- Main trigger
2trigger = ScriptTrigger()                     -- Create the trigger
3trigger:setScript("cutscene.lua")             -- Tell the trigger which script to call
4trigger:setFunction("tick")                   -- Tell the trigger which scriptfunction to call
5trigger:setActiveOnCreation(true)     
6
7
8-- Cameraswitchzero
9triggerZero = ScriptTrigger()
10triggerZero:setScript("cutscene.lua")
11triggerZero:setFunction("switchCamToBomber")
12triggerZero:setAbsCoor(37 , 0 , -200)
13triggerZero:setTarget("CameraOne")
14triggerZero:setRadius(10)
15--triggerZero:setDebugDraw(true)
16
17
18-- Cameraswitchone
19triggerOne = ScriptTrigger()
20triggerOne:setScript("cutscene.lua")
21triggerOne:setFunction("switchCamTargetToEarth")
22triggerOne:setAbsCoor(5 , 0 , -140)
23triggerOne:setTarget("CameraOne")
24triggerOne:setRadius(10)
25--triggerOne:setDebugDraw(true)
26
27
28-- Cameraswitchtwo
29triggerTwo = ScriptTrigger()
30triggerTwo:setScript("cutscene.lua")
31triggerTwo:setFunction("switchCamToSpaceship")
32triggerTwo:setAbsCoor(0, 0 , -25)
33triggerTwo:setTarget("CameraOne")
34triggerTwo:setRadius(5)
35--triggerTwo:setDebugDraw(true) 
36
37-- Cameraswitchthree
38triggerThree = ScriptTrigger()
39triggerThree:setScript("cutscene.lua")
40triggerThree:setFunction("switchCamToStation")
41triggerThree:setAbsCoor(-125, 0 , -25)
42triggerThree:setTarget("CameraOne")
43triggerThree:setRadius(5)
44--triggerThree:setDebugDraw(true) 
45
46
47-- startScenery
48triggerFour = ScriptTrigger()
49triggerFour:setScript("cutscene.lua")
50triggerFour:setFunction("startSceneryOne")
51triggerFour:setAbsCoor(125,0,-245)
52triggerFour:setTarget("CameraOne")
53triggerFour:setRadius(5)
54--triggerFour:setDebugDraw(true) 
55
56
57-- Get objects from orxonox
58thisscript:addObject("CameraMan", "cameraManager")
59thisscript:addObject("NPC", "shutleOne")
60thisscript:addObject("NPC", "bomberOne")
61thisscript:addObject("NPC", "fighterOne")
62thisscript:addObject("NPC", "bomberTwo")
63thisscript:addObject("NPC", "fighterTwo")
64thisscript:addObject("NPC", "pirateOne")
65thisscript:addObject("NPC", "pirateTwo")
66thisscript:addObject("NPC", "fighterThree")
67thisscript:addObject("NPC", "bomberThree")
68thisscript:addObject("NPC", "bomberFour")
69thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld")
70thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen")
71
72
73-- Global Variables
74time = 0
75fadeout = false
76bInit = 0
77bInit2 = 0
78sceneryOneStopped = false
79sceneryOneRunning = false
80stationReached = false
81
82-- Switch cam functions
83function switchCamTargetToEarth(timestep)
84cameraManager:changeCurrTarget("Planet", "Earth")
85return true
86end
87
88function switchCamToSpaceship(timestep)
89cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne")
90return true
91end
92
93function switchCamToStation(timestep)
94cameraManager:atachCurrCameraToWorldEntity("Building", "zhara")
95stationReached = true
96time = 0
97--cameraManager:detachCurrCamera()
98return true
99end
100
101function switchCamToBomber(timestep)
102cameraManager:changeCurrTarget( "NPC", "fighterTwo")
103return true
104end
105
106
107-- Start
108function startSceneryOne(timestep)
109
110--shutleOne:unhide()
111--bomberOne:unhide()
112--fighterOne:unhide()
113--bomberTwo:unhide()
114--fighterTwo:unhide()
115--pirateOne:unhide())
116--pirateTwo:unhide()
117--fighterThree:unhide()
118--bomberThree:unhide()
119
120shutleOne:pause(false)
121bomberOne:pause(false)
122fighterOne:pause(false)
123bomberTwo:pause(false)
124fighterTwo:pause(false)
125pirateOne:pause(false)
126pirateTwo:pause(false)
127fighterThree:pause(false)
128bomberThree:pause(false)
129bomberFour:pause(false)
130
131sceneryOneRunning = true
132time = 0
133
134return true
135
136end
137
138-- Stop
139function stopSceneryOne(timestep)
140
141--shutleOne:hide()
142--bomberOne:hide()
143--fighterOne:hide()
144--bomberTwo:hide()
145--fighterTwo:hide()
146--pirateOne:hide())
147--pirateTwo:hide()
148--fighterThree:hide()
149--bomberThree:hide()
150
151shutleOne:pause(true)
152bomberOne:pause(true)
153fighterOne:pause(true)
154bomberTwo:pause(true)
155fighterTwo:pause(true)
156pirateOne:pause(true)
157pirateTwo:pause(true)
158fighterThree:pause(true)
159bomberThree:pause(true)
160bomberFour:pause(false)
161
162return true
163
164end
165
166
167-- THE tick function
168
169function tick(timestep)
170time = time + timestep
171
172if not sceneryOneStopped then
173sceneryOneStopped = stopSceneryOne(timestep)
174end
175
176if bInit == 0 then
177  cameraManager:initFadeBlack()
178  gameWorld:showText("Earth Solar System");
179  bInit = 1
180end
181
182if time > 2 and bInit2 == 0 then
183   cameraManager:toggleFade()
184   bInit2 = 1
185end
186
187
188
189if time > 8 and time < 8.5 and sceneryOneRunning then
190   fighterThree:fire()
191end
192
193if not cameraSwitched then
194cameraManager:setCam("CameraOne")
195cameraManager:jumpCurrCam(125,0,-245)
196--cameraManager:atachCurrCameraToWorldEntity("NPC", "transporterOne")
197cameraManager:changeCurrTarget("Building", "zhara")
198cameraSwitched = true
199end
200
201if time > 4  and stationReached and not fadeout then
202cameraManager:toggleFade()
203fadeout = true
204end
205
206if time > 10 then
207   scrollingScreen:start()
208end
209
210
211if time > 6 and stationReached then
212gameWorld:setNextStoryName( "Space Station 1" ) 
213gameWorld:stop()
214return true
215end
216
217return false
218end 
Note: See TracBrowser for help on using the repository browser.