[4608] | 1 | -- Get objects from orxonox |
---|
| 2 | thisscript:addObject("SpaceShip", "Player") |
---|
| 3 | thisscript:addObject("CameraMan", "cameraManager") |
---|
[4694] | 4 | |
---|
| 5 | -- The Pirates |
---|
[4656] | 6 | thisscript:addObject("NPC", "Ragnar01") |
---|
[4753] | 7 | --thisscript:addObject("NPC", "Ragnar02") |
---|
[4722] | 8 | |
---|
[4666] | 9 | thisscript:addObject("NPC", "Pirate01") |
---|
| 10 | thisscript:addObject("NPC", "Pirate02") |
---|
| 11 | thisscript:addObject("NPC", "Pirate03") |
---|
[4722] | 12 | thisscript:addObject("NPC", "Pirate53") |
---|
| 13 | thisscript:addObject("NPC", "Pirate54") |
---|
| 14 | |
---|
[4666] | 15 | thisscript:addObject("NPC", "Pirate04") |
---|
| 16 | thisscript:addObject("NPC", "Pirate05") |
---|
| 17 | thisscript:addObject("NPC", "Pirate06") |
---|
[4722] | 18 | thisscript:addObject("NPC", "Pirate56") |
---|
| 19 | thisscript:addObject("NPC", "Pirate57") |
---|
| 20 | |
---|
[4666] | 21 | thisscript:addObject("NPC", "Pirate07") |
---|
[4682] | 22 | thisscript:addObject("NPC", "Pirate08") |
---|
| 23 | thisscript:addObject("NPC", "Pirate09") |
---|
[4722] | 24 | thisscript:addObject("NPC", "Pirate59") |
---|
| 25 | thisscript:addObject("NPC", "Pirate49") |
---|
| 26 | thisscript:addObject("NPC", "Pirate79") |
---|
[4694] | 27 | |
---|
| 28 | -- The Noxons |
---|
| 29 | thisscript:addObject("NPC", "Noxon01") |
---|
| 30 | thisscript:addObject("NPC", "Noxon02") |
---|
| 31 | thisscript:addObject("NPC", "Noxon03") |
---|
| 32 | thisscript:addObject("NPC", "Noxon04") |
---|
| 33 | thisscript: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] | 44 | triggerInit = TickTrigger() |
---|
[4608] | 45 | triggerInit:setScript("vs1.lua") |
---|
| 46 | triggerInit:setFunction("init") |
---|
| 47 | |
---|
| 48 | -- Create the cutscene trigger |
---|
[4765] | 49 | triggerCutscene = SpaceTrigger() |
---|
[4608] | 50 | triggerCutscene:setScript("vs1.lua") |
---|
| 51 | triggerCutscene:setFunction("startSequence") |
---|
[4621] | 52 | triggerCutscene:setRadius(50) |
---|
[4608] | 53 | triggerCutscene:setTarget("Player") |
---|
[4682] | 54 | triggerCutscene:setAbsCoor(2300 , 0 , 0) |
---|
[4743] | 55 | triggerCutscene:setDebugDraw(false) |
---|
[4608] | 56 | |
---|
[4652] | 57 | -- Create another cutscene trigger |
---|
[4765] | 58 | triggerCutscene02 = TickTrigger() |
---|
[4652] | 59 | triggerCutscene02:setScript("vs1.lua") |
---|
| 60 | triggerCutscene02:setFunction("switchToOtherPirate") |
---|
[4608] | 61 | |
---|
[4694] | 62 | -- Create another cutscene trigger |
---|
[4765] | 63 | triggerCutscene03 = TickTrigger() |
---|
[4694] | 64 | triggerCutscene03:setScript("vs1.lua") |
---|
| 65 | triggerCutscene03:setFunction("surviver") |
---|
| 66 | |
---|
| 67 | -- Create another cutscene trigger |
---|
[4765] | 68 | triggerCutscene04 = TickTrigger() |
---|
[4694] | 69 | triggerCutscene04:setScript("vs1.lua") |
---|
| 70 | triggerCutscene04:setFunction("onNoxons") |
---|
| 71 | |
---|
[4726] | 72 | -- Create another cutscene trigger |
---|
[4765] | 73 | triggerCutscene05 = TickTrigger() |
---|
[4726] | 74 | triggerCutscene05:setScript("vs1.lua") |
---|
| 75 | triggerCutscene05:setFunction("changeFromNoxon") |
---|
| 76 | |
---|
[4765] | 77 | |
---|
[4735] | 78 | -- Create another trigger |
---|
[4765] | 79 | triggerStop = SpaceTrigger() |
---|
[4735] | 80 | triggerStop:setScript("vs1.lua") |
---|
| 81 | triggerStop:setFunction("stopPlayer") |
---|
| 82 | triggerStop:setRadius(50) |
---|
| 83 | triggerStop:setTarget("Player") |
---|
| 84 | triggerStop:setAbsCoor(8000 , 0 , -2000) |
---|
[4743] | 85 | triggerStop:setDebugDraw(false) |
---|
[4726] | 86 | |
---|
[4656] | 87 | -- Create the cool Ragnar trigger |
---|
[4765] | 88 | triggerRagnar = SpaceTrigger() |
---|
[4656] | 89 | triggerRagnar:setScript("vs1.lua") |
---|
| 90 | triggerRagnar:setFunction("startRagnar") |
---|
| 91 | triggerRagnar:setRadius(50) |
---|
| 92 | triggerRagnar:setTarget("Player") |
---|
[4722] | 93 | triggerRagnar:setAbsCoor(3600 , 0 , -15) |
---|
[4743] | 94 | triggerRagnar: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] | 136 | counter = 0 |
---|
| 137 | cutsceneRunning = false |
---|
[4694] | 138 | cutscene2Running = false |
---|
[4652] | 139 | cutsceneEnd = false |
---|
[4694] | 140 | cutscene2End = false |
---|
[4682] | 141 | bossFight = false |
---|
| 142 | bossFightEnd = false |
---|
| 143 | time = 0 |
---|
[4726] | 144 | time2 = 0 |
---|
[4608] | 145 | |
---|
[4722] | 146 | -- init function |
---|
[4608] | 147 | function init(timestep) |
---|
[4760] | 148 | -- cameraManager:setCam("GameWorldCamera") |
---|
| 149 | cameraManager:attachCamera("CameraOne", "NPC", "Pirate01") |
---|
| 150 | cameraManager:attachCamera("CameraTwo", "NPC", "Noxon01") |
---|
[4722] | 151 | cameraManager:setRelCoor("CameraOne", 10, 8 , -5) |
---|
[4735] | 152 | cameraManager:setRelCoor("CameraTwo", 30, 15 , -10) |
---|
[4656] | 153 | |
---|
[4694] | 154 | |
---|
[4656] | 155 | Ragnar01:pause(true) |
---|
[4608] | 156 | |
---|
| 157 | return true |
---|
| 158 | end |
---|
| 159 | |
---|
| 160 | function startSequence(timestep) |
---|
| 161 | |
---|
[4682] | 162 | Player:pause(true) |
---|
[4652] | 163 | cameraManager:setCam("CameraOne") |
---|
| 164 | cutsceneRunning = true |
---|
[4608] | 165 | return true |
---|
| 166 | end |
---|
[4652] | 167 | |
---|
| 168 | function switchToOtherPirate(timestep) |
---|
| 169 | |
---|
| 170 | if cutsceneRunning then |
---|
| 171 | counter = counter + timestep |
---|
| 172 | end |
---|
| 173 | |
---|
[4666] | 174 | if counter > 5 and counter < 6 then |
---|
[4760] | 175 | cameraManager:attachCamera("CameraOne", "NPC", "Pirate03") |
---|
[4682] | 176 | cameraManager:setRelCoorSoft("CameraOne", 10, 8 , 5, 6) |
---|
[4684] | 177 | |
---|
[4652] | 178 | end |
---|
| 179 | |
---|
[4682] | 180 | if counter > 11 then |
---|
[4652] | 181 | cutsceneEnd = true |
---|
[4682] | 182 | Player:pause(false) |
---|
[4760] | 183 | cameraManager:setCam("GameWorldCamera") |
---|
[4652] | 184 | end |
---|
| 185 | |
---|
| 186 | return cutsceneEnd |
---|
| 187 | end |
---|
[4656] | 188 | |
---|
| 189 | |
---|
| 190 | function startRagnar(timestep) |
---|
| 191 | |
---|
| 192 | Ragnar01:pause(false) |
---|
| 193 | return true |
---|
| 194 | end |
---|
[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 | |
---|
| 234 | function startRagnar2(timestep) |
---|
| 235 | |
---|
[4735] | 236 | --Ragnar02:setAI(true) |
---|
[4682] | 237 | bossFight = true |
---|
[4760] | 238 | cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 140, 0, 20) |
---|
[4726] | 239 | -- Player:setCameraDist(140) |
---|
[4722] | 240 | Player:pause(true) |
---|
[4682] | 241 | return true |
---|
| 242 | end |
---|
| 243 | |
---|
| 244 | |
---|
| 245 | function surviver(timestep) |
---|
| 246 | |
---|
| 247 | if bossFight then |
---|
| 248 | time = time + timestep |
---|
| 249 | end |
---|
| 250 | |
---|
| 251 | if time > 25 then |
---|
[4753] | 252 | --Ragnar02:setAI(false) |
---|
[4694] | 253 | bossFight = false |
---|
[4682] | 254 | bossFightEnd = true |
---|
| 255 | end |
---|
| 256 | |
---|
| 257 | return bossFightEnd |
---|
[4694] | 258 | end |
---|
| 259 | |
---|
[4722] | 260 | |
---|
[4694] | 261 | function onNoxons(timestep) |
---|
| 262 | |
---|
| 263 | if bossFightEnd then |
---|
| 264 | cameraManager:setCam("CameraTwo") |
---|
[4760] | 265 | cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0) |
---|
[4694] | 266 | end |
---|
| 267 | |
---|
[4726] | 268 | return false |
---|
| 269 | end |
---|
[4694] | 270 | |
---|
[4726] | 271 | function changeFromNoxon(timestep) |
---|
| 272 | if bossFightEnd then |
---|
| 273 | time2 = time2 + timestep |
---|
| 274 | end |
---|
| 275 | |
---|
| 276 | if time2 > 6 and time2 < 8 then |
---|
| 277 | Noxon01:fire() |
---|
| 278 | Noxon02:fire() |
---|
| 279 | Noxon03:fire() |
---|
[4760] | 280 | --cameraManager:attachCameraToWorldEntity("CameraTwo", "NPC", "Ragnar02") |
---|
[4734] | 281 | cameraManager:setRelCoorSoft("CameraTwo", 60, 20 , -10, 6) |
---|
[4726] | 282 | end |
---|
| 283 | |
---|
| 284 | if time2 > 9 and time2 < 10 then |
---|
[4753] | 285 | --Ragnar02:destroy() |
---|
[4726] | 286 | end |
---|
| 287 | |
---|
| 288 | if time2 > 11 then |
---|
[4734] | 289 | bossFightEnd = false |
---|
[4726] | 290 | cutscene2End = true |
---|
| 291 | |
---|
[4760] | 292 | cameraManager:setRelCoorSoft("GameWorldCamera", -0.05, 70, 0) |
---|
| 293 | cameraManager:setCam("GameWorldCamera") |
---|
[4726] | 294 | |
---|
| 295 | Player:pause(false) |
---|
| 296 | end |
---|
| 297 | |
---|
[4694] | 298 | return cutscene2End |
---|
[4735] | 299 | end |
---|
| 300 | |
---|
| 301 | function stopPlayer(timestep) |
---|
| 302 | |
---|
| 303 | Player:pause(true) |
---|
| 304 | |
---|
| 305 | return true |
---|
[4682] | 306 | end |
---|