[Orxonox-commit 6108] r10766 - code/branches/campaignHS15/data/levels

paulsc at orxonox.net paulsc at orxonox.net
Wed Nov 4 22:55:51 CET 2015


Author: paulsc
Date: 2015-11-04 22:55:50 +0100 (Wed, 04 Nov 2015)
New Revision: 10766

Modified:
   code/branches/campaignHS15/data/levels/Campaign1.oxw
Log:
Corrected formatting, improved allies, introduced lua coordinates and switched spaceships from ASSFF2 to ASSFF to get rid of ogre exceptions.

Modified: code/branches/campaignHS15/data/levels/Campaign1.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/Campaign1.oxw	2015-11-04 21:25:42 UTC (rev 10765)
+++ code/branches/campaignHS15/data/levels/Campaign1.oxw	2015-11-04 21:55:50 UTC (rev 10766)
@@ -10,7 +10,7 @@
     include("HUDTemplates3.oxo")
     include("templates/lodInformation.oxt")
 
-    include("templates/spaceshipAssff2.oxt")
+    include("templates/spaceshipAssff.oxt")
     include("templates/spaceshipPirate.oxt")
     include("templates/spaceshipEscort.oxt")
     include("templates/spaceshipTransporter.oxt")
@@ -40,7 +40,30 @@
     <?lua
         waves = 3
         enemies = 5
-        allies = 5
+        allies = 3
+
+        --[[ Coordinates. NOTE: Indexing starts at 1 in lua! Don“t forget to adapt the for loops, too! ]]--
+        cCenter = {0, 0, 0}
+        cSpawn = {0, -50, 0}
+        cUnit = {3000, -2000, 0}
+        cA = {5000, -3000, 0}
+        cB = {-5000, -3000, 0}
+        cC = {0, -2300, 0}
+        dStation = {0, 1, 0}
+        cNewShip = {4100, -2100, 0}
+        cFPSGround = {0, -2300, 1200}
+        dFPSGround = {0, 0, -1}
+        cFPS = {0, -2300, 1201}
+        cField1 = {2500, 400, 0}
+        cField2 = {-2500, 400, 0}
+        cPlanet1 = {15000, 8000, -2000}
+        cPlanet2 = {-1000, -20000, 4000}
+        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r ]]--
+
+        --[[ Function to print Coordinates. Quotes not included! ]]--
+        function printC(coord)
+          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
+        end
     ?>
 
     <Scene
@@ -49,11 +72,11 @@
         hasPhysics = true
     >
 
-    <SpawnPoint name="playerSpawn" team=0 position="0,-50,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cCenter) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
 
     <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
 
-    <Light type=directional position="0,0,0" 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"/>
+    <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-->
 
@@ -172,7 +195,7 @@
         </events>
     </EventMultiTrigger>
 
-    <DistanceTrigger name="reachedA" position="5000,-3000,0" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
+    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
 
     <!-- TODO: find out how to link an event to the COMPLETION of a dock. How is this not possible?? -->
     <EventMultiTrigger name="dockedA" activations="1" stayactive="true" delay=3>
@@ -183,7 +206,7 @@
         </events>
     </EventMultiTrigger>
 
-    <DistanceTrigger name="joinedUnit" active=false position="3000,-2000,0" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
+    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
         <events>
             <activity>
                     <EventListener event="dockedA" />
@@ -191,7 +214,7 @@
         </events>
     </DistanceTrigger>
 
-    <EventMultiTrigger name="wave1" activations="1" stayactive="true" delay=4>
+    <EventMultiTrigger name="wave1" activations="1" delay=4>
         <events>
             <trigger>
                 <EventListener event="joinedUnit" />
@@ -232,8 +255,40 @@
     </EventMultiTrigger>
     <?lua end ?>
 
+    <!-- This controls the ally AI controller so it is only active when active enemies are around!
+    TODO: Find a way to control the allies in another case (Multiple controllers are not allowed). -->
+    <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>
+
     <!-- FIXME: This trigger needs fixing, as endMission can only be called by a Pawn Distance Trigger. Herpaderp.
-        Also, the fix proposed in MissionOne does not work anymore... -->
+    Also, the fix proposed in MissionOne does not work anymore... -->
    <EventMultiTrigger name="missionFailed" target="Pawn" stayActive="true" delay=1.5>
        <events>
            <trigger>
@@ -382,6 +437,14 @@
         </events>
     </SimpleNotification>
 
+    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick alien ass?">
+        <events>
+            <trigger>
+                <EventListener event="joinedUnit" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
     <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
         <events>
             <trigger>
@@ -425,33 +488,33 @@
     <!-- (Temporary) Template for stations. Used to define common features of all Stations. -->
     <Template name="station">
         <Pawn mass=10000 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>
+            <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="Station A" position="5000,-3000,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
+    <Pawn name="statA" team=0 radarname="Station A" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
         <templates>
             <Template link="station" />
         </templates>
@@ -478,7 +541,7 @@
     </Pawn>
 
     <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
-    <Pawn name="statB" team=0 radarname="Station B" position="-5000,-3000,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
+    <Pawn name="statB" team=0 radarname="Station B" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
         <templates>
             <Template link="station" />
         </templates>
@@ -505,7 +568,7 @@
     </Pawn>
 
     <!-- C -->
-    <Pawn name="statC" team=0 radarname="Station C" position="0,-2300,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
+    <Pawn name="statC" team=0 radarname="Station C" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
         <templates>
             <Template link="station" />
         </templates>
