Index: code/branches/campaignHS15/data/levels/Campaign1.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/Campaign1.oxw	(revision 10823)
+++ 	(revision )
@@ -1,1172 +1,0 @@
-<!--TODO: Rename screenshot as soon as it is in data_extern branch -->
-<!--TODO: Shuttle and Stations -->
-<LevelInfo
-    name = "Shuttle under Attack"
-    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."
-    tags = "mission"
-    screenshot = "missionOne.png"
-/>
-
-<?lua
-    include("stats.oxo")
-    include("HUDTemplates3.oxo")
-    include("templates/lodInformation.oxt")
-
-    include("templates/spaceshipAssff.oxt")
-    include("templates/spaceshipPirate.oxt")
-    include("templates/spaceshipEscort.oxt")
-    include("templates/spaceshipShuttle.oxt")
-    include("templates/FPS.oxt")
-    include("templates/pickupRepresentationTemplates.oxt")
-?>
-
-<Level gametype = "Mission">
-    <templates>
-        <Template link="lodtemplate_default" />
-    </templates>
-
-    <?lua include("includes/notifications.oxi") ?>
-
-    <NotificationQueueCEGUI
-        name="narrative"
-        targets="simpleNotification"
-        size=3
-        displayTime=3.9
-        position="0.15, 0, 0.1, 0"
-        fontSize="15"
-        fontColor="0.3, 1, 0.2, 0.8"
-        alignment="HorzCentred"
-        displaySize="0.7, 0, 0, 0"
-    />
-
-    <!-- GLOBAL LUA VARIABLES -->
-    <?lua
-        waves = 3
-        enemiesInit = 5
-        enemiesIncrease = 2
-        allies = 3
-
-        --[[ Coordinates in (y,z,x). NOTE: Indexing starts at 1 in lua! Don´t forget to adapt the for loops, too! ]]--
-        cCenter = {0, 0, 0}
-        cSpawn = {-50, 0, 0}
-        cUnit = {-2000, 0, 3000}
-        cA = {-3000, 0, 5000}
-        cB = {-3000, 0, -5000}
-        cC = {-2300, 0, 0}
-        dStation = {1, 0, 0}
-        cNewShip = {-2100, 0, 4100}
-        cFPSGround = {-2300, 800, 0}
-        cFPS = {-2300, 1000, 0}
-        cField1 = {400, 0, 2500}
-        cField2 = {400, 0, -2500}
-        cPlanet1 = {8000, -2000, 15000}
-        cPlanet2 = {-20000, 4000, -1000}
-        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r. Do not permute! ]]--
-
-        --[[ Function to print Coordinates. Quotes not included! ]]--
-        function printC(coord)
-          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
-        end
-    ?>
-
-    <Scene
-        ambientlight = "0.8, 0.8, 0.8"
-        skybox = "Orxonox/skyBoxMoreNebula"
-        hasPhysics = true
-    >
-
-    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cA) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
-
-    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
-
-    <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"/>
-
-    <!--QUEST DEFINITIONS-->
-
-    <GlobalQuest id="quest1">
-        <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="" />
-        <hints>
-        </hints>
-        <complete-effects>
-            <AddQuest questId="quest2" />
-            <AddQuest questId="quest2.1" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest2">
-        <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="" />
-        <hints>
-        </hints>
-        <subquests>
-            <GlobalQuest id="quest2.1">
-                <QuestDescription title="> Get a better Spaceship" description="Take over the faster, stronger, more secure and overall better spaceship!" failMessage="" completeMessage="" />
-                <complete-effects>
-                    <AddQuest questId="quest2.2" />
-                </complete-effects>
-            </GlobalQuest>
-            <GlobalQuest id="quest2.2">
-                <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="" />
-            </GlobalQuest>
-        </subquests>
-        <complete-effects>
-            <AddQuest questId="quest3" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest3">
-        <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!" />
-        <hints>
-        </hints>
-        <complete-effects>
-            <AddQuest questId="quest4" />
-            <AddQuest questId="quest4.1" />
-            <AddQuest questId="quest4.2" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest4">
-        <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="" />
-        <hints>
-        </hints>
-        <subquests>
-            <GlobalQuest id="quest4.1">
-                <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="" />
-            </GlobalQuest>
-            <GlobalQuest id="quest4.2">
-                <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="" />
-            </GlobalQuest>
-        </subquests>
-        <complete-effects>
-            <AddQuest questId="quest5" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest5">
-        <QuestDescription title="Fight the Hord!" description="Destroy the next wave!" failMessage="" completeMessage="" />
-        <hints>
-        </hints>
-        <complete-effects>
-            <AddQuest questId="quest6" />
-            <AddQuest questId="quest6.1" />
-            <AddQuest questId="quest6.2" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest6">
-        <QuestDescription title="Get back for the Showdown" description="Undock from the defense station and get into your Spaceship!" failMessage="" completeMessage="" />
-        <hints>
-        </hints>
-        <subquests>
-            <GlobalQuest id="quest6.1">
-                <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="" />
-            </GlobalQuest>
-            <GlobalQuest id="quest6.2">
-                <QuestDescription title="> Get back to the Shuttle" description="Fly to the Shuttle!" failMessage="" completeMessage="" />
-            </GlobalQuest>
-        </subquests>
-        <complete-effects>
-            <AddQuest questId="quest7" />
-        </complete-effects>
-    </GlobalQuest>
-
-    <GlobalQuest id="quest7">
-        <QuestDescription title="Fight the final Wave" description="Good gracious, another hord of pirate ships!" failMessage="" completeMessage="" />
-        <hints>
-        </hints>
-        <subquests>
-        </subquests>
-    </GlobalQuest>
-
-    <!--EVENTS AND TRIGGERS
-        Usable events and triggers:
-        _spawntrigger
-        _reachedA
-        _dock<A|B|C>
-        _docked<A>      WIP; see below
-        -joinedUnit
-        _wave<k>
-        _killedEnemy<k>.<i>
-        _waveClear<k>
-    -->
-
-
-
-    <EventMultiTrigger name="spawntrigger">
-        <events>
-            <trigger>
-                <EventListener event="playerSpawn" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
-
-    <!-- HACK: just waited out 3sec for animation. Cannot link an event to the COMPLETION of a dock. How is this not possible?? -->
-    <EventMultiTrigger name="dockedA" activations="1" stayactive="true" delay=3>
-        <events>
-            <trigger>
-                <EventListener event="dockA" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
-        <events>
-            <activity>
-                    <EventListener event="dockedA" />
-            </activity>
-        </events>
-    </DistanceTrigger>
-
-    <EventMultiTrigger name="wave1" activations="1" delay=4>
-        <events>
-            <trigger>
-                <EventListener event="joinedUnit" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <!-- Recursive helper function for the end-of-wave events. F*ck the event system, seriously. -->
-    <?lua
-    function enemyTriggerRecursor(i, k)
-    if i > 0 then
-    return [[
-    <EventTrigger name=killedEnemy]] .. k .. [[.]] .. i .. [[ activations=1 stayactive=true delay=0.1>
-        <events>
-            <trigger>
-                <EventListener event=attackers]] .. k .. [[ />
-            </trigger>
-        </events>
-        ]] .. enemyTriggerRecursor(i-1, k) .. [[
-    </EventTrigger>
-    ]]
-    else return ""
-    end
-    end
-    ?>
-    <!-- Actual recursive Event(s) for the respective waves. -->
-    <?lua
-    enemies = enemiesInit
-    for k = 1, waves, 1
-    do
-    print(enemyTriggerRecursor(enemies,k))
-    ?>
-    <EventMultiTrigger name="waveClear<?lua print(k) ?>" delay=4.0>
-        <events>
-            <trigger>
-                <EventListener event="killedEnemy<?lua print(k .. [[.]] .. enemies) ?>" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-    <?lua enemies = enemies + enemiesIncrease ?>
-    <?lua end ?>
-
-    <!-- This controls the ally AI controller so it is only active when active enemies are around! -->
-    <EventDispatcher name="allyControllerDispatcher">
-      <targets>
-        <EventTarget target="allyController" />
-      </targets>
-      <events>
-          <activity>
-              <?lua
-              for k = 1, waves, 1 do
-              ?>
-              <Trigger mode=and>
-                  <EventTrigger>
-                      <events>
-                          <trigger>
-                              <EventListener event="wave<?lua print(k) ?>" />
-                          </trigger>
-                      </events>
-                  </EventTrigger>
-                  <EventTrigger invert=true>
-                      <events>
-                          <trigger>
-                              <EventListener event="waveClear<?lua print(k) ?>" />
-                          </trigger>
-                      </events>
-                  </EventTrigger>
-              </Trigger>
-              <?lua end ?>
-          </activity>
-      </events>
-    </EventDispatcher>
-
-    <DistanceTrigger active=false name="reachedC" position="<?lua printC(cC) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
-        <events>
-            <activity>
-                <EventListener event="waveClear1" />
-            </activity>
-        </events>
-    </DistanceTrigger>
-
-    <EventMultiTrigger name="dockedC" activations="1" stayactive="true" delay=3>
-        <events>
-            <trigger>
-                <EventListener event="dockC" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <EventMultiTrigger name="wave2" activations="1" delay=8>
-        <events>
-            <trigger>
-                <EventListener event="dockedC" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <EventMultiTrigger name="readyAfterWave2" activations="1" delay=2 stayactive=true>
-        <events>
-            <trigger>
-                <Trigger mode=and>
-                    <EventTrigger>
-                        <events>
-                            <trigger>
-                                <EventListener event="undockC" />
-                            </trigger>
-                        </events>
-                    </EventTrigger>
-                    <EventTrigger>
-                        <events>
-                            <trigger>
-                                <EventListener event="waveClear2" />
-                            </trigger>
-                        </events>
-                    </EventTrigger>
-                </Trigger>
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <!-- See the DistanceTrigger attached to the shuttle here! !-->
-
-    <EventMultiTrigger name="wave3" activations="1" delay=12>
-        <events>
-            <trigger>
-                <EventListener event="reachedShuttle" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <DistanceTrigger active=false name="reachedB" position="<?lua printC(cB) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
-        <events>
-            <activity>
-                <EventListener event="waveClear3" />
-            </activity>
-        </events>
-    </DistanceTrigger>
-
-    <Script code="Mission endMission true" onLoad="false">
-        <events>
-            <trigger>
-                <EventListener event="reachedB" />
-            </trigger>
-        </events>
-    </Script>
-
-    <EventMultiTrigger name="missionFailed" activations="1" stayactive=true>
-        <events>
-            <trigger>
-                <EventListener event="transporter" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <EventMultiTrigger name="failMissionHelper" delay=4 stayactive=true>
-        <events>
-            <trigger>
-                <EventListener event="missionFailed" />
-            </trigger>
-        </events>
-    </EventMultiTrigger>
-
-    <DistanceTrigger active=false name="failMission" position="<?lua printC(cA) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
-        <events>
-            <activity>
-                <EventListener event="failMissionHelper" />
-            </activity>
-        </events>
-    </DistanceTrigger>
-
-    <!--HACK: Ultimately settled on docking A to fail the mission... that makes a whole lot of sense. -->
-
-    <Script code="Mission endMission fail" onLoad="false">
-        <events>
-            <trigger>
-                <EventListener event="failMission" />
-            </trigger>
-        </events>
-    </Script>
-
-    <!--QUEST EFFECT BEACONS -->
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <AddQuest questId="quest1" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="spawntrigger" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest1" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="reachedA" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest2.1" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="dockedA" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest2.2" />
-            <CompleteQuest questId="quest2" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="joinedUnit" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest3" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="waveClear1" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest4.1" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="reachedC" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest4.2" />
-            <CompleteQuest questId="quest4" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="dockedC" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest5" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="waveClear2" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest6.1" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="gotPickups" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest6.2" />
-            <CompleteQuest questId="quest6" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="reachedShuttle" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <QuestEffectBeacon times=1>
-        <effects>
-            <CompleteQuest questId="quest7" />
-        </effects>
-        <events>
-            <execute>
-                <EventListener event="waveClear3" />
-            </execute>
-        </events>
-    </QuestEffectBeacon>
-
-    <!--NOTIFICATIONS -->
-
-    <SimpleNotification broadcast="true" message="Welcome, Commander. Please report at Andromeda Station.">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="spawntrigger" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Our enemy is set to attack us very soon.">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=8 >
-                   <events>
-                      <trigger>
-                         <EventListener event="spawntrigger" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Please study your mission briefing!">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=12 >
-                   <events>
-                      <trigger>
-                         <EventListener event="spawntrigger" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Welcome to Andromeda, Commander.">
-        <events>
-            <trigger>
-                <EventListener event="reachedA" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="We've prepared a reinforced Ship for you.">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="reachedA" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Now join our defense Team.">
-        <events>
-            <trigger>
-                <EventListener event="dockedA" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick some alien ass?">
-        <events>
-            <trigger>
-                <EventListener event="joinedUnit" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <!-- HACK: Somehow only fires a second time if the (notification,event) pairs are separate! WTF -->
-    <?lua
-    for k = 1, waves, 1 do
-    ?>
-    <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
-        <events>
-            <trigger>
-                <EventListener event="wave<?lua print(k) ?>" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-    <?lua end ?>
-
-    <SimpleNotification broadcast="true" message="yippie ki yay motherf*cker!">
-        <events>
-            <trigger>
-                <EventListener event="attackers1" />
-                <EventListener event="attackers2" />
-                <EventListener event="attackers3" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Phew, that was close! Well done, Commmander.">
-        <events>
-            <trigger>
-                <EventListener event="waveClear1" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="But it's not over yet! Get to the defense station and dock!">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="waveClear1" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="This is our powerful reinforced cannon suit.">
-        <events>
-            <trigger>
-                <EventListener event="dockedC" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="It should deal with those pesky invaders!">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="dockedC" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Brilliant work, Commander! now undock again.">
-        <events>
-            <trigger>
-                <EventListener event="waveClear2" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Here's some supplies for you. Shoot that crate!">
-        <events>
-            <trigger>
-                <EventListener event="readyAfterWave2" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Our Intelligence reports one more wave...">
-        <events>
-            <trigger>
-                <EventListener event="reachedShuttle" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Ready to be a hero, Commander?">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="reachedShuttle" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Congrats, Commander! You saved our skin.">
-        <events>
-            <trigger>
-                <EventListener event="waveClear3" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="Get over to the safe base to take a break.">
-        <events>
-            <trigger>
-                <EventTrigger stayactive="true" delay=4 >
-                   <events>
-                      <trigger>
-                         <EventListener event="waveClear3" />
-                      </trigger>
-                   </events>
-                </EventTrigger>
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification broadcast="true" message="It's over... we failed. Retreat to Andromeda!">
-        <events>
-            <trigger>
-                <EventListener event="missionFailed" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <!--STATIONS -->
-
-    <!-- (Temporary) Template for stations. Used to define common features of all Stations. -->
-    <Template name="station">
-        <Pawn mass=10000000 collisionType=dynamic friction=0.01>
-            <attached>
-                <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
-                <DistanceTriggerBeacon name="NPC" />
-            </attached>
-            <collisionShapes>
-                <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
-                <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
-                <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
-                <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
-                <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
-                <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
-                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
-                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
-                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
-                <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
-                <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
-                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
-                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
-                <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
-                <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
-                <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
-            </collisionShapes>
-        </Pawn>
-    </Template>
-
-    <!-- A, Coordinates are approx. (cos(29pi/16), sin(29pi/16), 0)*3000 -->
-    <Pawn name="statA" team=0 radarname="Andromeda Station" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" yaw=-50 initialhealth=10000 maxhealth=10000>
-        <templates>
-            <Template link="station" />
-        </templates>
-        <attached>
-            <DockingTarget name="dockTargetA" />
-            <Dock position="0,0,0" active=true>
-                <animations>
-                    <MoveToDockingTarget target="dockTargetA" />
-                </animations>
-                <effects>
-                    <DockToShip target="newSpaceShip" />
-                </effects>
-                <events>
-                    <execute>
-                        <EventListener event="dockA" />
-                    </execute>
-                </events>
-                <attached>
-                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockA" />
-                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
-                </attached>
-            </Dock>
-        </attached>
-    </Pawn>
-
-    <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
-    <Pawn name="statB" team=0 radarname="Safe Base" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" yaw=210 initialhealth=10000 maxhealth=10000>
-        <templates>
-            <Template link="station" />
-        </templates>
-        <attached>
-            <DockingTarget name="dockTargetB" />
-            <Dock position="0,0,0" active=false>
-                <animations>
-                    <MoveToDockingTarget target="dockTargetB" />
-                </animations>
-                <effects>
-                    <DockToShip target="newSpaceShip" />
-                </effects>
-                <events>
-                    <execute>
-                        <EventListener event="dockB" />
-                    </execute>
-                </events>
-                <attached>
-                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockB" />
-                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
-                </attached>
-            </Dock>
-        </attached>
-    </Pawn>
-
-    <!-- C -->
-    <Pawn name="statC" team=0 radarname="Defense Station" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
-        <templates>
-            <Template link="station" />
-        </templates>
-        <attached>
-            <DockingTarget name="dockTargetC" />
-            <Dock position="0,0,0">
-                <animations>
-                    <MoveToDockingTarget target="dockTargetC" />
-                </animations>
-                <effects>
-                    <DockToShip target="fpsMode" />
-                </effects>
-                <events>
-                    <execute>
-                        <EventListener event="dockC" />
-                    </execute>
-                </events>
-                <attached>
-                    <!--HACK: We use another dock to undock back to the ship since undocking is not implemented... -->
-                    <Dock position="0,0,0" active=true>
-                        <effects>
-                            <DockToShip target="newSpaceShip" />
-                        </effects>
-                        <events>
-                            <execute>
-                                <EventListener event="undockC" />
-                            </execute>
-                        </events>
-                    </Dock>
-                    <DistanceTrigger active=false position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockC">
-                        <events>
-                            <activity>
-                                <EventListener event="reachedC" />
-                            </activity>
-                        </events>
-                    </DistanceTrigger>
-                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
-                </attached>
-            </Dock>
-        </attached>
-    </Pawn>
-
-    <!-- New SpaceShip as destination of dock A-->
-    <SpaceShip
-            template            = "spaceshipassff"
-            team                = "0"
-            position            = "<?lua printC(cNewShip) ?>"
-            lookat              = "<?lua print(rAllies[2] .. ',' .. [[0]] .. ',' .. rAllies[1]) ?>"
-            health              = "400"
-            initialhealth       = "400"
-            maxhealth           = "1500"
-            shieldhealth        = "80"
-            initialshieldhealth = "80"
-            maxshieldhealth     = "120"
-            shieldabsorption    = "0.8"
-            reloadrate          = "1"
-            reloadwaittime      = "1"
-            name                = "newSpaceShip"
-            radarname           = "Defender" >
-        <attached>
-            <DockingTarget name="newSpaceShip" />
-            <DistanceTriggerBeacon name="newSpaceShip" />
-        </attached>
-    </SpaceShip>
-
-    <!-- FPS Player as destination of dock C -->
-    <FpsPlayer team=0 template = "fps" radarname = "Cannon Suit" position = "<?lua printC(cFPS) ?>" lookat="<?lua printC(cCenter) ?>">
-        <attached>
-            <DockingTarget name="fpsMode" />
-            <DistanceTriggerBeacon name="fpsPlayer" />
-        </attached>
-        <collisionShapes>
-            <BoxCollisionShape position="0,0,0" halfExtents="1,1,1"/>
-        </collisionShapes>
-    </FpsPlayer>
-
-    <!-- Floor for FPS Player -->
-    <StaticEntity position="<?lua printC(cFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
-        <attached>
-            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,5,80" />
-            <Billboard position="320,50,320" material="Flares/ringflare2" colour="0.2,0.4,0.8" />
-    	    <DistanceTrigger position="320,50,320" distance="50" target="Pawn" beaconMode="identify" targetname="fpsPlayer" name="undockC" stayactive=true />
-            <ForceField active=false position="0,0,0" mode="homogen" diameter="600" forcedirection = "0,-500,0" />
-        </attached>
-        <collisionShapes>
-            <BoxCollisionShape position="0,0,0" halfExtents="400,25,400" />
-        </collisionShapes>
-    </StaticEntity>
-
-    <!--ELEMENTS -->
-
-    <?lua
-        dofile("includes/asteroidField.lua")
-       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2000, 250, 0)
-    ?>
-
-    <?lua
-        dofile("includes/asteroidField.lua")
-       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2000, 250, 0)
-    ?>
-
-    <Planet
-        position="<?lua printC(cPlanet1) ?>"
-        scale="2000"
-        collisionType="dynamic"
-        linearDamping="0.8"
-        angularDamping="0"
-        mass="5000000"
-        pitch="0"
-        mesh="planets/muunilinst.mesh"
-        atmosphere="atmosphere1"
-        rotationaxis="1,0,0"
-        rotationrate="1.0"
-        atmospheresize="80.0f"
-        imagesize="1024.0f"
-        collisiondamage = 2
-        enablecollisiondamage = true
-      >
-      <attached>
-        <ForceField position="0,0,0" mode="sphere" diameter="4000" velocity="-500" />
-        </attached>
-          <collisionShapes>
-            <SphereCollisionShape radius="2000" position="0,0,0" />
-      </collisionShapes>
-    </Planet>
-
-    <?lua
-        dofile("includes/asteroidField.lua")
-        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
-    ?>
-
-    <Planet
-        position="<?lua printC(cPlanet2) ?>"
-        scale="3000"
-        collisionType="dynamic"
-        linearDamping="0.8"
-        angularDamping="0"
-        mass="5000000"
-        pitch="0"
-        mesh="planets/planet3.mesh"
-        atmosphere="atmosphere1"
-        rotationaxis="1,0,0"
-        rotationrate="1.0"
-        atmospheresize="80.0f"
-        imagesize="1024.0f"
-        collisiondamage = 2
-        enablecollisiondamage = true
-      >
-      <attached>
-        <ForceField position="0,0,0" mode="sphere" diameter="6000" velocity="-500" />
-        </attached>
-          <collisionShapes>
-            <SphereCollisionShape radius="3000" position="0,0,0" />
-      </collisionShapes>
-    </Planet>
-
-    <?lua
-        dofile("includes/asteroidField.lua")
-        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
-    ?>
-
-    <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">
-        <events>
-            <visibility>
-                <EventListener event="readyAfterWave2" />
-            </visibility>
-            <activity>
-                <EventListener event="readyAfterWave2" />
-            </activity>
-        </events>
-        <attached>
-            <Model position="0,0,0" mesh="crate.mesh" scale3D="10,10,10" />
-        </attached>
-        <collisionShapes>
-            <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
-        </collisionShapes>
-    </Pawn>
-
-    <?lua
-        include("includes/pickups.oxi")
-    ?>
-
-    <PickupSpawner pickup=hugeshieldpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-585)) ?>" triggerDistance="15" maxSpawnedItems="1">
-        <events>
-            <visibility>
-                <EventListener event="readyAfterWave2" />
-            </visibility>
-            <activity>
-                <EventListener event="readyAfterWave2" />
-            </activity>
-        </events>
-    </PickupSpawner>
-
-    <PickupSpawner pickup=crazyhealthpickup position="<?lua print((cC[1]+615) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1">
-        <events>
-            <visibility>
-                <EventListener event="readyAfterWave2" />
-            </visibility>
-            <activity>
-                <EventListener event="readyAfterWave2" />
-            </activity>
-        </events>
-    </PickupSpawner>
-
-    <PickupSpawner pickup=hugespeedpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1" >
-        <events>
-            <visibility>
-                <EventListener event="readyAfterWave2" />
-            </visibility>
-            <activity>
-                <EventListener event="readyAfterWave2" />
-            </activity>
-        </events>
-    </PickupSpawner>
-
-    <!-- Allies -->
-    <?lua
-    for i = 1, allies, 1
-    do
-    x = rAllies[1] + math.cos(2*math.pi/allies*(i+1))*100
-    y = rAllies[2] + math.sin(2*math.pi/allies*(i+1))*100
-    ?>
-    <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>
-        <templates>
-            <Template link="spaceshipassff" />
-        </templates>
-        <events>
-            <visibility>
-                <EventListener event="dockedA" />
-            </visibility>
-            <activity>
-                <EventListener event="dockedA" />
-            </activity>
-        </events>
-        <attached>
-            <DistanceTriggerBeacon name="NPC" />
-        </attached>
-        <controller>
-            <!-- also see allyControllerDispatcher -->
-            <AIController name="allyController" accuracy=100 team=0 active=false />
-        </controller>
-    </SpaceShip>
-    <?lua end ?>
-
-    <!-- Enemies. Outer loop defines waves, inner loop defines enemies in every wave. -->
-    <?lua
-    enemies = enemiesInit
-    for k = 1, waves, 1
-    do
-    ?>
-    <?lua
-    for i = 1, enemies, 1
-    do
-    x = math.cos(math.pi/(2*enemies - 2)*(i+k))*1500
-    y = math.sin(math.pi/(2*enemies - 2)*(i+k))*1500
-    ?>
-    <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>
-        <templates>
-            <Template link="spaceshippirate" />
-        </templates>
-        <events>
-            <visibility>
-                <EventListener event="wave<?lua print(k)?>" />
-            </visibility>
-            <activity>
-                <EventListener event="wave<?lua print(k)?>" />
-            </activity>
-        </events>
-        <attached>
-            <DistanceTriggerBeacon name="NPC" />
-        </attached>
-        <controller>
-            <WaypointPatrolController name="attackController" accuracy=100 alertnessradius=100 team=1 active=false>
-                <waypoints>
-                    <Attacher target="transporter" deletewithparent=false />
-                </waypoints>
-                <events>
-                    <activity>
-                        <EventListener event="wave<?lua print(k)?>" />
-                    </activity>
-                </events>
-            </WaypointPatrolController>
-        </controller>
-    </SpaceShip>
-    <?lua end ?>
-    <?lua
-    enemies = enemies + enemiesIncrease
-    end ?>
-
-    <!-- Transporter, starting Point is near A, end Point near B, the circle parameters for the waypoints are: Center = (0, -887, 0), r = 2613 -->
-    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle" >
-        <templates>
-            <Template link="spaceshipShuttle" />
-        </templates>
-        <attached>
-            <DistanceTriggerBeacon name="NPC" />
-            <DistanceTriggerBeacon name="transporter" />
-            <DistanceTrigger active=false name="reachedShuttle" position="0,0,0" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true initialhealth=1000 maxhealth=1000>
-                <events>
-                    <activity>
-                        <EventListener event="readyAfterWave2" />
-                    </activity>
-                </events>
-            </DistanceTrigger>
-        </attached>
-        <controller>
-            <WaypointController accuracy=10 team=0>
-                <waypoints>
-                    <!-- A to B -->
-                    <?lua
-                    max = 5
-                    for i = 1, max, 1
-                    do
-                    x = math.cos(math.pi*(i+1)/8)*5000
-                    y = -math.sin(math.pi*(i+1)/8)*700-3000
-                    ?>
-                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
-                    <?lua end ?>
-
-                    <!-- Return Point -->
-                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
-
-                    <!-- B to A -->
-                    <?lua
-                    max = 5
-                    for i = 1, max, 1
-                    do
-                    x = math.cos(math.pi*(max+2-i)/8)*5000
-                    y = -math.sin(math.pi*(max+2-i)/8)*700-3000
-                    ?>
-                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
-                    <?lua end ?>
-
-                    <!-- Start Point -->
-                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
-                </waypoints>
-            </WaypointController>
-        </controller>
-    </SpaceShip>
-
-    </Scene>
-</Level>
Index: code/branches/campaignHS15/data/levels/shuttleAttack.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/shuttleAttack.oxw	(revision 10824)
+++ code/branches/campaignHS15/data/levels/shuttleAttack.oxw	(revision 10824)
@@ -0,0 +1,1172 @@
+<!--TODO: Rename screenshot as soon as it is in data_extern branch -->
+<!--TODO: Shuttle and Stations -->
+<LevelInfo
+    name = "Shuttle under Attack"
+    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."
+    tags = "mission"
+    screenshot = "missionOne.png"
+/>
+
+<?lua
+    include("stats.oxo")
+    include("HUDTemplates3.oxo")
+    include("templates/lodInformation.oxt")
+
+    include("templates/spaceshipAssff.oxt")
+    include("templates/spaceshipPirate.oxt")
+    include("templates/spaceshipEscort.oxt")
+    include("templates/spaceshipShuttle.oxt")
+    include("templates/FPS.oxt")
+    include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<Level gametype = "Mission">
+    <templates>
+        <Template link="lodtemplate_default" />
+    </templates>
+
+    <?lua include("includes/notifications.oxi") ?>
+
+    <NotificationQueueCEGUI
+        name="narrative"
+        targets="simpleNotification"
+        size=3
+        displayTime=3.9
+        position="0.15, 0, 0.1, 0"
+        fontSize="15"
+        fontColor="0.3, 1, 0.2, 0.8"
+        alignment="HorzCentred"
+        displaySize="0.7, 0, 0, 0"
+    />
+
+    <!-- GLOBAL LUA VARIABLES -->
+    <?lua
+        waves = 3
+        enemiesInit = 5
+        enemiesIncrease = 2
+        allies = 3
+
+        --[[ Coordinates in (y,z,x). NOTE: Indexing starts at 1 in lua! Don´t forget to adapt the for loops, too! ]]--
+        cCenter = {0, 0, 0}
+        cSpawn = {-50, 0, 0}
+        cUnit = {-2000, 0, 3000}
+        cA = {-3000, 0, 5000}
+        cB = {-3000, 0, -5000}
+        cC = {-2300, 0, 0}
+        dStation = {1, 0, 0}
+        cNewShip = {-2100, 0, 4100}
+        cFPSGround = {-2300, 800, 0}
+        cFPS = {-2300, 1000, 0}
+        cField1 = {400, 0, 2500}
+        cField2 = {400, 0, -2500}
+        cPlanet1 = {8000, -2000, 15000}
+        cPlanet2 = {-20000, 4000, -1000}
+        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r. Do not permute! ]]--
+
+        --[[ Function to print Coordinates. Quotes not included! ]]--
+        function printC(coord)
+          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
+        end
+    ?>
+
+    <Scene
+        ambientlight = "0.8, 0.8, 0.8"
+        skybox = "Orxonox/skyBoxMoreNebula"
+        hasPhysics = true
+    >
+
+    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cA) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
+
+    <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"/>
+
+    <!--QUEST DEFINITIONS-->
+
+    <GlobalQuest id="quest1">
+        <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="" />
+        <hints>
+        </hints>
+        <complete-effects>
+            <AddQuest questId="quest2" />
+            <AddQuest questId="quest2.1" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest2">
+        <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="" />
+        <hints>
+        </hints>
+        <subquests>
+            <GlobalQuest id="quest2.1">
+                <QuestDescription title="> Get a better Spaceship" description="Take over the faster, stronger, more secure and overall better spaceship!" failMessage="" completeMessage="" />
+                <complete-effects>
+                    <AddQuest questId="quest2.2" />
+                </complete-effects>
+            </GlobalQuest>
+            <GlobalQuest id="quest2.2">
+                <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="" />
+            </GlobalQuest>
+        </subquests>
+        <complete-effects>
+            <AddQuest questId="quest3" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest3">
+        <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!" />
+        <hints>
+        </hints>
+        <complete-effects>
+            <AddQuest questId="quest4" />
+            <AddQuest questId="quest4.1" />
+            <AddQuest questId="quest4.2" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest4">
+        <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="" />
+        <hints>
+        </hints>
+        <subquests>
+            <GlobalQuest id="quest4.1">
+                <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="" />
+            </GlobalQuest>
+            <GlobalQuest id="quest4.2">
+                <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="" />
+            </GlobalQuest>
+        </subquests>
+        <complete-effects>
+            <AddQuest questId="quest5" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest5">
+        <QuestDescription title="Fight the Hord!" description="Destroy the next wave!" failMessage="" completeMessage="" />
+        <hints>
+        </hints>
+        <complete-effects>
+            <AddQuest questId="quest6" />
+            <AddQuest questId="quest6.1" />
+            <AddQuest questId="quest6.2" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest6">
+        <QuestDescription title="Get back for the Showdown" description="Undock from the defense station and get into your Spaceship!" failMessage="" completeMessage="" />
+        <hints>
+        </hints>
+        <subquests>
+            <GlobalQuest id="quest6.1">
+                <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="" />
+            </GlobalQuest>
+            <GlobalQuest id="quest6.2">
+                <QuestDescription title="> Get back to the Shuttle" description="Fly to the Shuttle!" failMessage="" completeMessage="" />
+            </GlobalQuest>
+        </subquests>
+        <complete-effects>
+            <AddQuest questId="quest7" />
+        </complete-effects>
+    </GlobalQuest>
+
+    <GlobalQuest id="quest7">
+        <QuestDescription title="Fight the final Wave" description="Good gracious, another hord of pirate ships!" failMessage="" completeMessage="" />
+        <hints>
+        </hints>
+        <subquests>
+        </subquests>
+    </GlobalQuest>
+
+    <!--EVENTS AND TRIGGERS
+        Usable events and triggers:
+        _spawntrigger
+        _reachedA
+        _dock<A|B|C>
+        _docked<A>      WIP; see below
+        -joinedUnit
+        _wave<k>
+        _killedEnemy<k>.<i>
+        _waveClear<k>
+    -->
+
+
+
+    <EventMultiTrigger name="spawntrigger">
+        <events>
+            <trigger>
+                <EventListener event="playerSpawn" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
+
+    <!-- HACK: just waited out 3sec for animation. Cannot link an event to the COMPLETION of a dock. How is this not possible?? -->
+    <EventMultiTrigger name="dockedA" activations="1" stayactive="true" delay=3>
+        <events>
+            <trigger>
+                <EventListener event="dockA" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
+        <events>
+            <activity>
+                    <EventListener event="dockedA" />
+            </activity>
+        </events>
+    </DistanceTrigger>
+
+    <EventMultiTrigger name="wave1" activations="1" delay=4>
+        <events>
+            <trigger>
+                <EventListener event="joinedUnit" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <!-- Recursive helper function for the end-of-wave events. F*ck the event system, seriously. -->
+    <?lua
+    function enemyTriggerRecursor(i, k)
+    if i > 0 then
+    return [[
+    <EventTrigger name=killedEnemy]] .. k .. [[.]] .. i .. [[ activations=1 stayactive=true delay=0.1>
+        <events>
+            <trigger>
+                <EventListener event=attackers]] .. k .. [[ />
+            </trigger>
+        </events>
+        ]] .. enemyTriggerRecursor(i-1, k) .. [[
+    </EventTrigger>
+    ]]
+    else return ""
+    end
+    end
+    ?>
+    <!-- Actual recursive Event(s) for the respective waves. -->
+    <?lua
+    enemies = enemiesInit
+    for k = 1, waves, 1
+    do
+    print(enemyTriggerRecursor(enemies,k))
+    ?>
+    <EventMultiTrigger name="waveClear<?lua print(k) ?>" delay=4.0>
+        <events>
+            <trigger>
+                <EventListener event="killedEnemy<?lua print(k .. [[.]] .. enemies) ?>" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+    <?lua enemies = enemies + enemiesIncrease ?>
+    <?lua end ?>
+
+    <!-- This controls the ally AI controller so it is only active when active enemies are around! -->
+    <EventDispatcher name="allyControllerDispatcher">
+      <targets>
+        <EventTarget target="allyController" />
+      </targets>
+      <events>
+          <activity>
+              <?lua
+              for k = 1, waves, 1 do
+              ?>
+              <Trigger mode=and>
+                  <EventTrigger>
+                      <events>
+                          <trigger>
+                              <EventListener event="wave<?lua print(k) ?>" />
+                          </trigger>
+                      </events>
+                  </EventTrigger>
+                  <EventTrigger invert=true>
+                      <events>
+                          <trigger>
+                              <EventListener event="waveClear<?lua print(k) ?>" />
+                          </trigger>
+                      </events>
+                  </EventTrigger>
+              </Trigger>
+              <?lua end ?>
+          </activity>
+      </events>
+    </EventDispatcher>
+
+    <DistanceTrigger active=false name="reachedC" position="<?lua printC(cC) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
+        <events>
+            <activity>
+                <EventListener event="waveClear1" />
+            </activity>
+        </events>
+    </DistanceTrigger>
+
+    <EventMultiTrigger name="dockedC" activations="1" stayactive="true" delay=3>
+        <events>
+            <trigger>
+                <EventListener event="dockC" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <EventMultiTrigger name="wave2" activations="1" delay=8>
+        <events>
+            <trigger>
+                <EventListener event="dockedC" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <EventMultiTrigger name="readyAfterWave2" activations="1" delay=2 stayactive=true>
+        <events>
+            <trigger>
+                <Trigger mode=and>
+                    <EventTrigger>
+                        <events>
+                            <trigger>
+                                <EventListener event="undockC" />
+                            </trigger>
+                        </events>
+                    </EventTrigger>
+                    <EventTrigger>
+                        <events>
+                            <trigger>
+                                <EventListener event="waveClear2" />
+                            </trigger>
+                        </events>
+                    </EventTrigger>
+                </Trigger>
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <!-- See the DistanceTrigger attached to the shuttle here! !-->
+
+    <EventMultiTrigger name="wave3" activations="1" delay=12>
+        <events>
+            <trigger>
+                <EventListener event="reachedShuttle" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <DistanceTrigger active=false name="reachedB" position="<?lua printC(cB) ?>" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
+        <events>
+            <activity>
+                <EventListener event="waveClear3" />
+            </activity>
+        </events>
+    </DistanceTrigger>
+
+    <Script code="Mission endMission true" onLoad="false">
+        <events>
+            <trigger>
+                <EventListener event="reachedB" />
+            </trigger>
+        </events>
+    </Script>
+
+    <EventMultiTrigger name="missionFailed" activations="1" stayactive=true>
+        <events>
+            <trigger>
+                <EventListener event="transporter" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <EventMultiTrigger name="failMissionHelper" delay=4 stayactive=true>
+        <events>
+            <trigger>
+                <EventListener event="missionFailed" />
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+    <DistanceTrigger active=false name="failMission" position="<?lua printC(cA) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
+        <events>
+            <activity>
+                <EventListener event="failMissionHelper" />
+            </activity>
+        </events>
+    </DistanceTrigger>
+
+    <!--HACK: Ultimately settled on docking A to fail the mission... that makes a whole lot of sense. -->
+
+    <Script code="Mission endMission fail" onLoad="false">
+        <events>
+            <trigger>
+                <EventListener event="failMission" />
+            </trigger>
+        </events>
+    </Script>
+
+    <!--QUEST EFFECT BEACONS -->
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <AddQuest questId="quest1" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="spawntrigger" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest1" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="reachedA" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest2.1" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="dockedA" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest2.2" />
+            <CompleteQuest questId="quest2" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="joinedUnit" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest3" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="waveClear1" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest4.1" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="reachedC" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest4.2" />
+            <CompleteQuest questId="quest4" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="dockedC" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest5" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="waveClear2" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest6.1" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="gotPickups" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest6.2" />
+            <CompleteQuest questId="quest6" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="reachedShuttle" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <QuestEffectBeacon times=1>
+        <effects>
+            <CompleteQuest questId="quest7" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="waveClear3" />
+            </execute>
+        </events>
+    </QuestEffectBeacon>
+
+    <!--NOTIFICATIONS -->
+
+    <SimpleNotification broadcast="true" message="Welcome, Commander. Please report at Andromeda Station.">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="spawntrigger" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Our enemy is set to attack us very soon.">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=8 >
+                   <events>
+                      <trigger>
+                         <EventListener event="spawntrigger" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Please study your mission briefing!">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=12 >
+                   <events>
+                      <trigger>
+                         <EventListener event="spawntrigger" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Welcome to Andromeda, Commander.">
+        <events>
+            <trigger>
+                <EventListener event="reachedA" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="We've prepared a reinforced Ship for you.">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="reachedA" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Now join our defense Team.">
+        <events>
+            <trigger>
+                <EventListener event="dockedA" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick some alien ass?">
+        <events>
+            <trigger>
+                <EventListener event="joinedUnit" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <!-- HACK: Somehow only fires a second time if the (notification,event) pairs are separate! WTF -->
+    <?lua
+    for k = 1, waves, 1 do
+    ?>
+    <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
+        <events>
+            <trigger>
+                <EventListener event="wave<?lua print(k) ?>" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+    <?lua end ?>
+
+    <SimpleNotification broadcast="true" message="yippie ki yay motherf*cker!">
+        <events>
+            <trigger>
+                <EventListener event="attackers1" />
+                <EventListener event="attackers2" />
+                <EventListener event="attackers3" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Phew, that was close! Well done, Commmander.">
+        <events>
+            <trigger>
+                <EventListener event="waveClear1" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="But it's not over yet! Get to the defense station and dock!">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="waveClear1" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="This is our powerful reinforced cannon suit.">
+        <events>
+            <trigger>
+                <EventListener event="dockedC" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="It should deal with those pesky invaders!">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="dockedC" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Brilliant work, Commander! now undock again.">
+        <events>
+            <trigger>
+                <EventListener event="waveClear2" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Here's some supplies for you. Shoot that crate!">
+        <events>
+            <trigger>
+                <EventListener event="readyAfterWave2" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Our Intelligence reports one more wave...">
+        <events>
+            <trigger>
+                <EventListener event="reachedShuttle" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Ready to be a hero, Commander?">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="reachedShuttle" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Congrats, Commander! You saved our skin.">
+        <events>
+            <trigger>
+                <EventListener event="waveClear3" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="Get over to the safe base to take a break.">
+        <events>
+            <trigger>
+                <EventTrigger stayactive="true" delay=4 >
+                   <events>
+                      <trigger>
+                         <EventListener event="waveClear3" />
+                      </trigger>
+                   </events>
+                </EventTrigger>
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification broadcast="true" message="It's over... we failed. Retreat to Andromeda!">
+        <events>
+            <trigger>
+                <EventListener event="missionFailed" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <!--STATIONS -->
+
+    <!-- (Temporary) Template for stations. Used to define common features of all Stations. -->
+    <Template name="station">
+        <Pawn mass=10000000 collisionType=dynamic friction=0.01>
+            <attached>
+                <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
+                <DistanceTriggerBeacon name="NPC" />
+            </attached>
+            <collisionShapes>
+                <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
+                <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
+                <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
+                <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
+                <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
+                <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
+                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
+                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
+                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
+                <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
+                <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
+                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
+                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
+                <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
+                <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
+                <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
+            </collisionShapes>
+        </Pawn>
+    </Template>
+
+    <!-- A, Coordinates are approx. (cos(29pi/16), sin(29pi/16), 0)*3000 -->
+    <Pawn name="statA" team=0 radarname="Andromeda Station" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" yaw=-50 initialhealth=10000 maxhealth=10000>
+        <templates>
+            <Template link="station" />
+        </templates>
+        <attached>
+            <DockingTarget name="dockTargetA" />
+            <Dock position="0,0,0" active=true>
+                <animations>
+                    <MoveToDockingTarget target="dockTargetA" />
+                </animations>
+                <effects>
+                    <DockToShip target="newSpaceShip" />
+                </effects>
+                <events>
+                    <execute>
+                        <EventListener event="dockA" />
+                    </execute>
+                </events>
+                <attached>
+                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockA" />
+                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
+                </attached>
+            </Dock>
+        </attached>
+    </Pawn>
+
+    <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
+    <Pawn name="statB" team=0 radarname="Safe Base" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" yaw=210 initialhealth=10000 maxhealth=10000>
+        <templates>
+            <Template link="station" />
+        </templates>
+        <attached>
+            <DockingTarget name="dockTargetB" />
+            <Dock position="0,0,0" active=false>
+                <animations>
+                    <MoveToDockingTarget target="dockTargetB" />
+                </animations>
+                <effects>
+                    <DockToShip target="newSpaceShip" />
+                </effects>
+                <events>
+                    <execute>
+                        <EventListener event="dockB" />
+                    </execute>
+                </events>
+                <attached>
+                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockB" />
+                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
+                </attached>
+            </Dock>
+        </attached>
+    </Pawn>
+
+    <!-- C -->
+    <Pawn name="statC" team=0 radarname="Defense Station" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
+        <templates>
+            <Template link="station" />
+        </templates>
+        <attached>
+            <DockingTarget name="dockTargetC" />
+            <Dock position="0,0,0">
+                <animations>
+                    <MoveToDockingTarget target="dockTargetC" />
+                </animations>
+                <effects>
+                    <DockToShip target="fpsMode" />
+                </effects>
+                <events>
+                    <execute>
+                        <EventListener event="dockC" />
+                    </execute>
+                </events>
+                <attached>
+                    <!--HACK: We use another dock to undock back to the ship since undocking is not implemented... -->
+                    <Dock position="0,0,0" active=true>
+                        <effects>
+                            <DockToShip target="newSpaceShip" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event="undockC" />
+                            </execute>
+                        </events>
+                    </Dock>
+                    <DistanceTrigger active=false position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockC">
+                        <events>
+                            <activity>
+                                <EventListener event="reachedC" />
+                            </activity>
+                        </events>
+                    </DistanceTrigger>
+                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
+                </attached>
+            </Dock>
+        </attached>
+    </Pawn>
+
+    <!-- New SpaceShip as destination of dock A-->
+    <SpaceShip
+            template            = "spaceshipassff"
+            team                = "0"
+            position            = "<?lua printC(cNewShip) ?>"
+            lookat              = "<?lua print(rAllies[2] .. ',' .. [[0]] .. ',' .. rAllies[1]) ?>"
+            health              = "400"
+            initialhealth       = "400"
+            maxhealth           = "1500"
+            shieldhealth        = "80"
+            initialshieldhealth = "80"
+            maxshieldhealth     = "120"
+            shieldabsorption    = "0.8"
+            reloadrate          = "1"
+            reloadwaittime      = "1"
+            name                = "newSpaceShip"
+            radarname           = "Defender" >
+        <attached>
+            <DockingTarget name="newSpaceShip" />
+            <DistanceTriggerBeacon name="newSpaceShip" />
+        </attached>
+    </SpaceShip>
+
+    <!-- FPS Player as destination of dock C -->
+    <FpsPlayer team=0 template = "fps" radarname = "Cannon Suit" position = "<?lua printC(cFPS) ?>" lookat="<?lua printC(cCenter) ?>">
+        <attached>
+            <DockingTarget name="fpsMode" />
+            <DistanceTriggerBeacon name="fpsPlayer" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="1,1,1"/>
+        </collisionShapes>
+    </FpsPlayer>
+
+    <!-- Floor for FPS Player -->
+    <StaticEntity position="<?lua printC(cFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,5,80" />
+            <Billboard position="320,50,320" material="Flares/ringflare2" colour="0.2,0.4,0.8" />
+    	    <DistanceTrigger position="320,50,320" distance="50" target="Pawn" beaconMode="identify" targetname="fpsPlayer" name="undockC" stayactive=true />
+            <ForceField active=false position="0,0,0" mode="homogen" diameter="600" forcedirection = "0,-500,0" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="400,25,400" />
+        </collisionShapes>
+    </StaticEntity>
+
+    <!--ELEMENTS -->
+
+    <?lua
+        dofile("includes/asteroidField.lua")
+       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2000, 250, 0)
+    ?>
+
+    <?lua
+        dofile("includes/asteroidField.lua")
+       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2000, 250, 0)
+    ?>
+
+    <Planet
+        position="<?lua printC(cPlanet1) ?>"
+        scale="2000"
+        collisionType="dynamic"
+        linearDamping="0.8"
+        angularDamping="0"
+        mass="5000000"
+        pitch="0"
+        mesh="planets/muunilinst.mesh"
+        atmosphere="atmosphere1"
+        rotationaxis="1,0,0"
+        rotationrate="1.0"
+        atmospheresize="80.0f"
+        imagesize="1024.0f"
+        collisiondamage = 2
+        enablecollisiondamage = true
+      >
+      <attached>
+        <ForceField position="0,0,0" mode="sphere" diameter="4000" velocity="-500" />
+        </attached>
+          <collisionShapes>
+            <SphereCollisionShape radius="2000" position="0,0,0" />
+      </collisionShapes>
+    </Planet>
+
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
+    ?>
+
+    <Planet
+        position="<?lua printC(cPlanet2) ?>"
+        scale="3000"
+        collisionType="dynamic"
+        linearDamping="0.8"
+        angularDamping="0"
+        mass="5000000"
+        pitch="0"
+        mesh="planets/planet3.mesh"
+        atmosphere="atmosphere1"
+        rotationaxis="1,0,0"
+        rotationrate="1.0"
+        atmospheresize="80.0f"
+        imagesize="1024.0f"
+        collisiondamage = 2
+        enablecollisiondamage = true
+      >
+      <attached>
+        <ForceField position="0,0,0" mode="sphere" diameter="6000" velocity="-500" />
+        </attached>
+          <collisionShapes>
+            <SphereCollisionShape radius="3000" position="0,0,0" />
+      </collisionShapes>
+    </Planet>
+
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
+    ?>
+
+    <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">
+        <events>
+            <visibility>
+                <EventListener event="readyAfterWave2" />
+            </visibility>
+            <activity>
+                <EventListener event="readyAfterWave2" />
+            </activity>
+        </events>
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="10,10,10" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+        </collisionShapes>
+    </Pawn>
+
+    <?lua
+        include("includes/pickups.oxi")
+    ?>
+
+    <PickupSpawner pickup=hugeshieldpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-585)) ?>" triggerDistance="15" maxSpawnedItems="1">
+        <events>
+            <visibility>
+                <EventListener event="readyAfterWave2" />
+            </visibility>
+            <activity>
+                <EventListener event="readyAfterWave2" />
+            </activity>
+        </events>
+    </PickupSpawner>
+
+    <PickupSpawner pickup=crazyhealthpickup position="<?lua print((cC[1]+615) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1">
+        <events>
+            <visibility>
+                <EventListener event="readyAfterWave2" />
+            </visibility>
+            <activity>
+                <EventListener event="readyAfterWave2" />
+            </activity>
+        </events>
+    </PickupSpawner>
+
+    <PickupSpawner pickup=hugespeedpickup position="<?lua print((cC[1]+585) .. ',' .. cC[2] .. ',' .. (cC[3]-615)) ?>" triggerDistance="15" maxSpawnedItems="1" >
+        <events>
+            <visibility>
+                <EventListener event="readyAfterWave2" />
+            </visibility>
+            <activity>
+                <EventListener event="readyAfterWave2" />
+            </activity>
+        </events>
+    </PickupSpawner>
+
+    <!-- Allies -->
+    <?lua
+    for i = 1, allies, 1
+    do
+    x = rAllies[1] + math.cos(2*math.pi/allies*(i+1))*100
+    y = rAllies[2] + math.sin(2*math.pi/allies*(i+1))*100
+    ?>
+    <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>
+        <templates>
+            <Template link="spaceshipassff" />
+        </templates>
+        <events>
+            <visibility>
+                <EventListener event="dockedA" />
+            </visibility>
+            <activity>
+                <EventListener event="dockedA" />
+            </activity>
+        </events>
+        <attached>
+            <DistanceTriggerBeacon name="NPC" />
+        </attached>
+        <controller>
+            <!-- also see allyControllerDispatcher -->
+            <AIController name="allyController" accuracy=100 team=0 active=false />
+        </controller>
+    </SpaceShip>
+    <?lua end ?>
+
+    <!-- Enemies. Outer loop defines waves, inner loop defines enemies in every wave. -->
+    <?lua
+    enemies = enemiesInit
+    for k = 1, waves, 1
+    do
+    ?>
+    <?lua
+    for i = 1, enemies, 1
+    do
+    x = math.cos(math.pi/(2*enemies - 2)*(i+k))*1500
+    y = math.sin(math.pi/(2*enemies - 2)*(i+k))*1500
+    ?>
+    <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>
+        <templates>
+            <Template link="spaceshippirate" />
+        </templates>
+        <events>
+            <visibility>
+                <EventListener event="wave<?lua print(k)?>" />
+            </visibility>
+            <activity>
+                <EventListener event="wave<?lua print(k)?>" />
+            </activity>
+        </events>
+        <attached>
+            <DistanceTriggerBeacon name="NPC" />
+        </attached>
+        <controller>
+            <WaypointPatrolController name="attackController" accuracy=100 alertnessradius=100 team=1 active=false>
+                <waypoints>
+                    <Attacher target="transporter" deletewithparent=false />
+                </waypoints>
+                <events>
+                    <activity>
+                        <EventListener event="wave<?lua print(k)?>" />
+                    </activity>
+                </events>
+            </WaypointPatrolController>
+        </controller>
+    </SpaceShip>
+    <?lua end ?>
+    <?lua
+    enemies = enemies + enemiesIncrease
+    end ?>
+
+    <!-- Transporter, starting Point is near A, end Point near B, the circle parameters for the waypoints are: Center = (0, -887, 0), r = 2613 -->
+    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle" >
+        <templates>
+            <Template link="spaceshipShuttle" />
+        </templates>
+        <attached>
+            <DistanceTriggerBeacon name="NPC" />
+            <DistanceTriggerBeacon name="transporter" />
+            <DistanceTrigger active=false name="reachedShuttle" position="0,0,0" distance=400 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true initialhealth=1000 maxhealth=1000>
+                <events>
+                    <activity>
+                        <EventListener event="readyAfterWave2" />
+                    </activity>
+                </events>
+            </DistanceTrigger>
+        </attached>
+        <controller>
+            <WaypointController accuracy=10 team=0>
+                <waypoints>
+                    <!-- A to B -->
+                    <?lua
+                    max = 5
+                    for i = 1, max, 1
+                    do
+                    x = math.cos(math.pi*(i+1)/8)*5000
+                    y = -math.sin(math.pi*(i+1)/8)*700-3000
+                    ?>
+                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+                    <?lua end ?>
+
+                    <!-- Return Point -->
+                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+
+                    <!-- B to A -->
+                    <?lua
+                    max = 5
+                    for i = 1, max, 1
+                    do
+                    x = math.cos(math.pi*(max+2-i)/8)*5000
+                    y = -math.sin(math.pi*(max+2-i)/8)*700-3000
+                    ?>
+                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+                    <?lua end ?>
+
+                    <!-- Start Point -->
+                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+                </waypoints>
+            </WaypointController>
+        </controller>
+    </SpaceShip>
+
+    </Scene>
+</Level>
