Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4715 was 4710, checked in by marcscha, 18 years ago

fixes to Mission 1

File size: 6.1 KB
Line 
1-- Get objects from orxonox
2thisscript:addObject("SpaceShip", "Player")
3thisscript:addObject("CameraMan", "cameraManager")
4
5-- The Pirates
6thisscript:addObject("NPC", "Ragnar01")
7thisscript:addObject("NPC", "Ragnar02")
8thisscript:addObject("NPC", "Pirate01")
9thisscript:addObject("NPC", "Pirate02")
10thisscript:addObject("NPC", "Pirate03")
11thisscript:addObject("NPC", "Pirate04")
12thisscript:addObject("NPC", "Pirate05")
13thisscript:addObject("NPC", "Pirate06")
14thisscript:addObject("NPC", "Pirate07")
15thisscript:addObject("NPC", "Pirate08")
16thisscript:addObject("NPC", "Pirate09")
17
18-- The Noxons
19thisscript:addObject("NPC", "Noxon01")
20thisscript:addObject("NPC", "Noxon02")
21thisscript:addObject("NPC", "Noxon03")
22thisscript:addObject("NPC", "Noxon04")
23thisscript:addObject("NPC", "Noxon05")
24--thisscript:addObject("NPC", "Noxon06")
25--thisscript:addObject("NPC", "Noxon07")
26--thisscript:addObject("NPC", "Noxon08")
27--thisscript:addObject("NPC", "Noxon09")
28--thisscript:addObject("NPC", "Noxon10")
29--thisscript:addObject("NPC", "Noxon11")
30--thisscript:addObject("NPC", "Noxon12")
31
32-- thisscript:addObjectAsName("GameWorld", "Mission 1", "gameWorld")
33
34triggerInit = ScriptTrigger()
35triggerInit:setScript("vs1.lua")
36triggerInit:setFunction("init")
37triggerInit:setActiveOnCreation(true)
38
39-- Create the cutscene trigger
40triggerCutscene = ScriptTrigger()
41triggerCutscene:setScript("vs1.lua")
42triggerCutscene:setFunction("startSequence")
43triggerCutscene:setRadius(50)
44triggerCutscene:setTarget("Player")
45triggerCutscene:setAbsCoor(2300 , 0 , 0)
46triggerCutscene:setDebugDraw(true)
47triggerCutscene:setActiveOnCreation(false)
48
49-- Create another cutscene trigger
50triggerCutscene02 = ScriptTrigger()
51triggerCutscene02:setScript("vs1.lua")
52triggerCutscene02:setFunction("switchToOtherPirate")
53triggerCutscene02:setActiveOnCreation(true)
54
55-- Create another cutscene trigger
56triggerCutscene03 = ScriptTrigger()
57triggerCutscene03:setScript("vs1.lua")
58triggerCutscene03:setFunction("surviver")
59triggerCutscene03:setActiveOnCreation(true)
60
61-- Create another cutscene trigger
62triggerCutscene04 = ScriptTrigger()
63triggerCutscene04:setScript("vs1.lua")
64triggerCutscene04:setFunction("onNoxons")
65triggerCutscene04:setActiveOnCreation(true)
66
67-- Create the cool Ragnar trigger
68triggerRagnar = ScriptTrigger()
69triggerRagnar:setScript("vs1.lua")
70triggerRagnar:setFunction("startRagnar")
71triggerRagnar:setRadius(50)
72triggerRagnar:setTarget("Player")
73triggerRagnar:setAbsCoor(3600 , 0 , -10)
74triggerRagnar:setDebugDraw(true)
75triggerRagnar:setActiveOnCreation(false)
76
77-- Create a great AI activater
78triggerAI01 = ScriptTrigger()
79triggerAI01:setScript("vs1.lua")
80triggerAI01:setFunction("activateGroup1")
81triggerAI01:setRadius(50)
82triggerAI01:setTarget("Player")
83triggerAI01:setAbsCoor(2600, 0, -10)
84triggerAI01:setDebugDraw(true)
85triggerAI01:setActiveOnCreation(false)
86
87-- Create another great AI activater
88triggerAI02 = ScriptTrigger()
89triggerAI02:setScript("vs1.lua")
90triggerAI02:setFunction("activateGroup2")
91triggerAI02:setRadius(50)
92triggerAI02:setTarget("Player")
93triggerAI02:setAbsCoor(4900, 0, 0)
94triggerAI02:setDebugDraw(true)
95triggerAI02:setActiveOnCreation(false)
96
97-- Create another great AI activater
98triggerAI03 = ScriptTrigger()
99triggerAI03:setScript("vs1.lua")
100triggerAI03:setFunction("activateGroup3")
101triggerAI03:setRadius(50)
102triggerAI03:setTarget("Player")
103triggerAI03:setAbsCoor(5850, 0, -70)
104triggerAI03:setDebugDraw(true)
105triggerAI03:setActiveOnCreation(false)
106
107-- Create another great AI activater
108triggerAI04 = ScriptTrigger()
109triggerAI04:setScript("vs1.lua")
110triggerAI04:setFunction("startRagnar2")
111triggerAI04:setRadius(50)
112triggerAI04:setTarget("Player")
113triggerAI04:setAbsCoor(6500, 0, -200)
114triggerAI04:setDebugDraw(true)
115triggerAI04:setActiveOnCreation(false)
116
117-- Global Variables
118counter = 0
119cutsceneRunning = false
120cutscene2Running = false
121cutsceneEnd = false
122cutscene2End = false
123bossFight = false
124bossFightEnd = false
125time = 0
126
127function init(timestep)
128-- cameraManager:setCam("GameWorld-Camera")
129cameraManager:atachCameraToWorldEntity("CameraOne", "NPC", "Pirate01")
130cameraManager:atachCameraToWorldEntity("CameraTwo", "NPC", "Noxon01")
131cameraManager:setRelCoor("CameraOne", 10, 8 , 5)
132cameraManager:setRelCoor("CameraTwo", 10, 8 , 5)
133--Player:setCameraDistance(100)
134
135
136Ragnar01:pause(true)
137-- cameraManager:changeTarget("CameraOne", "NPC", "Pirate01")
138-- cameraManager:jumpCam("CameraOne", 3300, 0, 50)
139
140return true
141end
142
143function startSequence(timestep)
144
145Player:pause(true)
146cameraManager:setCam("CameraOne")
147-- gameWorld:showText("Kill those traitorous bastards")
148-- cameraManager:changeCurrTarget("NPC", "Pirate01")
149-- cameraManager:atachCurrCameraToWorldEntity("NPC", "Pirate01")
150cutsceneRunning = true
151return true
152end
153
154function switchToOtherPirate(timestep)
155
156if cutsceneRunning then
157counter = counter + timestep
158end
159
160if counter > 5 and counter < 6 then
161cameraManager:atachCameraToWorldEntity("CameraOne", "NPC", "Pirate03")
162cameraManager:setRelCoorSoft("CameraOne", 10, 8 , 5, 6)
163
164end
165
166if counter > 11 then
167cutsceneEnd = true
168Player:pause(false)
169cameraManager:setCam("GameWorld-Camera")
170end
171
172return cutsceneEnd
173end
174
175
176function startRagnar(timestep)
177
178Ragnar01:pause(false)
179return true
180end
181
182
183function activateGroup1(timestep)
184
185Pirate01:setAI(true)
186Pirate02:setAI(true)
187Pirate03:setAI(true)
188
189return true
190end
191
192
193function activateGroup2(timestep)
194
195Pirate04:setAI(true)
196Pirate05:setAI(true)
197Pirate06:setAI(true)
198
199return true
200end
201
202
203function activateGroup3(timestep)
204
205Pirate07:setAI(true)
206Pirate08:setAI(true)
207Pirate09:setAI(true)
208
209return true
210end
211
212
213function startRagnar2(timestep)
214
215Ragnar02:setAI(true)
216bossFight = true
217Player:setCameraDist(100)
218
219return true
220end
221
222
223function surviver(timestep)
224
225if bossFight then
226time = time + timestep
227end
228
229if time > 25 then
230Ragnar02:setAI(false)
231bossFight = false
232bossFightEnd = true
233end
234
235return bossFightEnd
236end
237
238function onNoxons(timestep)
239
240if bossFightEnd then
241cameraManager:setCam("CameraTwo")
242Player:pause(true)
243end
244
245
246return cutscene2End
247end
Note: See TracBrowser for help on using the repository browser.