@@ -533,41 +596,41 @@
 
     <!-- New SpaceShip as destination of dock A-->
     <SpaceShip
-        template            = "spaceshipassff2"
-        team                = "0"
-        position            = "4100,-2100,0"
-        orientation         = "-0.14, 0.68, 0.68, 0.223"
-        health              = "400"
-        initialhealth       = "400"
-        maxhealth           = "500"
-        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>
+            template            = "spaceshipassff"
+            team                = "0"
+            position            = "<?lua printC(cNewShip) ?>"
+            lookat              = "<?lua printC(cCenter) ?>"
+            health              = "400"
+            initialhealth       = "400"
+            maxhealth           = "500"
+            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" rotationaxis="0,0,1" radarname = "First Person Player" position = "0,-2300,1201">
+    <FpsPlayer team=0 template = "fps" radarname = "First Person Player" position = "<?lua printC(cFPS) ?>">
         <attached>
             <DockingTarget name="fpsMode" />
             <DistanceTriggerBeacon name="fpsPlayer" />
         </attached>
     </FpsPlayer>
 
-    <StaticEntity position="0,-2300,1001" direction="0,0,-1" collisionType=static mass=100000 friction=0.01 >
+    <StaticEntity position="<?lua printC(cFPSGround) ?>" direction="<?lua printC(dFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
         <attached>
-          <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
         </attached>
         <collisionShapes>
-          <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
+            <BoxCollisionShape position="0,0,0" halfExtents="80,80,5" />
         </collisionShapes>
     </StaticEntity>
 
@@ -575,16 +638,16 @@
 
     <?lua
         dofile("includes/asteroidField.lua")
-       asteroidField(2500, 400, 0, 20, 30, 2200, 250, 0)
+       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2200, 250, 0)
     ?>
 
     <?lua
         dofile("includes/asteroidField.lua")
-       asteroidField(-2500, 400, 0, 20, 30, 2200, 250, 0)
+       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2200, 250, 0)
     ?>
 
     <Planet
-        position="15000,8000,-2000"
+        position="<?lua printC(cPlanet1) ?>"
         scale="2000"
         collisionType="dynamic"
         linearDamping="0.8"
@@ -610,11 +673,11 @@
 
     <?lua
         dofile("includes/asteroidField.lua")
-        asteroidBelt(15000, 8000, -2000, 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
+        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
     ?>
 
     <Planet
-        position="-1000,-20000,4000"
+        position="<?lua printC(cPlanet2) ?>"
         scale="3000"
         collisionType="dynamic"
         linearDamping="0.8"
@@ -640,19 +703,19 @@
 
     <?lua
         dofile("includes/asteroidField.lua")
-        asteroidBelt(-1000, -20000, 4000, 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
+        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
     ?>
 
-    <!-- Allies, 3000,-2000 -->
+    <!-- Allies -->
     <?lua
     for i = 1, allies, 1
     do
-    x = 3000 + math.cos(2*math.pi/5*(i+1))*100
-    y = -2000 + math.sin(2*math.pi/5*(i+1))*100
+    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(x)?>,<?lua print(y)?>,<?lua print(math.pow(-1,i)*100) ?>" lookat="0,0,0" team=0>
         <templates>
-            <Template link="spaceshipassff2" />
+            <Template link="spaceshipassff" />
         </templates>
         <events>
             <visibility>
@@ -666,13 +729,8 @@
             <DistanceTriggerBeacon name="NPC" />
         </attached>
         <controller>
-            <WaypointPatrolController accuracy=100 name="allyController" alertnessradius=5000 team=0 active=false>
-                <events>
-                    <activity>
-                        <EventListener event="joinedUnit" />
-                    </activity>
-                </events>
-            </WaypointPatrolController>
+            <!-- also see allyControllerDispatcher -->
+            <AIController name="allyController" accuracy=100 team=0 active=false />
         </controller>
     </SpaceShip>
     <?lua end ?>
@@ -685,8 +743,8 @@
     <?lua
     for i = 1, enemies, 1
     do
-    x = math.cos(math.pi/(8)*(i+1))*1500
-    y = math.sin(math.pi/(8)*(i+1))*1500
+    x = math.cos(math.pi/(enemies + 3)*(i+1))*1500
+    y = math.sin(math.pi/(enemies + 3)*(i+1))*1500
     ?>
     <SpaceShip visible=false active=false name="attackers<?lua print(k)?>" radarname="Attacker" position="<?lua print(x)?>,<?lua print(y)?>,<?lua print(math.pow(-1,i)*250) ?>" lookat="0,0,0" team=1>
         <templates>
@@ -719,9 +777,8 @@
     <?lua end ?>
     <?lua 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="5000,-3000,0" lookat="-2494, -1667, 0" team=0 name="transporter" radarname="Shuttle">
+    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle">
         <templates>
             <Template link="spaceshipTransporter" />
         </templates>
@@ -743,7 +800,7 @@
                     <?lua end ?>
 
                     <!-- Return Point -->
-                    <Billboard position="-5000, -3000, 0" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
 
                     <!-- B to A -->
                     <?lua
@@ -757,7 +814,7 @@
                     <?lua end ?>
 
                     <!-- Start Point -->
-                    <Billboard position="5000,-3000,0" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
+                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
                 </waypoints>
             </WaypointController>
         </controller>




More information about the Orxonox-commit mailing list