Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

adapted all the scripts to the new trunk

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