Index: /code/branches/ProtectBoss_HS17/data/levels/ProtectBoss.oxw
===================================================================
--- /code/branches/ProtectBoss_HS17/data/levels/ProtectBoss.oxw	(revision 11671)
+++ /code/branches/ProtectBoss_HS17/data/levels/ProtectBoss.oxw	(revision 11672)
@@ -2,5 +2,5 @@
  name = "ProtectBoss"
  description = "Protect a disabled cargo ship!"
- tags = "test, mission"
+ tags = "mission"
  screenshot = "emptylevel.png"
 />
@@ -66,8 +66,8 @@
         collisionType = kinematic
         enablecollisiondamage=true
-        collisiondamage = 10
+        collisiondamage = 5
         position  = "0,0,-2500"
         mass      = 100000
-        health    = 100 initialhealth=100 maxhealth="100"
+        health    = 2500 initialhealth=2500 maxhealth="2500"
         direction = "1,0,0"
         rotationaxis="0,0,1" rotationrate="4.5" velocity="0,0,30"
@@ -114,4 +114,7 @@
     </Pawn>
 
+    <!-- triggers some time after start -->
+    <DistanceTrigger name="someTimeAfterStart" beaconMode=identify position="0,0,1000" distance=1000 target="Pawn" targetname="CargoShip" />
+
     <!-- triggers when first quest is completed -->
     <DistanceTrigger name="passedAsteroidFieldOne" beaconMode=identify position="0,0,3000" distance=1000 target="Pawn" targetname="CargoShip" />
@@ -125,25 +128,4 @@
         end
       ?>
-      <!--EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p1" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p2" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p3" />
-          </trigger>
-        </events>
-      </EventTrigger-->
     </Trigger>
 
@@ -155,46 +137,4 @@
         end
       ?>
-      <!--EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p11" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p12" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p13" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p14" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p15" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p16" />
-          </trigger>
-        </events>
-      </EventTrigger-->
     </Trigger>
 
@@ -211,5 +151,5 @@
 
     <!-- triggers when third pirate wave is defeated -->
-    <Trigger name="thirdPirateWaveKilled" mode="and" delay=5>
+    <Trigger name="thirdPirateWaveKilled" mode="and">
       <?lua
         for n = 1, 7, 1 do
@@ -217,56 +157,7 @@
         end
       ?>
-      <!--EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p21" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p22" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p23" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p24" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p25" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p26" />
-          </trigger>
-        </events>
-      </EventTrigger>
-      <EventTrigger activations="1" stayactive="true" >
-        <events>
-          <trigger>
-             <EventListener event="p27" />
-          </trigger>
-        </events>
-      </EventTrigger-->
-    </Trigger>
-
-    <Trigger name="succeedMission" delay=7>
+    </Trigger>
+
+    <Trigger name="succeedMission" mode=and delay=1>
       <EventTrigger activations="1" stayactive="true" >
         <events>
@@ -276,7 +167,5 @@
         </events>
       </EventTrigger>
-    </Trigger>
-
-      <EventTrigger activations="1" stayactive="true" name="failMission" delay=0.1>
+      <EventTrigger activations="1" stayactive="false" name="cargoShipStillAlive" invert=true>
         <events>
           <trigger>
@@ -285,4 +174,13 @@
         </events>
       </EventTrigger>
+    </Trigger>
+
+    <EventTrigger activations="1" stayactive="true" name="failMission" delay=0.1>
+      <events>
+        <trigger>
+           <EventListener event="CargoShip" />
+        </trigger>
+      </events>
+    </EventTrigger>
 
     <!-- create asteroids and pickups -->
@@ -299,9 +197,12 @@
       end
 
-      for count = 1, 30, 1 do
+      for count = 1, 60, 1 do
         x = math.random(-1000, 1000)
         y = math.random(-1000, 1000)
         z = 125 * count + math.random(-250, 250)
         vmax = 7
+        if count > 30 then
+          vmax = 2
+        end
         rx = math.random(-vmax, vmax)
         ry = math.random(-vmax, vmax)
@@ -314,8 +215,8 @@
       end
 
