[4468] | 1 | -- Create the trigger |
---|
[4765] | 2 | trigger = TickTrigger() |
---|
[4468] | 3 | trigger:setName("maintrigger") |
---|
| 4 | trigger:setScript("spaceship_tower.lua") |
---|
| 5 | trigger:setFunction("tick") |
---|
| 6 | |
---|
[4765] | 7 | triggerOne = SpaceTrigger() |
---|
[4653] | 8 | triggerOne:setScript("spaceship_tower.lua") |
---|
| 9 | triggerOne:setFunction("startSecondQuest") |
---|
| 10 | triggerOne:setTarget("Player") |
---|
| 11 | triggerOne:setAbsCoor(1177.693, -12.796, 203.514) |
---|
| 12 | triggerOne:setRadius(50) |
---|
[4655] | 13 | --triggerOne:setDebugDraw(true) |
---|
[4653] | 14 | |
---|
[4765] | 15 | triggerTwo = SpaceTrigger() |
---|
[4671] | 16 | triggerTwo:setScript("spaceship_tower.lua") |
---|
| 17 | triggerTwo:setFunction("startThirdQuest") |
---|
| 18 | triggerTwo:setTarget("Player") |
---|
| 19 | triggerTwo:setTriggerParent("panicGuy") |
---|
| 20 | triggerTwo:setRadius(70) |
---|
| 21 | --triggerTwo:setDebugDraw(true) |
---|
[4653] | 22 | |
---|
[4468] | 23 | -- Get objects from orxonox |
---|
| 24 | thisscript:addObject("FPSPlayer", "Player") |
---|
| 25 | thisscript:addObject("GenericNPC", "pedestrianOne") |
---|
| 26 | thisscript:addObject("GenericNPC", "hangarguyOne") |
---|
[4671] | 27 | thisscript:addObject("GenericNPC", "panicGuy") |
---|
[4653] | 28 | thisscript:addObject("QuestGUI", "First_Quest") |
---|
| 29 | thisscript:addObject("QuestGUI", "Second_Quest") |
---|
[4671] | 30 | thisscript:addObject("QuestGUI", "Third_Quest") |
---|
[4468] | 31 | |
---|
| 32 | |
---|
[4653] | 33 | |
---|
| 34 | |
---|
| 35 | -- Globals |
---|
| 36 | questOneStarted = false |
---|
[4671] | 37 | barReached = false |
---|
| 38 | runProg = true |
---|
[4653] | 39 | |
---|
[4468] | 40 | -- pedestrian |
---|
| 41 | pedestrian = { } |
---|
| 42 | --{ |
---|
| 43 | function pedestrian:tick(timestep) |
---|
| 44 | if pedestrianOne:finalGoalReached() then |
---|
| 45 | |
---|
| 46 | pedestrianOne:walkTo(516.458313, -352, -80.734474) |
---|
| 47 | pedestrianOne:walkTo(512.872253, -352, -116.005737) |
---|
| 48 | pedestrianOne:walkTo(499.799866, -352, -159.124832) |
---|
| 49 | pedestrianOne:walkTo(475.927399, -352, -210.216354) |
---|
| 50 | pedestrianOne:walkTo(448.311920, -352, -265.528564) |
---|
| 51 | pedestrianOne:walkTo(414.508118, -352, -323.333405) |
---|
| 52 | pedestrianOne:walkTo(370.584290, -352, -385.605530) |
---|
| 53 | pedestrianOne:walkTo(343.100464, -352, -415.069794) |
---|
| 54 | pedestrianOne:walkTo(264.569794, -352, -476.752869) |
---|
| 55 | pedestrianOne:walkTo(210.117767, -352, -506.892090) |
---|
| 56 | pedestrianOne:walkTo(164.443237, -352, -522.833435) |
---|
| 57 | pedestrianOne:walkTo(104.187263, -352, -532.872925) |
---|
| 58 | pedestrianOne:walkTo(2.165657, -352, -541.539734) |
---|
| 59 | pedestrianOne:walkTo(-83.860703, -352, -536.539429) |
---|
| 60 | pedestrianOne:walkTo(-190.057220, -352, -505.938080) |
---|
| 61 | pedestrianOne:walkTo(-304.299713, -352, -443.351471) |
---|
| 62 | pedestrianOne:walkTo(-386.765076, -352, -389.817383) |
---|
| 63 | pedestrianOne:walkTo(-450.359467, -352, -317.446564) |
---|
| 64 | pedestrianOne:walkTo(-496.030060, -352, -220.342926) |
---|
| 65 | pedestrianOne:walkTo(-519.588379, -352, -123.082298) |
---|
| 66 | pedestrianOne:walkTo(-532.314880, -352, -23.615164) |
---|
| 67 | pedestrianOne:walkTo(-532.617371, -352, 45.020267) |
---|
| 68 | pedestrianOne:walkTo(-523.393188, -352, 122.215889) |
---|
| 69 | pedestrianOne:walkTo(-514.028748, -352, 161.396454) |
---|
| 70 | pedestrianOne:walkTo(-494.465302, -352, 209.894760) |
---|
| 71 | pedestrianOne:walkTo(-442.015442, -352, 297.304840) |
---|
| 72 | pedestrianOne:walkTo(-390.615448, -352, 374.627777) |
---|
| 73 | pedestrianOne:walkTo(-319.119080, -352, 442.413940) |
---|
| 74 | pedestrianOne:walkTo(-217.457092, -352, 494.077393) |
---|
| 75 | pedestrianOne:walkTo(-151.378113, -352, 521.028198) |
---|
| 76 | pedestrianOne:walkTo(-65.499962, -352, 534.818909) |
---|
| 77 | pedestrianOne:walkTo(-12.994286, -352, 543.250610) |
---|
| 78 | pedestrianOne:walkTo(43.301056, -352, 545.434570) |
---|
| 79 | pedestrianOne:walkTo(111.077263, -352, 542.904480) |
---|
| 80 | pedestrianOne:walkTo(159.826782, -352, 531.741943) |
---|
| 81 | pedestrianOne:walkTo(218.487457, -352, 509.065948) |
---|
| 82 | pedestrianOne:walkTo(276.665436, -352, 477.931427) |
---|
| 83 | pedestrianOne:walkTo(332.371368, -352, 443.890839) |
---|
| 84 | pedestrianOne:walkTo(378.867981, -352, 401.978882) |
---|
| 85 | pedestrianOne:walkTo(415.942627, -352, 345.542542) |
---|
| 86 | pedestrianOne:walkTo(453.910004, -352, 273.056732) |
---|
| 87 | pedestrianOne:walkTo(488.833588, -352, 204.519592) |
---|
| 88 | pedestrianOne:walkTo(512.676575, -352, 145.735123) |
---|
| 89 | pedestrianOne:walkTo(525.567139, -352, 66.236511) |
---|
| 90 | |
---|
| 91 | end |
---|
| 92 | |
---|
| 93 | end |
---|
| 94 | |
---|
| 95 | --} |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | -- hangarguy |
---|
| 100 | hangarguy = { } |
---|
| 101 | --{ |
---|
| 102 | |
---|
| 103 | hangarguy.routeProgramed = false |
---|
| 104 | |
---|
| 105 | function hangarguy:tick(timestep) |
---|
| 106 | if not hangarguy.routeProgramed then |
---|
| 107 | |
---|
| 108 | hangarguyOne:walkTo( 4.520885, 35, -715.864136) |
---|
| 109 | hangarguyOne:walkTo( 4.436781, 35, -710.607483) |
---|
| 110 | hangarguyOne:walkTo( 4.271256, 35, -700.261902) |
---|
| 111 | hangarguyOne:walkTo( 4.108314, 35, -690.077698) |
---|
| 112 | hangarguyOne:walkTo( 2.860425, 35, -612.082458) |
---|
| 113 | hangarguyOne:walkTo( 2.336200, 35, -579.317566) |
---|
| 114 | hangarguyOne:walkTo( 19.468971, 35, -558.118713) |
---|
| 115 | hangarguyOne:walkTo( 58.664307, 35, -541.788879) |
---|
| 116 | hangarguyOne:walkTo( 102.207947, 35, -538.448669) |
---|
| 117 | hangarguyOne:walkTo( 148.613098, 35, -525.434814) |
---|
| 118 | hangarguyOne:walkTo( 194.356705, 35, -510.325592) |
---|
| 119 | hangarguyOne:walkTo( 241.033600, 35, -493.087036) |
---|
| 120 | hangarguyOne:walkTo( 280.100891, 35, -476.127960) |
---|
| 121 | hangarguyOne:walkTo( 317.930084, 35, -459.305878) |
---|
| 122 | hangarguyOne:walkTo( 352.476410, 35, -435.666595) |
---|
| 123 | hangarguyOne:walkTo( 372.327820, 35, -421.279785) |
---|
| 124 | hangarguyOne:walkTo( 399.971436, 35, -395.954559) |
---|
| 125 | hangarguyOne:walkTo( 416.877686, 35, -362.181549) |
---|
| 126 | hangarguyOne:walkTo( 432.721222, 35, -311.302490) |
---|
| 127 | hangarguyOne:walkTo( 469.218750, 35, -233.788040) |
---|
| 128 | hangarguyOne:walkTo( 487.923004, 35, -200.841125) |
---|
| 129 | hangarguyOne:walkTo( 506.862518, 35, -162.215515) |
---|
| 130 | hangarguyOne:walkTo( 529.612061, 35, -115.549751) |
---|
| 131 | hangarguyOne:walkTo( 542.065125, 35, -88.352898) |
---|
| 132 | hangarguyOne:walkTo( 558.192444, 35, -39.543404) |
---|
| 133 | hangarguyOne:walkTo( 559.105713, 35, -34.795399) |
---|
| 134 | hangarguyOne:walkTo( 563.437378, 35, -31.207838) |
---|
| 135 | hangarguyOne:walkTo( 575.247192, 35, -21.994106) |
---|
| 136 | hangarguyOne:walkTo( 590.928040, 35, -15.268648) |
---|
| 137 | hangarguyOne:walkTo( 660.693298, 35, -4.461691) |
---|
| 138 | hangarguyOne:walkTo( 666.650879, 35, -2.223409) |
---|
| 139 | hangarguyOne:walkTo( 668.187927, 35, 4.955472) |
---|
| 140 | hangarguyOne:walkTo( 671.830505, 35, 21.968117) |
---|
| 141 | hangarguyOne:walkTo( 675.100159, 35, 37.731144) |
---|
| 142 | hangarguyOne:walkTo( 677.764221, 35, 53.632107) |
---|
| 143 | hangarguyOne:walkTo( 677.170837, 35, 62.944923) |
---|
| 144 | hangarguyOne:walkTo( 675.125671, 35, 81.444199) |
---|
| 145 | hangarguyOne:walkTo( 674.070251, 35, 97.964783) |
---|
| 146 | hangarguyOne:walkTo( 674.865112, 35, 112.956894) |
---|
| 147 | hangarguyOne:walkTo( 683.106750, 35, 123.733559) |
---|
| 148 | hangarguyOne:walkTo( 697.092224, 35, 130.347214) |
---|
| 149 | hangarguyOne:walkTo( 711.597778, 35, 134.194839) |
---|
| 150 | hangarguyOne:walkTo( 731.452209, 35, 133.556061) |
---|
| 151 | hangarguyOne:walkTo( 744.283691, 35, 127.194984) |
---|
| 152 | hangarguyOne:walkTo( 754.862183, 35, 113.226959) |
---|
| 153 | hangarguyOne:walkTo( 759.921082, 35, 101.175034) |
---|
| 154 | hangarguyOne:walkTo( 765.828674, 35, 86.496742) |
---|
| 155 | hangarguyOne:walkTo( 772.430176, 35, 70.094063) |
---|
| 156 | hangarguyOne:walkTo( 778.920776, 35, 53.967388) |
---|
| 157 | hangarguyOne:walkTo( 786.386292, 35, 36.463428) |
---|
| 158 | hangarguyOne:walkTo( 806.520142, 35, 25.996820) |
---|
| 159 | hangarguyOne:walkTo( 867.622192, 35, 17.105639) |
---|
| 160 | hangarguyOne:walkTo( 897.198181, 35, 13.109496) |
---|
| 161 | hangarguyOne:walkTo( 929.129517, 35, 9.825047) |
---|
| 162 | hangarguyOne:walkTo( 987.034302, 35, 6.972207) |
---|
| 163 | hangarguyOne:walkTo( 1040.090698, 35, 5.634526) |
---|
| 164 | hangarguyOne:walkTo( 1095.084595, 35, 6.542047) |
---|
| 165 | hangarguyOne:walkTo( 1137.440552, 35, 8.371919) |
---|
| 166 | hangarguyOne:walkTo( 1180.903564, 35, 11.816477) |
---|
| 167 | |
---|
| 168 | hangarguy.routeProgramed = true |
---|
| 169 | |
---|
| 170 | end |
---|
| 171 | |
---|
| 172 | end |
---|
| 173 | |
---|
| 174 | --} |
---|
| 175 | |
---|
| 176 | |
---|
[4671] | 177 | -- pedestrian |
---|
| 178 | panic = { } |
---|
| 179 | --{ |
---|
| 180 | function panic:tick(timestep) |
---|
| 181 | |
---|
| 182 | if runProg and Player:getAbsCoorX() < 700 then |
---|
| 183 | panicGuy:setVisibility(true) |
---|
| 184 | panicGuy:runTo( 532.556641, 21.618149, 121.871323 ) |
---|
| 185 | panicGuy:runTo( 544.452026, 21.618143, 50.025143 ) |
---|
| 186 | |
---|
| 187 | runProg = false |
---|
| 188 | end |
---|
| 189 | |
---|
| 190 | end |
---|
| 191 | |
---|
| 192 | --} |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
[4653] | 196 | function startSecondQuest(timestep) |
---|
[4659] | 197 | if First_Quest:isActive() then |
---|
[4653] | 198 | Second_Quest:startGUI() |
---|
[4671] | 199 | return true |
---|
[4659] | 200 | end |
---|
| 201 | |
---|
[4671] | 202 | return false |
---|
| 203 | end |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | function startThirdQuest(timestep) |
---|
| 207 | |
---|
| 208 | if barReached then |
---|
| 209 | Third_Quest:startGUI() |
---|
[4653] | 210 | return true |
---|
| 211 | end |
---|
| 212 | |
---|
[4671] | 213 | return false |
---|
| 214 | end |
---|
[4653] | 215 | |
---|
[4671] | 216 | |
---|
[4468] | 217 | -- THE tick function |
---|
| 218 | |
---|
| 219 | function tick(timestep) |
---|
| 220 | --io.write("Towerscript called \n") |
---|
| 221 | |
---|
[4653] | 222 | if not questOneStarted then |
---|
[4671] | 223 | panicGuy:setVisibility(false) |
---|
[4653] | 224 | First_Quest:startGUI() |
---|
| 225 | questOneStarted = true |
---|
| 226 | end |
---|
| 227 | |
---|
[4671] | 228 | if Player:getAbsCoorX() > 800 then |
---|
| 229 | barReached = true |
---|
| 230 | end |
---|
[4653] | 231 | |
---|
[4671] | 232 | if barReached then |
---|
| 233 | panic:tick(timestep) |
---|
| 234 | end |
---|
| 235 | |
---|
[4468] | 236 | pedestrian:tick(timestep) |
---|
| 237 | hangarguy:tick(timestep) |
---|
| 238 | |
---|
[4671] | 239 | |
---|
[4468] | 240 | return false |
---|
| 241 | end |
---|