Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10766 for code


Ignore:
Timestamp:
Nov 4, 2015, 10:55:50 PM (9 years ago)
Author:
paulsc
Message:

Corrected formatting, improved allies, introduced lua coordinates and switched spaceships from ASSFF2 to ASSFF to get rid of ogre exceptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/data/levels/Campaign1.oxw

    r10758 r10766  
    1111    include("templates/lodInformation.oxt")
    1212
    13     include("templates/spaceshipAssff2.oxt")
     13    include("templates/spaceshipAssff.oxt")
    1414    include("templates/spaceshipPirate.oxt")
    1515    include("templates/spaceshipEscort.oxt")
     
    4141        waves = 3
    4242        enemies = 5
    43         allies = 5
     43        allies = 3
     44
     45        --[[ Coordinates. NOTE: Indexing starts at 1 in lua! Don´t forget to adapt the for loops, too! ]]--
     46        cCenter = {0, 0, 0}
     47        cSpawn = {0, -50, 0}
     48        cUnit = {3000, -2000, 0}
     49        cA = {5000, -3000, 0}
     50        cB = {-5000, -3000, 0}
     51        cC = {0, -2300, 0}
     52        dStation = {0, 1, 0}
     53        cNewShip = {4100, -2100, 0}
     54        cFPSGround = {0, -2300, 1200}
     55        dFPSGround = {0, 0, -1}
     56        cFPS = {0, -2300, 1201}
     57        cField1 = {2500, 400, 0}
     58        cField2 = {-2500, 400, 0}
     59        cPlanet1 = {15000, 8000, -2000}
     60        cPlanet2 = {-1000, -20000, 4000}
     61        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r ]]--
     62
     63        --[[ Function to print Coordinates. Quotes not included! ]]--
     64        function printC(coord)
     65          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
     66        end
    4467    ?>
    4568
     
    5073    >
    5174
    52     <SpawnPoint name="playerSpawn" team=0 position="0,-50,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
     75    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cCenter) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
    5376
    5477    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
    5578
    56     <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"/>
     79    <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"/>
    5780
    5881    <!--QUEST DEFINITIONS-->
     
    173196    </EventMultiTrigger>
    174197
    175     <DistanceTrigger name="reachedA" position="5000,-3000,0" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
     198    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
    176199
    177200    <!-- TODO: find out how to link an event to the COMPLETION of a dock. How is this not possible?? -->
     
    184207    </EventMultiTrigger>
    185208
    186     <DistanceTrigger name="joinedUnit" active=false position="3000,-2000,0" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
     209    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
    187210        <events>
    188211            <activity>
     
    192215    </DistanceTrigger>
    193216
    194     <EventMultiTrigger name="wave1" activations="1" stayactive="true" delay=4>
     217    <EventMultiTrigger name="wave1" activations="1" delay=4>
    195218        <events>
    196219            <trigger>
     
    233256    <?lua end ?>
    234257
     258    <!-- This controls the ally AI controller so it is only active when active enemies are around!
     259    TODO: Find a way to control the allies in another case (Multiple controllers are not allowed). -->
     260    <EventDispatcher name="allyControllerDispatcher">
     261      <targets>
     262        <EventTarget target="allyController" />
     263      </targets>
     264      <events>
     265          <activity>
     266              <?lua
     267              for k = 1, waves, 1 do
     268              ?>
     269              <Trigger mode=and>
     270                  <EventTrigger>
     271                      <events>
     272                          <trigger>
     273                              <EventListener event="wave<?lua print(k) ?>" />
     274                          </trigger>
     275                      </events>
     276                  </EventTrigger>
     277                  <EventTrigger invert=true>
     278                      <events>
     279                          <trigger>
     280                              <EventListener event="waveClear<?lua print(k) ?>" />
     281                          </trigger>
     282                      </events>
     283                  </EventTrigger>
     284              </Trigger>
     285              <?lua end ?>
     286          </activity>
     287      </events>
     288    </EventDispatcher>
     289
    235290    <!-- FIXME: This trigger needs fixing, as endMission can only be called by a Pawn Distance Trigger. Herpaderp.
    236         Also, the fix proposed in MissionOne does not work anymore... -->
     291    Also, the fix proposed in MissionOne does not work anymore... -->
    237292   <EventMultiTrigger name="missionFailed" target="Pawn" stayActive="true" delay=1.5>
    238293       <events>
     
    383438    </SimpleNotification>
    384439
     440    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick alien ass?">
     441        <events>
     442            <trigger>
     443                <EventListener event="joinedUnit" />
     444            </trigger>
     445        </events>
     446    </SimpleNotification>
     447
    385448    <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
    386449        <events>
     
    426489    <Template name="station">
    427490        <Pawn mass=10000 collisionType=dynamic friction=0.01>
    428           <attached>
    429             <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
    430             <DistanceTriggerBeacon name="NPC" />
    431           </attached>
    432           <collisionShapes>
    433             <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
    434             <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
    435             <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
    436             <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
    437             <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
    438             <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
    439             <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
    440             <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
    441             <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
    442             <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
    443             <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
    444             <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
    445             <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
    446             <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
    447             <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
    448             <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
    449           </collisionShapes>
    450       </Pawn>
     491            <attached>
     492                <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
     493                <DistanceTriggerBeacon name="NPC" />
     494            </attached>
     495            <collisionShapes>
     496                <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
     497                <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
     498                <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
     499                <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
     500                <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
     501                <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
     502                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
     503                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
     504                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
     505                <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
     506                <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
     507                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
     508                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
     509                <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
     510                <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
     511                <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
     512            </collisionShapes>
     513        </Pawn>
    451514    </Template>
    452515
    453516    <!-- A, Coordinates are approx. (cos(29pi/16), sin(29pi/16), 0)*3000 -->
    454     <Pawn name="statA" team=0 radarname="Station A" position="5000,-3000,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
     517    <Pawn name="statA" team=0 radarname="Station A" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
    455518        <templates>
    456519            <Template link="station" />
     
    479542
    480543    <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
    481     <Pawn name="statB" team=0 radarname="Station B" position="-5000,-3000,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
     544    <Pawn name="statB" team=0 radarname="Station B" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
    482545        <templates>
    483546            <Template link="station" />
     
    506569
    507570    <!-- C -->
    508     <Pawn name="statC" team=0 radarname="Station C" position="0,-2300,0" direction="0,1,0" initialhealth=10000 maxhealth=10000>
     571    <Pawn name="statC" team=0 radarname="Station C" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
    509572        <templates>
    510573            <Template link="station" />
     
    534597    <!-- New SpaceShip as destination of dock A-->
    535598    <SpaceShip
    536         template            = "spaceshipassff2"
    537         team                = "0"
    538         position            = "4100,-2100,0"
    539         orientation         = "-0.14, 0.68, 0.68, 0.223"
    540         health              = "400"
    541         initialhealth       = "400"
    542         maxhealth           = "500"
    543         shieldhealth        = "80"
    544         initialshieldhealth = "80"
    545         maxshieldhealth     = "120"
    546         shieldabsorption    = "0.8"
    547         reloadrate          = "1"
    548         reloadwaittime      = "1"
    549         name                = "newSpaceShip"
    550         radarname           = "Defender" >
    551       <attached>
    552         <DockingTarget name="newSpaceShip" />
    553         <DistanceTriggerBeacon name="newSpaceShip" />
    554       </attached>
     599            template            = "spaceshipassff"
     600            team                = "0"
     601            position            = "<?lua printC(cNewShip) ?>"
     602            lookat              = "<?lua printC(cCenter) ?>"
     603            health              = "400"
     604            initialhealth       = "400"
     605            maxhealth           = "500"
     606            shieldhealth        = "80"
     607            initialshieldhealth = "80"
     608            maxshieldhealth     = "120"
     609            shieldabsorption    = "0.8"
     610            reloadrate          = "1"
     611            reloadwaittime      = "1"
     612            name                = "newSpaceShip"
     613            radarname           = "Defender" >
     614        <attached>
     615            <DockingTarget name="newSpaceShip" />
     616            <DistanceTriggerBeacon name="newSpaceShip" />
     617        </attached>
    555618    </SpaceShip>
    556619
    557620    <!-- FPS Player as destination of dock C-->
    558     <FpsPlayer team=0 template = "fps" rotationaxis="0,0,1" radarname = "First Person Player" position = "0,-2300,1201">
     621    <FpsPlayer team=0 template = "fps" radarname = "First Person Player" position = "<?lua printC(cFPS) ?>">
    559622        <attached>
    560623            <DockingTarget name="fpsMode" />
     
    563626    </FpsPlayer>
    564627
    565     <StaticEntity position="0,-2300,1001" direction="0,0,-1" collisionType=static mass=100000 friction=0.01 >
     628    <StaticEntity position="<?lua printC(cFPSGround) ?>" direction="<?lua printC(dFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
    566629        <attached>
    567           <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
     630            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
    568631        </attached>
    569632        <collisionShapes>
    570           <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
     633            <BoxCollisionShape position="0,0,0" halfExtents="80,80,5" />
    571634        </collisionShapes>
    572635    </StaticEntity>
     
    576639    <?lua
    577640        dofile("includes/asteroidField.lua")
    578        asteroidField(2500, 400, 0, 20, 30, 2200, 250, 0)
     641       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2200, 250, 0)
    579642    ?>
    580643
    581644    <?lua
    582645        dofile("includes/asteroidField.lua")
    583        asteroidField(-2500, 400, 0, 20, 30, 2200, 250, 0)
     646       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2200, 250, 0)
    584647    ?>
    585648
    586649    <Planet
    587         position="15000,8000,-2000"
     650        position="<?lua printC(cPlanet1) ?>"
    588651        scale="2000"
    589652        collisionType="dynamic"
     
    611674    <?lua
    612675        dofile("includes/asteroidField.lua")
    613         asteroidBelt(15000, 8000, -2000, 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
     676        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
    614677    ?>
    615678
    616679    <Planet
    617         position="-1000,-20000,4000"
     680        position="<?lua printC(cPlanet2) ?>"
    618681        scale="3000"
    619682        collisionType="dynamic"
     
    641704    <?lua
    642705        dofile("includes/asteroidField.lua")
    643         asteroidBelt(-1000, -20000, 4000, 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
    644     ?>
    645 
    646     <!-- Allies, 3000,-2000 -->
     706        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
     707    ?>
     708
     709    <!-- Allies -->
    647710    <?lua
    648711    for i = 1, allies, 1
    649712    do
    650     x = 3000 + math.cos(2*math.pi/5*(i+1))*100
    651     y = -2000 + math.sin(2*math.pi/5*(i+1))*100
     713    x = rAllies[1] + math.cos(2*math.pi/allies*(i+1))*100
     714    y = rAllies[2] + math.sin(2*math.pi/allies*(i+1))*100
    652715    ?>
    653716    <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>
    654717        <templates>
    655             <Template link="spaceshipassff2" />
     718            <Template link="spaceshipassff" />
    656719        </templates>
    657720        <events>
     
    667730        </attached>
    668731        <controller>
    669             <WaypointPatrolController accuracy=100 name="allyController" alertnessradius=5000 team=0 active=false>
    670                 <events>
    671                     <activity>
    672                         <EventListener event="joinedUnit" />
    673                     </activity>
    674                 </events>
    675             </WaypointPatrolController>
     732            <!-- also see allyControllerDispatcher -->
     733            <AIController name="allyController" accuracy=100 team=0 active=false />
    676734        </controller>
    677735    </SpaceShip>
     
    686744    for i = 1, enemies, 1
    687745    do
    688     x = math.cos(math.pi/(8)*(i+1))*1500
    689     y = math.sin(math.pi/(8)*(i+1))*1500
     746    x = math.cos(math.pi/(enemies + 3)*(i+1))*1500
     747    y = math.sin(math.pi/(enemies + 3)*(i+1))*1500
    690748    ?>
    691749    <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>
     
    720778    <?lua end ?>
    721779
    722 
    723780    <!-- Transporter, starting Point is near A, end Point near B, the circle parameters for the waypoints are: Center = (0, -887, 0), r = 2613 -->
    724     <SpaceShip position="5000,-3000,0" lookat="-2494, -1667, 0" team=0 name="transporter" radarname="Shuttle">
     781    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle">
    725782        <templates>
    726783            <Template link="spaceshipTransporter" />
     
    744801
    745802                    <!-- Return Point -->
    746                     <Billboard position="-5000, -3000, 0" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
     803                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
    747804
    748805                    <!-- B to A -->
     
    758815
    759816                    <!-- Start Point -->
    760                     <Billboard position="5000,-3000,0" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
     817                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
    761818                </waypoints>
    762819            </WaypointController>
Note: See TracChangeset for help on using the changeset viewer.