-      for count = 1, 50, 1 do
+      for count = 1, 60, 1 do
         x = math.random(-1000, 1000)
         y = math.random(-1000, 1000)
-        z = 125 * count + math.random(-250, 250)
+        z = 3000 + 125 * count + math.random(-250, 250)
         typenum = math.random(11)
         type = ""
@@ -382,5 +283,5 @@
 
     <LocalQuest id="ProtectBoss.AsteroidField">
-        <QuestDescription title="Asteroid Field" description="The cargo ship in front of you is disabled and is drifting uncontrolled! Shoot the asteroids out of the way to protect it!" failmessage="The cargo ship has been hit!" completeMessage="" />
+        <QuestDescription title="Protect the Cargo Ship" description="The cargo ship in front of you is disabled and is drifting uncontrolled! Shoot the asteroids out of the way to protect it!" failmessage="The cargo ship has been hit!" completeMessage="" />
         <complete-effects>
             <AddQuest questId="ProtectBoss.PirateAttack" />
@@ -392,8 +293,8 @@
     </LocalQuest>
 
-    <SimpleNotification message="Pirates are attacking!" broadcast="true" >
-        <events>
-            <trigger>
-                <EventListener event="passedAsteroidFieldOne" />
+    <SimpleNotification message="There are pirates around!" broadcast="true" >
+        <events>
+            <trigger>
+                <EventListener event="someTimeAfterStart" />
             </trigger>
         </events>
@@ -416,5 +317,5 @@
     </SimpleNotification>
 
-    <SimpleNotification message="The third and last pirate wave is preparing for attack! They will arrive soon!" broadcast=true >
+    <SimpleNotification message="The third and last pirate wave is near!" broadcast=true >
       <events>
             <trigger>
@@ -424,60 +325,36 @@
     </SimpleNotification>
 
-    <SimpleNotification message="The pirates are attacking!" broadcast=true >
-      <events>
-            <trigger>
-                <EventListener event="thirdPirateWaveStarting" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <SimpleNotification message="You defeated the pirates! The cargo ship is exiting the asteroid field. You made it!" broadcast=true >
-      <events>
-            <trigger>
-                <EventListener event="thirdPirateWaveKilled" />
-            </trigger>
-        </events>
-    </SimpleNotification>
-
-    <Script code="Mission endMission true" onLoad="false">
-        <events>
+    <SimpleNotification message="The cargo ship is out of danger. You made it!" broadcast=true >
+      <events>
             <trigger>
                 <EventListener event="succeedMission" />
             </trigger>
         </events>
-    </Script>
-
-    <Script code="Mission endMission false" onLoad="false">
-        <events>
-            <trigger>
-                <EventListener event="CargoShip" />
-            </trigger>
-        </events>
-    </Script>
+    </SimpleNotification>
 
     <!-- A function to put pirates to a certain location -->
     <?lua
       function placePirate(posX, posY, posZ, name, trigger)
