Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/vertical_scroller/vs1.lua @ 4790

Last change on this file since 4790 was 4765, checked in by snellen, 18 years ago

adapted all the scripts to the new trunk

File size: 7.1 KB
Line 
1-- Get objects from orxonox
2thisscript:addObject("SpaceShip", "Player")
3thisscript:addObject("CameraMan", "cameraManager")
4
5-- The Pirates
6thisscript:addObject("NPC", "Ragnar01")
7--thisscript:addObject("NPC", "Ragnar02")
8
9thisscript:addObject("NPC", "Pirate01")
10thisscript:addObject("NPC", "Pirate02")
11thisscript:addObject("NPC", "Pirate03")
12thisscript:addObject("NPC", "Pirate53")
13thisscript:addObject("NPC", "Pirate54")
14
15thisscript:addObject("NPC", "Pirate04")
16thisscript:addObject("NPC", "Pirate05")
17thisscript:addObject("NPC", "Pirate06")
18thisscript:addObject("NPC", "Pirate56")
19thisscript:addObject("NPC", "Pirate57")
20
21thisscript:addObject("NPC", "Pirate07")
22thisscript:addObject("NPC", "Pirate08")
23thisscript:addObject("NPC", "Pirate09")
24thisscript:addObject("NPC", "Pirate59")
25thisscript:addObject("NPC", "Pirate49")
26thisscript:addObject("NPC", "Pirate79")
27
28-- The Noxons
29thisscript:addObject("NPC", "Noxon01")
30thisscript:addObject("NPC", "Noxon02")
31thisscript:addObject("NPC", "Noxon03")
32thisscript:addObject("NPC", "Noxon04")
33thisscript:addObject("NPC", "Noxon05")
34--thisscript:addObject("NPC", "Noxon06")
35--thisscript:addObject("NPC", "Noxon07")
36--thisscript:addObject("NPC", "Noxon08")
37--thisscript:addObject("NPC", "Noxon09")
38--thisscript:addObject("NPC", "Noxon10")
39--thisscript:addObject("NPC", "Noxon11")
40--thisscript:addObject("NPC", "Noxon12")
41
42-- thisscript:addObjectAsName("GameWorld", "Mission 1", "gameWorld")
43
44triggerInit = TickTrigger()
45triggerInit:setScript("vs1.lua")
46triggerInit:setFunction("init")
47
48-- Create the cutscene trigger
49triggerCutscene = SpaceTrigger()
50triggerCutscene:setScript("vs1.lua")
51triggerCutscene:setFunction("startSequence")
52triggerCutscene:setRadius(50)
53triggerCutscene:setTarget("Player")
54triggerCutscene:setAbsCoor(2300 , 0 , 0)
55triggerCutscene:setDebugDraw(false)
56
57-- Create another cutscene trigger
58triggerCutscene02 = TickTrigger()
59triggerCutscene02:setScript("vs1.lua")
60triggerCutscene02:setFunction("switchToOtherPirate")
61
62-- Create another cutscene trigger
63triggerCutscene03 = TickTrigger()
64triggerCutscene03:setScript("vs1.lua")
65triggerCutscene03:setFunction("surviver")
66
67-- Create another cutscene trigger
68triggerCutscene04 = TickTrigger()
69triggerCutscene04:setScript("vs1.lua")
70triggerCutscene04:setFunction("onNoxons")
71
72-- Create another cutscene trigger
73triggerCutscene05 = TickTrigger()
74triggerCutscene05:setScript("vs1.lua")
75triggerCutscene05:setFunction("changeFromNoxon")
76
77
78-- Create another trigger
79triggerStop = SpaceTrigger()
80triggerStop:setScript("vs1.lua")
81triggerStop:setFunction("stopPlayer")
82triggerStop:setRadius(50)
83triggerStop:setTarget("Player")
84triggerStop:setAbsCoor(8000 , 0 , -2000)
85triggerStop:setDebugDraw(false)
86
87-- Create the cool Ragnar trigger
88triggerRagnar = SpaceTrigger()
89triggerRagnar:setScript("vs1.lua")
90triggerRagnar:setFunction("startRagnar")
91triggerRagnar:setRadius(50)
92triggerRagnar:setTarget("Player")
93triggerRagnar:setAbsCoor(3600 , 0 , -15)
94triggerRagnar:setDebugDraw(false)
95
96-- Create a great AI activater
97--triggerAI01 = SpaceTrigger()
98--triggerAI01:setScript("vs1.lua")
99--triggerAI01:setFunction("activateGroup1")
100--triggerAI01:setRadius(50)
101--triggerAI01:setTarget("Player")
102--triggerAI01:setAbsCoor(2600, 0, -10)
103--triggerAI01:setDebugDraw(false)
104--triggerAI01:setActiveOnCreation(false)
105
106-- Create another great AI activater
107--triggerAI02 = SpaceTrigger()
108--triggerAI02:setScript("vs1.lua")
109--triggerAI02:setFunction("activateGroup2")
110--triggerAI02:setRadius(50)
111--triggerAI02:setTarget("Player")
112--triggerAI02:setAbsCoor(4900, 0, -45)
113--triggerAI02:setDebugDraw(false)
114
115-- Create another great AI activater
116--triggerAI03 = SpaceTrigger()
117--triggerAI03:setScript("vs1.lua")
118--triggerAI03:setFunction("activateGroup3")
119--triggerAI03:setRadius(50)
120--triggerAI03:setTarget("Player")
121--triggerAI03:setAbsCoor(5850, 0, -170)
122--triggerAI03:setDebugDraw(false)
123
124-- Create another great AI activater
125--triggerAI04 = SpaceTrigger()
126--triggerAI04:setScript("vs1.lua")
127--triggerAI04:setFunction("startRagnar2")
128--triggerAI04:setRadius(50)
129--triggerAI04:setTarget("Player")
130--triggerAI04:setAbsCoor(6500, 0, -350)
131--triggerAI04:setDebugDraw(false)
132
133
134
135-- Global Variables
136counter = 0
137cutsceneRunning = false
138cutscene2Running = false
139cutsceneEnd = false
140cutscene2End = false
141bossFight = false
142bossFightEnd = false
143time = 0
144time2 = 0
145
146-- init function
147function init(timestep)
148-- cameraManager:setCam("GameWorldCamera")
149cameraManager:attachCamera("CameraOne", "NPC", "Pirate01")
150cameraManager:attachCamera("CameraTwo", "NPC", "Noxon01")
151cameraManager:setRelCoor("CameraOne", 10, 8 , -5)
152cameraManager:setRelCoor("CameraTwo", 30, 15 , -10)
153
154
155Ragnar01:pause(true)
156
157return true
158end
159
160function startSequence(timestep)
161
162Player:pause(true)
163cameraManager:setCam("CameraOne")
164cutsceneRunning = true
165return true
166end
167
168function switchToOtherPirate(timestep)
169
170if cutsceneRunning then
171counter = counter + timestep
172end
173
174if counter > 5 and counter < 6 then
175cameraManager:attachCamera("CameraOne", "NPC", "Pirate03")
176cameraManager:setRelCoorSoft("CameraOne", 10, 8 , 5, 6)
177
178end
179
180if counter > 11 then
181cutsceneEnd = true
182Player:pause(false)
183cameraManager:setCam("GameWorldCamera")
184end
185
186return cutsceneEnd
187end
188
189
190function startRagnar(timestep)
191
192Ragnar01:pause(false)
193return true
194end
195
196
197--function activateGroup1(timestep)
198
199--Pirate01:setAI(true)
200--Pirate02:setAI(true)
201--Pirate03:setAI(true)
202--Pirate53:setAI(true)
203--Pirate54:setAI(true)
204
205--return true
206--end
207
208
209--function activateGroup2(timestep)
210
211--Pirate04:setAI(true)
212--Pirate05:setAI(true)
213--Pirate06:setAI(true)
214--Pirate56:setAI(true)
215--Pirate57:setAI(true)
216
217--return true
218--end
219
220
221--function activateGroup3(timestep)
222
223--Pirate07:setAI(true)
224--Pirate08:setAI(true)
225--Pirate09:setAI(true)
226--Pirate59:setAI(true)
227--Pirate49:setAI(true)
228--Pirate79:setAI(true)
229
230--return true
231--end
232
233
234function startRagnar2(timestep)
235
236--Ragnar02:setAI(true)
237bossFight = true
238cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 140, 0, 20)
239-- Player:setCameraDist(140)
240Player:pause(true)
241return true
242end
243
244
245function surviver(timestep)
246
247if bossFight then
248time = time + timestep
249end
250
251if time > 25 then
252--Ragnar02:setAI(false)
253bossFight = false
254bossFightEnd = true
255end
256
257return bossFightEnd
258end
259
260
261function onNoxons(timestep)
262
263if bossFightEnd then
264cameraManager:setCam("CameraTwo")
265cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0)
266end
267
268return false
269end
270
271function changeFromNoxon(timestep)
272if bossFightEnd then
273time2 = time2 + timestep
274end
275
276if time2 > 6 and time2 < 8 then
277Noxon01:fire()
278Noxon02:fire()
279Noxon03:fire()
280--cameraManager:attachCameraToWorldEntity("CameraTwo", "NPC", "Ragnar02")
281cameraManager:setRelCoorSoft("CameraTwo", 60, 20 , -10, 6)
282end
283
284if time2 > 9 and time2 < 10 then
285--Ragnar02:destroy()
286end
287
288if time2 > 11 then
289bossFightEnd = false
290cutscene2End = true
291
292cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0)
293cameraManager:setCam("GameWorldCamera")
294
295Player:pause(false)
296end
297
298return cutscene2End
299end
300
301function stopPlayer(timestep)
302
303Player:pause(true)
304
305return true
306end
Note: See TracBrowser for help on using the repository browser.