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