Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/OrxoKart_HS18/data/levels/shuttleAttack.oxw @ 12412

Last change on this file since 12412 was 11802, checked in by landauf, 7 years ago

migrated NotificationLayer.lua to cegui 0.8

  • Property svn:eol-style set to native
File size: 42.3 KB
Line 
1<!--TODO: Shuttle and Stations -->
2<LevelInfo
3    name = "Shuttle under Attack"
4    description = "The newly discovered hostile alien species is attacking one of our outset stations, Andromeda! There is no protecting it; you have to escort the escape shuttle to a safer location."
5    tags = "mission"
6    screenshot = "shuttleProtect.png"
7/>
8
9<?lua
10    include("stats.oxo")
11    include("HUDTemplates3.oxo")
12    include("HUDTemplatesFPS.oxo")
13    include("templates/lodInformation.oxt")
14
15    include("templates/spaceshipAssff.oxt")
16    include("templates/spaceshipPirate.oxt")
17    include("templates/spaceshipEscort.oxt")
18    include("templates/spaceshipShuttle.oxt")
19    include("templates/FPS.oxt")
20    include("templates/pickupRepresentationTemplates.oxt")
21?>
22
23<Level gametype = "Mission">
24    <templates>
25        <Template link="lodtemplate_default" />
26    </templates>
27
28    <?lua include("includes/notifications.oxi") ?>
29
30    <NotificationQueueCEGUI
31        name="narrative"
32        targets="simpleNotification"
33        size=3
34        displayTime=3.9
35        position="0.15, 0, 0.1, 0"
36        fontSize="15"
37        fontColor="0.3, 1, 0.2, 0.8"
38        alignment="CentreAligned"
39        displaySize="0.7, 0, 0, 0"
40    />
41
42    <!-- GLOBAL LUA VARIABLES -->
43    <?lua
44        waves = 3
45        enemiesInit = 5
46        enemiesIncrease = 2
47        allies = 3
48
49        --[[ Coordinates in (y,z,x). NOTE: Indexing starts at 1 in lua! Don´t forget to adapt the for loops, too! ]]--
50        cCenter = {0, 0, 0}
51        cSpawn = {-50, 0, 0}
52        cUnit = {-2000, 0, 3000}
53        cA = {-3000, 0, 5000}
54        cB = {-3000, 0, -5000}
55        cC = {-2300, 0, 0}
56        dStation = {1, 0, 0}
57        cNewShip = {-2100, 0, 4100}
58        cFPSGround = {-2300, 800, 0}
59        cFPS = {-2300, 1000, 0}
60        cField1 = {400, 0, 2500}
61        cField2 = {400, 0, -2500}
62        cPlanet1 = {8000, -2000, 15000}
63        cPlanet2 = {-20000, 4000, -1000}
64        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r. Do not permute! ]]--
65
66        --[[ Function to print Coordinates. Quotes not included! ]]--
67        function printC(coord)
68          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
69        end
70    ?>
71
72    <Scene
73        ambientlight = "0.8, 0.8, 0.8"
74        skybox = "Orxonox/skyBoxMoreNebula"
75        hasPhysics = true
76    >
77
78    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cA) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
79
80    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
81
82    <Light type=directional position="<?lua printC(cCenter) ?>" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
83
84    <!--QUEST DEFINITIONS-->
85
86    <GlobalQuest id="quest1">
87        <QuestDescription title="Reach Andromeda Station!" description="You need to get in contact with your base! Word is enemies are preparing to attack our people and goods! Be quick!" failMessage="" completeMessage="" />
88        <hints>
89        </hints>
90        <complete-effects>
91            <AddQuest questId="quest2" />
92            <AddQuest questId="quest2.1" />
93        </complete-effects>
94    </GlobalQuest>
95
96    <GlobalQuest id="quest2">
97        <QuestDescription title="Prepare to fight the Enemy" description="You need to be prepared, mentally and physically! So gather all your strength and forces to destroy those space pirates!" failMessage="" completeMessage="" />
98        <hints>
99        </hints>
100        <subquests>
101            <GlobalQuest id="quest2.1">
102                <QuestDescription title="> Get a better Spaceship" description="Take over the faster, stronger, more secure and overall better spaceship!" failMessage="" completeMessage="" />
103                <complete-effects>
104                    <AddQuest questId="quest2.2" />
105                </complete-effects>
106            </GlobalQuest>
107            <GlobalQuest id="quest2.2">
108                <QuestDescription title="> Meet your Unit" description="Your unit will help you, where ever you go. To victory or to death, they will be loyal to you!" failMessage="" completeMessage="" />
109            </GlobalQuest>
110        </subquests>
111        <complete-effects>
112            <AddQuest questId="quest3" />
113        </complete-effects>
114    </GlobalQuest>
115
116    <GlobalQuest id="quest3">
117        <QuestDescription title="Fight the first Wave" description="Five enemies are approaching you! There main target is the shuttle though, so destroy them - before the destroy the escape shuttle with the valuebals goods (and of course the people aboard)!" failMessage="Oh no! You have to be better, they destroyed the shuttle!" completeMessage="Good Job!" />
118        <hints>
119        </hints>
120        <complete-effects>
121            <AddQuest questId="quest4" />
122            <AddQuest questId="quest4.1" />
123            <AddQuest questId="quest4.2" />
124        </complete-effects>
125    </GlobalQuest>
126
127    <GlobalQuest id="quest4">
128        <QuestDescription title="Prepare for the next Wave" description="This was just a scouting troop from the enemies, they know now how many there are from us and will send a bigger troop next time! Prepare yourself..." failMessage="" completeMessage="" />
129        <hints>
130        </hints>
131        <subquests>
132            <GlobalQuest id="quest4.1">
133                <QuestDescription title="> Get to the Defense Station" description="Fly to the defense station, we will guard your spaceship while you will fight them with the Cannon Suit." failMessage="" completeMessage="" />
134            </GlobalQuest>
135            <GlobalQuest id="quest4.2">
136                <QuestDescription title="> Get into the Cannon Suit!" description="Dock to the defense station, you will be able to contol the Cannon Suit on top of the station, perfect for fighting off a hord of enemies!" failMessage="" completeMessage="" />
137            </GlobalQuest>
138        </subquests>
139        <complete-effects>
140            <AddQuest questId="quest5" />
141        </complete-effects>
142    </GlobalQuest>
143
144    <GlobalQuest id="quest5">
145        <QuestDescription title="Fight the Hord!" description="Destroy the next wave!" failMessage="" completeMessage="" />
146        <hints>
147        </hints>
148        <complete-effects>
149            <AddQuest questId="quest6" />
150            <AddQuest questId="quest6.1" />
151            <AddQuest questId="quest6.2" />
152        </complete-effects>
153    </GlobalQuest>
154
155    <GlobalQuest id="quest6">
156        <QuestDescription title="Get back for the Showdown" description="Undock from the defense station and get into your Spaceship!" failMessage="" completeMessage="" />
157        <hints>
158        </hints>
159        <subquests>
160            <GlobalQuest id="quest6.1">
161                <QuestDescription title="> Collect the local Pickups" description="There is a box with pickups close to the station, you can collect them if you want to, but it is advised to do so. They will support your task in destroying the enemies and make your life easier." failMessage="" completeMessage="" />
162            </GlobalQuest>
163            <GlobalQuest id="quest6.2">
164                <QuestDescription title="> Get back to the Shuttle" description="Fly to the Shuttle!" failMessage="" completeMessage="" />
165            </GlobalQuest>
166        </subquests>
167        <complete-effects>
168            <AddQuest questId="quest7" />
169        </complete-effects>
170    </GlobalQuest>
171
172    <GlobalQuest id="quest7">
173        <QuestDescription title="Fight the final Wave" description="Good gracious, another hord of pirate ships!" failMessage="" completeMessage="" />
174        <hints>
175        </hints>
176        <subquests>
177        </subquests>
178    </GlobalQuest>
179
180    <!--EVENTS AND TRIGGERS
181        Usable events and triggers:
182        _spawntrigger
183        _reachedA
184        _dock<A|B|C>
185        _docked<A>      WIP; see below
186        -joinedUnit
187        _wave<k>
188        _killedEnemy<k>.<i>
189        _waveClear<k>
190    -->
191
192
193
194    <EventMultiTrigger name="spawntrigger" activations=1>
195        <events>
196            <trigger>
197                <EventListener event="playerSpawn" />
198            </trigger>
199        </events>
200    </EventMultiTrigger>
201
202    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
203
204    <!-- HACK: just waited out 3sec for animation. Cannot link an event to the COMPLETION of a dock. How is this not possible?? -->
205    <EventMultiTrigger name="dockedA" activations="1" stayactive="true" delay=3>
206        <events>
207            <trigger>
208                <EventListener event="dockA" />
209            </trigger>
210        </events>
211    </EventMultiTrigger>
212
213    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
214        <events>
215            <activity>
216                    <EventListener event="dockedA" />
217            </activity>
218        </events>
219    </DistanceTrigger>
220
221    <EventMultiTrigger name="wave1" activations="1" delay=4>
222        <events>
223            <trigger>
224                <EventListener event="joinedUnit" />
225            </trigger>
226        </events>
227    </EventMultiTrigger>
228
229    <!-- Recursive helper function for the end-of-wave events. F*ck the event system, seriously. -->
230    <?lua
231    function enemyTriggerRecursor(i, k)
232    if i > 0 then
233    return [[
234    <EventTrigger name=killedEnemy]] .. k .. [[.]] .. i .. [[ activations=1 stayactive=true delay=0.1>
235        <events>
236            <trigger>
237                <EventListener event=attackers]] .. k .. [[ />
238            </trigger>
239        </events>
240        ]] .. enemyTriggerRecursor(i-1, k) .. [[
241    </EventTrigger>
242    ]]
243    else return ""
244    end
245    end
246    ?>
247    <!-- Actual recursive Event(s) for the respective waves. -->
248    <?lua
249    enemies = enemiesInit
250    for k = 1, waves, 1
251    do
252    print(enemyTriggerRecursor(enemies,k))
253    ?>
254    <EventMultiTrigger name="waveClear<?lua print(k) ?>" delay=4.0>
255        <events>
256            <trigger>
257                <EventListener event="killedEnemy<?lua print(k .. [[.]] .. enemies) ?>" />
258            </trigger>
259        </events>
260    </EventMultiTrigger>
261    <?lua enemies = enemies + enemiesIncrease ?>
262    <?lua end ?>
263
264    <!-- This controls the ally AI controller so it is only active when active enemies are around! -->
265    <EventDispatcher name="allyControllerDispatcher">
266      <targets>
267        <EventTarget target="allyController" />
268      </targets>
269      <events>
270          <activity>
271              <?lua
272              for k = 1, waves, 1 do
273              ?>
274              <Trigger mode=and>
275                  <EventTrigger>
276                      <events>
277                          <trigger>
278                              <EventListener event="wave<?lua print(k) ?>" />
279                          </trigger>
280                      </events>
281                  </EventTrigger>
282                  <EventTrigger invert=true>
283                      <events>
284                          <trigger>
285                              <EventListener event="waveClear<?lua print(k) ?>" />
286                          </trigger>
287                      </events>
288                  </EventTrigger>
289              </Trigger>
290              <?lua end ?>
291          </activity>
292      </events>
293    </EventDispatcher>
294
295    <DistanceTrigger active=false name="reachedC" position="<?lua printC(cC) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
296        <events>
297            <activity>
298                <EventListener event="waveClear1" />
299            </activity>
300        </events>
301    </DistanceTrigger>
302
303    <EventMultiTrigger name="dockedC" activations="1" stayactive="true" delay=3>
304        <events>
305            <trigger>
306                <EventListener event="dockC" />
307            </trigger>
308        </events>
309    </EventMultiTrigger>
310
311    <EventMultiTrigger name="wave2" activations="1" delay=8>
312        <events>
313            <trigger>
314                <EventListener event="dockedC" />
315            </trigger>
316        </events>
317    </EventMultiTrigger>
318
319    <EventMultiTrigger name="readyAfterWave2" activations="1" delay=2 stayactive=true>
320        <events>
321            <trigger>
322                <Trigger mode=and>
323                    <EventTrigger>
324                        <events>
325                            <trigger>
326                                <EventListener event="undockC" />
327                            </trigger>
328                        </events>
329                    </EventTrigger>
330                    <EventTrigger>
331                        <events>
332                            <trigger>
333                                <EventListener event="waveClear2" />
334                            </trigger>
335                        </events>
336                    </EventTrigger>
337                </Trigger>
338            </trigger>
339        </events>
340    </EventMultiTrigger>
341
342    <!-- See the DistanceTrigger attached to the shuttle here! !-->
343
344    <EventMultiTrigger name="wave3" activations="1" delay=12>
345        <events>
346            <trigger>
347                <EventListener event="reachedShuttle" />
348            </trigger>
349        </events>
350    </EventMultiTrigger>
351
352    <DistanceTrigger active=false name="reachedB" position="<?lua printC(cB) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
353        <events>
354            <activity>
355                <EventListener event="waveClear3" />
356            </activity>
357        </events>
358    </DistanceTrigger>
359
360    <Script code="Mission endMission true" onLoad="false">
361        <events>
362            <trigger>
363                <EventListener event="reachedB" />
364            </trigger>
365        </events>
366    </Script>
367
368    <EventMultiTrigger name="missionFailed" activations="1" stayactive=true>
369        <events>
370            <trigger>
371                <EventListener event="transporter" />
372            </trigger>
373        </events>
374    </EventMultiTrigger>
375
376    <EventMultiTrigger name="failMissionHelper" delay=4 stayactive=true>
377        <events>
378            <trigger>
379                <EventListener event="missionFailed" />
380            </trigger>
381        </events>
382    </EventMultiTrigger>
383
384    <DistanceTrigger active=false name="failMission" position="<?lua printC(cA) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
385        <events>
386            <activity>
387                <EventListener event="failMissionHelper" />
388            </activity>
389        </events>
390    </DistanceTrigger>
391
392    <!--HACK: Ultimately settled on docking A to fail the mission... that makes a whole lot of sense. -->
393
394    <Script code="Mission endMission fail" onLoad="false">
395        <events>
396            <trigger>
397                <EventListener event="failMission" />
398            </trigger>
399        </events>
400    </Script>
401
402    <!--QUEST EFFECT BEACONS -->
403
404    <QuestEffectBeacon times=1>
405        <effects>
406            <AddQuest questId="quest1" />
407        </effects>
408        <events>
409            <execute>
410                <EventListener event="spawntrigger" />
411            </execute>
412        </events>
413    </QuestEffectBeacon>
414
415    <QuestEffectBeacon times=1>
416        <effects>
417            <CompleteQuest questId="quest1" />
418        </effects>
419        <events>
420            <execute>
421                <EventListener event="reachedA" />
422            </execute>
423        </events>
424    </QuestEffectBeacon>
425
426    <QuestEffectBeacon times=1>
427        <effects>
428            <CompleteQuest questId="quest2.1" />
429        </effects>
430        <events>
431            <execute>
432                <EventListener event="dockedA" />
433            </execute>
434        </events>
435    </QuestEffectBeacon>
436
437    <QuestEffectBeacon times=1>
438        <effects>
439            <CompleteQuest questId="quest2.2" />
440            <CompleteQuest questId="quest2" />
441        </effects>
442        <events>
443            <execute>
444                <EventListener event="joinedUnit" />
445            </execute>
446        </events>
447    </QuestEffectBeacon>
448
449    <QuestEffectBeacon times=1>
450        <effects>
451            <CompleteQuest questId="quest3" />
452        </effects>
453        <events>
454            <execute>
455                <EventListener event="waveClear1" />
456            </execute>
457        </events>
458    </QuestEffectBeacon>
459
460    <QuestEffectBeacon times=1>
461        <effects>
462            <CompleteQuest questId="quest4.1" />
463        </effects>
464        <events>
465            <execute>
466                <EventListener event="reachedC" />
467            </execute>
468        </events>
469    </QuestEffectBeacon>
470
471    <QuestEffectBeacon times=1>
472        <effects>
473            <CompleteQuest questId="quest4.2" />
474            <CompleteQuest questId="quest4" />
475        </effects>
476        <events>
477            <execute>
478                <EventListener event="dockedC" />
479            </execute>
480        </events>
481    </QuestEffectBeacon>
482
483    <QuestEffectBeacon times=1>
484        <effects>
485            <CompleteQuest questId="quest5" />
486        </effects>
487        <events>
488            <execute>
489                <EventListener event="waveClear2" />
490            </execute>
491        </events>
492    </QuestEffectBeacon>
493
494    <QuestEffectBeacon times=1>
495        <effects>
496            <CompleteQuest questId="quest6.1" />
497        </effects>
498        <events>
499            <execute>
500                <EventListener event="gotPickups" />
501            </execute>
502        </events>
503    </QuestEffectBeacon>
504
505    <QuestEffectBeacon times=1>
506        <effects>
507            <CompleteQuest questId="quest6.2" />
508            <CompleteQuest questId="quest6" />
509        </effects>
510        <events>
511            <execute>
512                <EventListener event="reachedShuttle" />
513            </execute>
514        </events>
515    </QuestEffectBeacon>
516
517    <QuestEffectBeacon times=1>
518        <effects>
519            <CompleteQuest questId="quest7" />
520        </effects>
521        <events>
522            <execute>
523                <EventListener event="waveClear3" />
524            </execute>
525        </events>
526    </QuestEffectBeacon>
527
528    <!--NOTIFICATIONS -->
529
530    <SimpleNotification broadcast="true" message="Welcome, Commander. Please report at Andromeda Station.">
531        <events>
532            <trigger>
533                <EventTrigger stayactive="true" delay=4 >
534                   <events>
535                      <trigger>
536                         <EventListener event="spawntrigger" />
537                      </trigger>
538                   </events>
539                </EventTrigger>
540            </trigger>
541        </events>
542    </SimpleNotification>
543
544    <SimpleNotification broadcast="true" message="Our enemy is set to attack us very soon.">
545        <events>
546            <trigger>
547                <EventTrigger stayactive="true" delay=8 >
548                   <events>
549                      <trigger>
550                         <EventListener event="spawntrigger" />
551                      </trigger>
552                   </events>
553                </EventTrigger>
554            </trigger>
555        </events>
556    </SimpleNotification>
557
558    <SimpleNotification broadcast="true" message="Please study your mission briefing!">
559        <events>
560            <trigger>
561                <EventTrigger stayactive="true" delay=12 >
562                   <events>
563                      <trigger>
564                         <EventListener event="spawntrigger" />
565                      </trigger>
566                   </events>
567                </EventTrigger>
568            </trigger>
569        </events>
570    </SimpleNotification>
571
572    <SimpleNotification broadcast="true" message="Welcome to Andromeda, Commander.">
573        <events>
574            <trigger>
575                <EventListener event="reachedA" />
576            </trigger>
577        </events>
578    </SimpleNotification>
579
580    <SimpleNotification broadcast="true" message="We've prepared a reinforced Ship for you.">
581        <events>
582            <trigger>
583                <EventTrigger stayactive="true" delay=4 >
584                   <events>
585                      <trigger>
586                         <EventListener event="reachedA" />
587                      </trigger>
588                   </events>
589                </EventTrigger>
590            </trigger>
591        </events>
592    </SimpleNotification>
593
594    <SimpleNotification broadcast="true" message="Now join our defense Team.">
595        <events>
596            <trigger>
597                <EventListener event="dockedA" />
598            </trigger>
599        </events>
600    </SimpleNotification>
601
602    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick some alien ass?">
603        <events>
604            <trigger>
605                <EventListener event="joinedUnit" />
606            </trigger>
607        </events>
608    </SimpleNotification>
609
610    <!-- HACK: Somehow only fires a second time if the (notification,event) pairs are separate! WTF -->
611    <?lua
612    for k = 1, waves, 1 do
613    ?>
614    <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
615        <events>
616            <trigger>
617                <EventListener event="wave<?lua print(k) ?>" />
618            </trigger>
619        </events>
620    </SimpleNotification>
621    <?lua end ?>
622
623    <SimpleNotification broadcast="true" message="yippie ki yay motherf*cker!">
624        <events>
625            <trigger>
626                <EventListener event="attackers1" />
627                <EventListener event="attackers2" />
628                <EventListener event="attackers3" />
629            </trigger>
630        </events>
631    </SimpleNotification>
632
633    <SimpleNotification broadcast="true" message="Phew, that was close! Well done, Commmander.">
634        <events>
635            <trigger>
636                <EventListener event="waveClear1" />
637            </trigger>
638        </events>
639    </SimpleNotification>
640
641    <SimpleNotification broadcast="true" message="But it's not over yet! Get to the defense station and dock!">
642        <events>
643            <trigger>
644                <EventTrigger stayactive="true" delay=4 >
645                   <events>
646                      <trigger>
647                         <EventListener event="waveClear1" />
648                      </trigger>
649                   </events>
650                </EventTrigger>
651            </trigger>
652        </events>
653    </SimpleNotification>
654
655    <SimpleNotification broadcast="true" message="This is our powerful reinforced cannon suit.">
656        <events>
657            <trigger>
658                <EventListener event="dockedC" />
659            </trigger>
660        </events>
661    </SimpleNotification>
662
663    <SimpleNotification broadcast="true" message="It should deal with those pesky invaders!">
664        <events>
665            <trigger>
666                <EventTrigger stayactive="true" delay=4 >
667                   <events>
668                      <trigger>
669                         <EventListener event="dockedC" />
670                      </trigger>
671                   </events>
672                </EventTrigger>
673            </trigger>
674        </events>
675    </SimpleNotification>
676
677    <SimpleNotification broadcast="true" message="Brilliant work, Commander! now undock again.">
678        <events>
679            <trigger>
680                <EventListener event="waveClear2" />
681            </trigger>
682        </events>
683    </SimpleNotification>
684
685    <SimpleNotification broadcast="true" message="Here's some supplies for you. Shoot that crate!">
686        <events>
687            <trigger>
688                <EventListener event="readyAfterWave2" />
689            </trigger>
690        </events>
691    </SimpleNotification>
692
693    <SimpleNotification broadcast="true" message="Our Intelligence reports one more wave...">
694        <events>
695            <trigger>
696                <EventListener event="reachedShuttle" />
697            </trigger>
698        </events>
699    </SimpleNotification>
700
701    <SimpleNotification broadcast="true" message="Ready to be a hero, Commander?">
702        <events>
703            <trigger>
704                <EventTrigger stayactive="true" delay=4 >
705                   <events>
706                      <trigger>
707                         <EventListener event="reachedShuttle" />
708                      </trigger>
709                   </events>
710                </EventTrigger>
711            </trigger>
712        </events>
713    </SimpleNotification>
714
715    <SimpleNotification broadcast="true" message="Congrats, Commander! You saved our skin.">
716        <events>
717            <trigger>
718                <EventListener event="waveClear3" />
719            </trigger>
720        </events>
721    </SimpleNotification>
722
723    <SimpleNotification broadcast="true" message="Get over to the safe base to take a break.">
724        <events>
725            <trigger>
726                <EventTrigger stayactive="true" delay=4 >
727                   <events>
728                      <trigger>
729                         <EventListener event="waveClear3" />
730                      </trigger>
731                   </events>
732                </EventTrigger>
733            </trigger>
734        </events>
735    </SimpleNotification>
736
737    <SimpleNotification broadcast="true" message="It's over... we failed. Retreat to Andromeda!">
738        <events>
739            <trigger>
740                <EventListener event="missionFailed" />
741            </trigger>
742        </events>
743    </SimpleNotification>
744
745    <!--STATIONS -->
746
747    <!-- (Temporary) Template for stations. Used to define common features of all Stations. -->
748    <Template name="station">
749        <Pawn mass=10000000 collisionType=dynamic friction=0.01>
750            <attached>
751                <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
752                <DistanceTriggerBeacon name="NPC" />
753            </attached>
754            <collisionShapes>
755                <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
756                <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
757                <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
758                <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
759                <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
760                <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
761                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
762                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
763                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
764                <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
765                <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
766                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
767                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
768                <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
769                <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
770                <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
771            </collisionShapes>
772        </Pawn>
773    </Template>
774
775    <!-- A, Coordinates are approx. (cos(29pi/16), sin(29pi/16), 0)*3000 -->
776    <Pawn name="statA" team=0 radarname="Andromeda Station" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" yaw=-50 initialhealth=10000 maxhealth=10000>
777        <templates>
778            <Template link="station" />
779        </templates>
780        <attached>
781            <DockingTarget name="dockTargetA" />
782            <Dock position="0,0,0" active=true>
783                <animations>
784                    <MoveToDockingTarget target="dockTargetA" />
785                </animations>
786                <effects>
787                    <DockToShip target="newSpaceShip" />
788                </effects>
789                <events>
790                    <execute>
791                        <EventListener event="dockA" />
792                    </execute>
793                </events>
794                <attached>
795                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockA" />
796                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
797                </attached>
798            </Dock>
799        </attached>
800    </Pawn>
801
802    <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
803    <Pawn name="statB" team=0 radarname="Safe Base" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" yaw=210 initialhealth=10000 maxhealth=10000>
804        <templates>
805            <Template link="station" />
806        </templates>
807        <attached>
808            <DockingTarget name="dockTargetB" />
809            <Dock position="0,0,0" active=false>
810                <animations>
811                    <MoveToDockingTarget target="dockTargetB" />
812                </animations>
813                <effects>
814                    <DockToShip target="newSpaceShip" />
815                </effects>
816                <events>
817                    <execute>
818                        <EventListener event="dockB" />
819                    </execute>
820                </events>
821                <attached>
822                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockB" />
823                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
824                </attached>
825            </Dock>
826        </attached>
827    </Pawn>
828
829    <!-- C -->
830    <Pawn name="statC" team=0 radarname="Defense Station" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
831        <templates>
832            <Template link="station" />
833        </templates>
834        <attached>
835            <DockingTarget name="dockTargetC" />
836            <Dock position="0,0,0">
837                <animations>
838                    <MoveToDockingTarget target="dockTargetC" />
839                </animations>
840                <effects>
841                    <DockToShip target="fpsMode" />
842                </effects>
843                <events>
844                    <execute>
845                        <EventListener event="dockC" />
846                    </execute>
847                </events>
848                <attached>
849                    <!--HACK: We use another dock to undock back to the ship since undocking is not implemented... -->
850                    <Dock position="0,0,0" active=true>
851                        <effects>
852                            <DockToShip target="newSpaceShip" />
853                        </effects>
854                        <events>
855                            <execute>
856                                <EventListener event="undockC" />
857                            </execute>
858                        </events>
859                    </Dock>
860                    <DistanceTrigger active=false position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockC">
861                        <events>
862                            <activity>
863                                <EventListener event="reachedC" />
864                            </activity>
865                        </events>
866                    </DistanceTrigger>
867                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
868                </attached>
869            </Dock>
870        </attached>
871    </Pawn>
872
873    <!-- New SpaceShip as destination of dock A-->
874    <SpaceShip
875            template            = "spaceshipassff"
876            team                = "0"
877            position            = "<?lua printC(cNewShip) ?>"
878            lookat              = "<?lua print(rAllies[2] .. ',' .. [[0]] .. ',' .. rAllies[1]) ?>"
879            health              = "400"
880            initialhealth       = "400"
881            maxhealth           = "1500"
882            shieldhealth        = "80"
883            initialshieldhealth = "80"
884            maxshieldhealth     = "120"
885            shieldabsorption    = "0.8"
886            reloadrate          = "1"
887            reloadwaittime      = "1"
888            name                = "newSpaceShip"
889            radarname           = "Defender" >
890        <attached>
891            <DockingTarget name="newSpaceShip" />
892            <DistanceTriggerBeacon name="newSpaceShip" />
893        </attached>
894    </SpaceShip>
895
896    <!-- FPS Player as destination of dock C -->
897    <FpsPlayer team=0 template = "fps" radarname = "Cannon Suit" position = "<?lua printC(cFPS) ?>" lookat="<?lua printC(cCenter) ?>">
898        <attached>
899            <DockingTarget name="fpsMode" />
900            <DistanceTriggerBeacon name="fpsPlayer" />
901        </attached>
902        <collisionShapes>
903            <BoxCollisionShape position="0,0,0" halfExtents="1,1,1"/>
904        </collisionShapes>
905    </FpsPlayer>
906
907    <!-- Floor for FPS Player -->
908    <StaticEntity position="<?lua printC(cFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
909        <attached>
910            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,5,80" />
911            <Billboard position="320,50,320" material="Flares/ringflare2" colour="0.2,0.4,0.8" />
912            <DistanceTrigger position="320,50,320" distance="50" target="Pawn" beaconMode="identify" targetname="fpsPlayer" name="undockC" stayactive=true />
913            <ForceField active=false position="0,0,0" mode="homogen" diameter="600" forcedirection = "0,-500,0" />
914        </attached>
915        <collisionShapes>
916            <BoxCollisionShape position="0,0,0" halfExtents="400,25,400" />
917        </collisionShapes>
918    </StaticEntity>
919
920    <!--ELEMENTS -->
921
922    <?lua
923        dofile("includes/asteroidField.lua")
924       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2000, 250, 0)
925    ?>
926
927    <?lua
928        dofile("includes/asteroidField.lua")
929       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2000, 250, 0)
930    ?>
931
932    <MovableEntity
933        position="<?lua printC(cPlanet1) ?>"
934        scale="2000"
935        collisionType="dynamic"
936        linearDamping="0.8"
937        angularDamping="0"
938        mass="5000000"
939        pitch="0"
940        rotationaxis="1,0,0"
941        rotationrate="1.0"
942        collisiondamage = 2
943        enablecollisiondamage = true
944    >
945      <attached>
946        <Planet
947            mesh="planets/muunilinst.mesh"
948            atmosphere="atmosphere1"
949            atmospheresize="80.0f"
950            imagesize="1024.0f"
951        >
952          <attached>
953            <ForceField position="0,0,0" mode="sphere" diameter="4000" velocity="-500" />
954          </attached>
955        </Planet>
956      </attached>
957      <collisionShapes>
958        <SphereCollisionShape radius="2000" position="0,0,0" />
959      </collisionShapes>
960    </MovableEntity>
961
962    <?lua
963        dofile("includes/asteroidField.lua")
964        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
965    ?>
966
967    <MovableEntity
968        position="<?lua printC(cPlanet2) ?>"
969        scale="3000"
970        collisionType="dynamic"
971        linearDamping="0.8"
972        angularDamping="0"
973        mass="5000000"
974        pitch="0"
975        rotationaxis="1,0,0"
976        rotationrate="1.0"
977        collisiondamage = 2
978        enablecollisiondamage = true
979    >
980      <attached>
981        <Planet
982            mesh="planets/planet3.mesh"
983            atmosphere="atmosphere1"
984            atmospheresize="80.0f"
985            imagesize="1024.0f"
986          >
987          <attached>
988            <ForceField position="0,0,0" mode="sphere" diameter="6000" velocity="-500" />
989          </attached>
990        </Planet>
991      </attached>
992      <collisionShapes>
993        <SphereCollisionShape radius="3000" position="0,0,0" />
994      </collisionShapes>
995    </MovableEntity>
996
997    <?lua
998        dofile("includes/asteroidField.lua")
999        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
1000    ?>
1001
1002    <Pawn team=0 health=30 position="<?lua print((cC[1]+600) .. ',' .. cC[2] .. ',' .. (cC[3]-600)) ?>" direction="0,-1,0" collisionType=dynamic mass=1000 radarname="Supplies" name="gotPickups">
1003        <events>
1004            <visibility>
1005                <EventListener event="readyAfterWave2" />
1006            </visibility>
1007            <activity>
1008                <EventListener event="readyAfterWave2" />
1009            </activity>
1010        </events>
1011        <attached>
1012            <Model position="0,0,0" mesh="crate.mesh" scale3D="10,10,10" />
1013        </attached>
1014        <collisionShapes>
1015            <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
1016        </collisionShapes>
1017    </Pawn>
1018
1019    <?lua
1020        include("includes/pickups.oxi")
1021    ?>
1022
1023    <PickupSpawner pickup=hugeshieldpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-585)) ?>" triggerDistance="15" maxSpawnedItems="1">
1024        <events>
1025            <visibility>
1026                <EventListener event="readyAfterWave2" />
1027            </visibility>
1028            <activity>
1029                <EventListener event="readyAfterWave2" />
1030            </activity>
1031        </events>
1032    </PickupSpawner>
1033
1034    <PickupSpawner pickup=crazyhealthpickup position="<?lua print((cC[1]+615) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1">
1035        <events>
1036            <visibility>
1037                <EventListener event="readyAfterWave2" />
1038            </visibility>
1039            <activity>
1040                <EventListener event="readyAfterWave2" />
1041            </activity>
1042        </events>
1043    </PickupSpawner>
1044
1045    <PickupSpawner pickup=hugespeedpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1" >
1046        <events>
1047            <visibility>
1048                <EventListener event="readyAfterWave2" />
1049            </visibility>
1050            <activity>
1051                <EventListener event="readyAfterWave2" />
1052            </activity>
1053        </events>
1054    </PickupSpawner>
1055
1056    <!-- Allies -->
1057    <?lua
1058    for i = 1, allies, 1
1059    do
1060    x = rAllies[1] + math.cos(2*math.pi/allies*(i+1))*100
1061    y = rAllies[2] + math.sin(2*math.pi/allies*(i+1))*100
1062    ?>
1063    <SpaceShip visible=false active=false name="allies<?lua print(k)?>" radarname="Ally" position="<?lua print(y)?>,<?lua print(math.pow(-1,i)*100) ?>,<?lua print(x)?>" lookat="0,0,0" team=0>
1064        <templates>
1065            <Template link="spaceshipassff" />
1066        </templates>
1067        <events>
1068            <visibility>
1069                <EventListener event="dockedA" />
1070            </visibility>
1071            <activity>
1072                <EventListener event="dockedA" />
1073            </activity>
1074        </events>
1075        <attached>
1076            <DistanceTriggerBeacon name="NPC" />
1077        </attached>
1078        <controller>
1079            <!-- also see allyControllerDispatcher -->
1080            <AIController name="allyController" accuracy=100 team=0 active=false />
1081        </controller>
1082    </SpaceShip>
1083    <?lua end ?>
1084
1085    <!-- Enemies. Outer loop defines waves, inner loop defines enemies in every wave. -->
1086    <?lua
1087    enemies = enemiesInit
1088    for k = 1, waves, 1
1089    do
1090    ?>
1091    <?lua
1092    for i = 1, enemies, 1
1093    do
1094    x = math.cos(math.pi/(2*enemies - 2)*(i+k))*1500
1095    y = math.sin(math.pi/(2*enemies - 2)*(i+k))*1500
1096    ?>
1097    <SpaceShip visible=false active=false name="attackers<?lua print(k)?>" radarname="Attacker" position="<?lua print(y)?>,<?lua print(math.pow(-1,i)*250) ?>,<?lua print(x)?>" lookat="0,0,0" team=1>
1098        <templates>
1099            <Template link="spaceshippirate" />
1100        </templates>
1101        <events>
1102            <visibility>
1103                <EventListener event="wave<?lua print(k)?>" />
1104            </visibility>
1105            <activity>
1106                <EventListener event="wave<?lua print(k)?>" />
1107            </activity>
1108        </events>
1109        <attached>
1110            <DistanceTriggerBeacon name="NPC" />
1111        </attached>
1112        <controller>
1113            <WaypointPatrolController name="attackController" accuracy=100 alertnessradius=100 team=1 active=false>
1114                <waypoints>
1115                    <Attacher target="transporter" deletewithparent=false />
1116                </waypoints>
1117                <events>
1118                    <activity>
1119                        <EventListener event="wave<?lua print(k)?>" />
1120                    </activity>
1121                </events>
1122            </WaypointPatrolController>
1123        </controller>
1124    </SpaceShip>
1125    <?lua end ?>
1126    <?lua
1127    enemies = enemies + enemiesIncrease
1128    end ?>
1129
1130    <!-- Transporter, starting Point is near A, end Point near B, the circle parameters for the waypoints are: Center = (0, -887, 0), r = 2613 -->
1131    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle" >
1132        <templates>
1133            <Template link="spaceshipShuttle" />
1134        </templates>
1135        <attached>
1136            <DistanceTriggerBeacon name="NPC" />
1137            <DistanceTriggerBeacon name="transporter" />
1138            <DistanceTrigger active=false name="reachedShuttle" position="0,0,0" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true initialhealth=1000 maxhealth=1000>
1139                <events>
1140                    <activity>
1141                        <EventListener event="readyAfterWave2" />
1142                    </activity>
1143                </events>
1144            </DistanceTrigger>
1145        </attached>
1146        <controller>
1147            <WaypointController accuracy=10 team=0>
1148                <waypoints>
1149                    <!-- A to B -->
1150                    <?lua
1151                    max = 5
1152                    for i = 1, max, 1
1153                    do
1154                    x = math.cos(math.pi*(i+1)/8)*5000
1155                    y = -math.sin(math.pi*(i+1)/8)*700-3000
1156                    ?>
1157                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
1158                    <?lua end ?>
1159
1160                    <!-- Return Point -->
1161                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
1162
1163                    <!-- B to A -->
1164                    <?lua
1165                    max = 5
1166                    for i = 1, max, 1
1167                    do
1168                    x = math.cos(math.pi*(max+2-i)/8)*5000
1169                    y = -math.sin(math.pi*(max+2-i)/8)*700-3000
1170                    ?>
1171                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
1172                    <?lua end ?>
1173
1174                    <!-- Start Point -->
1175                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
1176                </waypoints>
1177            </WaypointController>
1178        </controller>
1179    </SpaceShip>
1180
1181    </Scene>
1182</Level>
Note: See TracBrowser for help on using the repository browser.