-        print("<SpaceShip mass=10 health=25 initialhealth=25 maxhealth=25 shieldhealth=10 maxshieldhealth=10 initialshieldhealth=10 shieldabsorption=0.3 shieldrechargerate=1 shieldrechargewaittime=1 primaryThrust=40 auxiliaryThrust=15 rotationThrust=10 boostpower=5 boostrate=2 boostCooldownDuration = 20 position=\"" .. posX .. "," .. posY .. "," .. posZ .. "\" name=\"" .. name .. "\" radarname=Pirate><events><visibility><EventListener event=\"" .. trigger .. "\"/></visibility><activity><EventListener event=\"" .. trigger .. "\"/></activity></events><templates><Template link=spaceshippirate /></templates><controller><WaypointPatrolController alertnessradius=3129 team=1 active=false><waypoints><Model mesh=\"cube.mesh\" scale=0 position=\"-1300,-600,900\" /><Model mesh=\"cube.mesh\" scale=0 position=\"0,0,0\" /></waypoints><events><activity><EventListener event=attack /></activity></events></WaypointPatrolController></controller></SpaceShip>")
+        print("<SpaceShip mass=10 health=25 initialhealth=25 maxhealth=25 shieldhealth=10 maxshieldhealth=10 initialshieldhealth=10 shieldabsorption=0.3 shieldrechargerate=1 shieldrechargewaittime=1 primaryThrust=20 auxiliaryThrust=5 rotationThrust=5 boostpower=2 boostrate=1 boostCooldownDuration = 50 accuracy=1 position=\"" .. posX .. "," .. posY .. "," .. posZ .. "\" name=\"" .. name .. "\" radarname=Pirate><!--events><visibility><EventListener event=\"" .. trigger .. "\"/></visibility><activity><EventListener event=\"" .. trigger .. "\"/></activity></events--><templates><Template link=spaceshippirate /></templates><controller><WaypointPatrolController alertnessradius=2700 attackradius=1850 team=1 active=true><waypoints><StaticEntity position=\"" .. posX .. "," .. posY .. "," .. posZ .. "\"/><StaticEntity position=\"" .. (posX + 100) .. "," .. posY .. "," .. posZ .. "\"/><!--Model mesh=\"cube.mesh\" scale=0 position=\"-1300,-600,900\" /><Model mesh=\"cube.mesh\" scale=0 position=\"0,0,0\" /--></waypoints><events><activity><EventListener event=attack /></activity></events></WaypointPatrolController></controller></SpaceShip>")
       end
     ?>
 
     <?lua
-      placePirate(0, 0, 3000, "p1", "passedAsteroidFieldOne")
-      placePirate(50, 0, 3500, "p2", "passedAsteroidFieldOne")
-      placePirate(0, 50, 4000, "p3", "passedAsteroidFieldOne")
-      placePirate(0, 0, 5500, "p11", "firstPirateWaveKilled")
-      placePirate(50, 0, 5600, "p12", "firstPirateWaveKilled")
-      placePirate(-50, 0, 5700, "p13", "firstPirateWaveKilled")
-      placePirate(0, 50, 5800, "p14", "firstPirateWaveKilled")
-      placePirate(0, -50, 5900, "p15", "firstPirateWaveKilled")
-      placePirate(0, 0, 6000, "p16", "firstPirateWaveKilled")
-      placePirate(0, 0, 7000, "p21", "thirdPirateWaveStarting")
-      placePirate(50, 0, 7100, "p22", "thirdPirateWaveStarting")
-      placePirate(-50, 0, 7200, "p23", "thirdPirateWaveStarting")
-      placePirate(0, 50, 7300, "p24", "thirdPirateWaveStarting")
-      placePirate(0, -50, 7400, "p25", "thirdPirateWaveStarting")
-      placePirate(50, 50, 7500, "p26", "thirdPirateWaveStarting")
-      placePirate(-50, -50, 7600, "p27", "thirdPirateWaveStarting")
+      placePirate(0, 0, 4800, "p1", "passedAsteroidFieldOne")
+      placePirate(50, 0, 4900, "p2", "passedAsteroidFieldOne")
+      placePirate(0, 50, 5000, "p3", "passedAsteroidFieldOne")
+      placePirate(0, 0, 6500, "p11", "firstPirateWaveKilled")
+      placePirate(50, 0, 6600, "p12", "firstPirateWaveKilled")
+      placePirate(-50, 0, 6700, "p13", "firstPirateWaveKilled")
+      placePirate(0, 50, 6800, "p14", "firstPirateWaveKilled")
+      placePirate(0, -50, 6900, "p15", "firstPirateWaveKilled")
+      placePirate(0, 0, 7000, "p16", "firstPirateWaveKilled")
+      placePirate(0, 0, 8000, "p21", "thirdPirateWaveStarting")
+      placePirate(50, 0, 8100, "p22", "thirdPirateWaveStarting")
+      placePirate(-50, 0, 8200, "p23", "thirdPirateWaveStarting")
+      placePirate(0, 50, 8300, "p24", "thirdPirateWaveStarting")
+      placePirate(0, -50, 8400, "p25", "thirdPirateWaveStarting")
+      placePirate(50, 50, 8500, "p26", "thirdPirateWaveStarting")
+      placePirate(-50, -50, 8600, "p27", "thirdPirateWaveStarting")
     ?>
 
