[4561] | 1 | -- Main trigger |
---|
[4555] | 2 | trigger = ScriptTrigger() -- Create the trigger |
---|
| 3 | trigger:setScript("cutscene.lua") -- Tell the trigger which script to call |
---|
| 4 | trigger:setFunction("tick") -- Tell the trigger which scriptfunction to call |
---|
[4561] | 5 | trigger:setActiveOnCreation(true) |
---|
| 6 | |
---|
[4582] | 7 | |
---|
| 8 | -- Cameraswitchzero |
---|
| 9 | triggerZero = ScriptTrigger() |
---|
| 10 | triggerZero:setScript("cutscene.lua") |
---|
| 11 | triggerZero:setFunction("switchCamToBomber") |
---|
| 12 | triggerZero:setAbsCoor(37 , 0 , -200) |
---|
| 13 | triggerZero:setTarget("CameraOne") |
---|
| 14 | triggerZero:setRadius(10) |
---|
[4603] | 15 | --triggerZero:setDebugDraw(true) |
---|
[4582] | 16 | |
---|
| 17 | |
---|
[4561] | 18 | -- Cameraswitchone |
---|
| 19 | triggerOne = ScriptTrigger() |
---|
| 20 | triggerOne:setScript("cutscene.lua") |
---|
| 21 | triggerOne:setFunction("switchCamTargetToEarth") |
---|
[4587] | 22 | triggerOne:setAbsCoor(5 , 0 , -140) |
---|
[4561] | 23 | triggerOne:setTarget("CameraOne") |
---|
[4563] | 24 | triggerOne:setRadius(10) |
---|
[4603] | 25 | --triggerOne:setDebugDraw(true) |
---|
[4561] | 26 | |
---|
| 27 | |
---|
| 28 | -- Cameraswitchtwo |
---|
| 29 | triggerTwo = ScriptTrigger() |
---|
| 30 | triggerTwo:setScript("cutscene.lua") |
---|
| 31 | triggerTwo:setFunction("switchCamToSpaceship") |
---|
[4593] | 32 | triggerTwo:setAbsCoor(0, 0 , -25) |
---|
[4563] | 33 | triggerTwo:setTarget("CameraOne") |
---|
| 34 | triggerTwo:setRadius(5) |
---|
[4603] | 35 | --triggerTwo:setDebugDraw(true) |
---|
[4561] | 36 | |
---|
| 37 | -- Cameraswitchthree |
---|
| 38 | triggerThree = ScriptTrigger() |
---|
| 39 | triggerThree:setScript("cutscene.lua") |
---|
| 40 | triggerThree:setFunction("switchCamToStation") |
---|
[4593] | 41 | triggerThree:setAbsCoor(-125, 0 , -25) |
---|
[4563] | 42 | triggerThree:setTarget("CameraOne") |
---|
| 43 | triggerThree:setRadius(5) |
---|
[4603] | 44 | --triggerThree:setDebugDraw(true) |
---|
[4561] | 45 | |
---|
[4655] | 46 | |
---|
| 47 | -- startScenery |
---|
| 48 | triggerFour = ScriptTrigger() |
---|
| 49 | triggerFour:setScript("cutscene.lua") |
---|
| 50 | triggerFour:setFunction("startSceneryOne") |
---|
| 51 | triggerFour:setAbsCoor(125,0,-245) |
---|
| 52 | triggerFour:setTarget("CameraOne") |
---|
| 53 | triggerFour:setRadius(5) |
---|
[4659] | 54 | --triggerFour:setDebugDraw(true) |
---|
[4655] | 55 | |
---|
| 56 | |
---|
[4555] | 57 | -- Get objects from orxonox |
---|
| 58 | thisscript:addObject("CameraMan", "cameraManager") |
---|
[4655] | 59 | thisscript:addObject("NPC", "shutleOne") |
---|
| 60 | thisscript:addObject("NPC", "bomberOne") |
---|
| 61 | thisscript:addObject("NPC", "fighterOne") |
---|
| 62 | thisscript:addObject("NPC", "bomberTwo") |
---|
| 63 | thisscript:addObject("NPC", "fighterTwo") |
---|
| 64 | thisscript:addObject("NPC", "pirateOne") |
---|
| 65 | thisscript:addObject("NPC", "pirateTwo") |
---|
[4597] | 66 | thisscript:addObject("NPC", "fighterThree") |
---|
[4655] | 67 | thisscript:addObject("NPC", "bomberThree") |
---|
| 68 | thisscript:addObject("NPC", "bomberFour") |
---|
[4569] | 69 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
[4605] | 70 | thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") |
---|
[4555] | 71 | |
---|
[4569] | 72 | |
---|
[4561] | 73 | -- Global Variables |
---|
[4555] | 74 | time = 0 |
---|
[4570] | 75 | fadeout = false |
---|
[4568] | 76 | bInit = 0 |
---|
| 77 | bInit2 = 0 |
---|
[4655] | 78 | sceneryOneStopped = false |
---|
| 79 | sceneryOneRunning = false |
---|
| 80 | stationReached = false |
---|
[4555] | 81 | |
---|
[4561] | 82 | -- Switch cam functions |
---|
| 83 | function switchCamTargetToEarth(timestep) |
---|
| 84 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
| 85 | return true |
---|
| 86 | end |
---|
| 87 | |
---|
| 88 | function switchCamToSpaceship(timestep) |
---|
[4760] | 89 | cameraManager:attachCurrCamera( "NPC", "shutleOne") |
---|
[4561] | 90 | return true |
---|
| 91 | end |
---|
| 92 | |
---|
| 93 | function switchCamToStation(timestep) |
---|
[4760] | 94 | cameraManager:attachCurrCamera("Building", "zhara") |
---|
[4570] | 95 | stationReached = true |
---|
| 96 | time = 0 |
---|
[4563] | 97 | --cameraManager:detachCurrCamera() |
---|
[4561] | 98 | return true |
---|
| 99 | end |
---|
| 100 | |
---|
[4582] | 101 | function switchCamToBomber(timestep) |
---|
| 102 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
| 103 | return true |
---|
| 104 | end |
---|
[4561] | 105 | |
---|
[4582] | 106 | |
---|
[4655] | 107 | -- Start |
---|
| 108 | function startSceneryOne(timestep) |
---|
[4582] | 109 | |
---|
[4655] | 110 | --shutleOne:unhide() |
---|
| 111 | --bomberOne:unhide() |
---|
| 112 | --fighterOne:unhide() |
---|
| 113 | --bomberTwo:unhide() |
---|
| 114 | --fighterTwo:unhide() |
---|
| 115 | --pirateOne:unhide()) |
---|
| 116 | --pirateTwo:unhide() |
---|
| 117 | --fighterThree:unhide() |
---|
| 118 | --bomberThree:unhide() |
---|
| 119 | |
---|
| 120 | shutleOne:pause(false) |
---|
| 121 | bomberOne:pause(false) |
---|
| 122 | fighterOne:pause(false) |
---|
| 123 | bomberTwo:pause(false) |
---|
| 124 | fighterTwo:pause(false) |
---|
| 125 | pirateOne:pause(false) |
---|
| 126 | pirateTwo:pause(false) |
---|
| 127 | fighterThree:pause(false) |
---|
| 128 | bomberThree:pause(false) |
---|
| 129 | bomberFour:pause(false) |
---|
| 130 | |
---|
| 131 | sceneryOneRunning = true |
---|
| 132 | time = 0 |
---|
| 133 | |
---|
| 134 | return true |
---|
| 135 | |
---|
| 136 | end |
---|
| 137 | |
---|
| 138 | -- Stop |
---|
| 139 | function stopSceneryOne(timestep) |
---|
| 140 | |
---|
| 141 | --shutleOne:hide() |
---|
| 142 | --bomberOne:hide() |
---|
| 143 | --fighterOne:hide() |
---|
| 144 | --bomberTwo:hide() |
---|
| 145 | --fighterTwo:hide() |
---|
| 146 | --pirateOne:hide()) |
---|
| 147 | --pirateTwo:hide() |
---|
| 148 | --fighterThree:hide() |
---|
| 149 | --bomberThree:hide() |
---|
| 150 | |
---|
| 151 | shutleOne:pause(true) |
---|
| 152 | bomberOne:pause(true) |
---|
| 153 | fighterOne:pause(true) |
---|
| 154 | bomberTwo:pause(true) |
---|
| 155 | fighterTwo:pause(true) |
---|
| 156 | pirateOne:pause(true) |
---|
| 157 | pirateTwo:pause(true) |
---|
| 158 | fighterThree:pause(true) |
---|
| 159 | bomberThree:pause(true) |
---|
| 160 | bomberFour:pause(false) |
---|
| 161 | |
---|
| 162 | return true |
---|
| 163 | |
---|
| 164 | end |
---|
| 165 | |
---|
| 166 | |
---|
[4555] | 167 | -- THE tick function |
---|
| 168 | |
---|
| 169 | function tick(timestep) |
---|
| 170 | time = time + timestep |
---|
[4563] | 171 | |
---|
[4655] | 172 | if not sceneryOneStopped then |
---|
| 173 | sceneryOneStopped = stopSceneryOne(timestep) |
---|
| 174 | end |
---|
[4570] | 175 | |
---|
[4568] | 176 | if bInit == 0 then |
---|
| 177 | cameraManager:initFadeBlack() |
---|
[4570] | 178 | gameWorld:showText("Earth Solar System"); |
---|
[4568] | 179 | bInit = 1 |
---|
| 180 | end |
---|
| 181 | |
---|
[4570] | 182 | if time > 2 and bInit2 == 0 then |
---|
[4568] | 183 | cameraManager:toggleFade() |
---|
| 184 | bInit2 = 1 |
---|
| 185 | end |
---|
| 186 | |
---|
[4605] | 187 | |
---|
[4606] | 188 | |
---|
[4655] | 189 | if time > 8 and time < 8.5 and sceneryOneRunning then |
---|
[4605] | 190 | fighterThree:fire() |
---|
[4597] | 191 | end |
---|
| 192 | |
---|
[4563] | 193 | if not cameraSwitched then |
---|
[4561] | 194 | cameraManager:setCam("CameraOne") |
---|
[4582] | 195 | cameraManager:jumpCurrCam(125,0,-245) |
---|
[4760] | 196 | --cameraManager:attachCurrCamera("NPC", "transporterOne") |
---|
[4671] | 197 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
[4555] | 198 | cameraSwitched = true |
---|
[4563] | 199 | end |
---|
[4555] | 200 | |
---|
[4570] | 201 | if time > 4 and stationReached and not fadeout then |
---|
| 202 | cameraManager:toggleFade() |
---|
| 203 | fadeout = true |
---|
[4555] | 204 | end |
---|
| 205 | |
---|
[4606] | 206 | if time > 10 then |
---|
| 207 | scrollingScreen:start() |
---|
| 208 | end |
---|
| 209 | |
---|
| 210 | |
---|
[4570] | 211 | if time > 6 and stationReached then |
---|
| 212 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
| 213 | gameWorld:stop() |
---|
| 214 | return true |
---|
| 215 | end |
---|
| 216 | |
---|
[4555] | 217 | return false |
---|
| 218 | end |
---|