Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/campaignHS15/data/levels/Campaign1.oxw @ 10767

Last change on this file since 10767 was 10767, checked in by paulsc, 8 years ago

Changed coordinates to (y,z,x) and implemented FPSPlayer. Undocking seems ineffective though (Has it ever been implemented?). This may be resolved by an 'undock dock'.

File size: 29.5 KB
Line 
1<LevelInfo
2    name = "CampaignHS15 1"
3    description = "Protect the transporter!"
4    tags = "mission"
5    screenshot = "missionOne.png"
6/>
7
8<?lua
9    include("stats.oxo")
10    include("HUDTemplates3.oxo")
11    include("templates/lodInformation.oxt")
12
13    include("templates/spaceshipAssff.oxt")
14    include("templates/spaceshipPirate.oxt")
15    include("templates/spaceshipEscort.oxt")
16    include("templates/spaceshipTransporter.oxt")
17    include("templates/FPS.oxt")
18?>
19
20<Level gametype = "Mission">
21    <templates>
22        <Template link="lodtemplate_default" />
23    </templates>
24
25    <?lua include("includes/notifications.oxi") ?>
26
27    <NotificationQueueCEGUI
28        name="narrative"
29        targets="simpleNotification"
30        size=3
31        displayTime=3.9
32        position="0.15, 0, 0.1, 0"
33        fontSize="23"
34        fontColor="0.3, 1, 0.2, 0.8"
35        alignment="HorzCentred"
36        displaySize="0.7, 0, 0, 0"
37    />
38
39    <!-- GLOBAL LUA VARIABLES -->
40    <?lua
41        waves = 3
42        enemies = 5
43        allies = 3
44
45        --[[ Coordinates in (y,z,x). NOTE: Indexing starts at 1 in lua! Don´t forget to adapt the for loops, too! ]]--
46        cCenter = {0, 0, 0}
47        cSpawn = {-50, 0, 0}
48        cUnit = {-2000, 0, 3000}
49        cA = {-3000, 0, 5000}
50        cB = {-3000, 0, -5000}
51        cC = {-2300, 0, 0}
52        dStation = {1, 0, 0}
53        cNewShip = {-2100, 0, 4100}
54        cFPSGround = {-2300, 800, 0}
55        cFPS = {-2300, 1000, 0}
56        cField1 = {400, 0, 2500}
57        cField2 = {400, 0, -2500}
58        cPlanet1 = {8000, -2000, 15000}
59        cPlanet2 = {-20000, 4000, -1000}
60        rAllies = {3000, -2000}         --[[ To be addressed directly, hence r. Do not permute! ]]--
61
62        --[[ Function to print Coordinates. Quotes not included! ]]--
63        function printC(coord)
64          print(coord[1] .. [[,]] .. coord[2] .. [[,]] .. coord[3])
65        end
66    ?>
67
68    <Scene
69        ambientlight = "0.8, 0.8, 0.8"
70        skybox = "Orxonox/skyBoxMoreNebula"
71        hasPhysics = true
72    >
73
74    <SpawnPoint name="playerSpawn" team=0 position="<?lua printC(cSpawn) ?>" lookat="<?lua printC(cCenter) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
75
76    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
77
78    <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"/>
79
80    <!--QUEST DEFINITIONS-->
81
82    <GlobalQuest id="quest1">
83        <QuestDescription title="Reach the Station A!" description="" failMessage="" completeMessage="" />
84        <hints>
85            <QuestHint id="quest1hint1" />
86        </hints>
87        <complete-effects>
88            <AddQuest questId="quest2" />
89            <AddQuest questId="quest2.1" />
90        </complete-effects>
91    </GlobalQuest>
92
93    <GlobalQuest id="quest2">
94        <QuestDescription title="Prepare to fight the Enemy" description="" failMessage="" completeMessage="" />
95        <hints>
96        </hints>
97        <subquests>
98            <GlobalQuest id="quest2.1">
99                <QuestDescription title="> Get a better Spaceship" description="" failMessage="" completeMessage="" />
100                <complete-effects>
101                    <AddQuest questId="quest2.2" />
102                </complete-effects>
103            </GlobalQuest>
104            <GlobalQuest id="quest2.2">
105                <QuestDescription title="> Meet your Unit" description="" failMessage="" completeMessage="" />
106            </GlobalQuest>
107        </subquests>
108        <complete-effects>
109            <AddQuest questId="quest3" />
110        </complete-effects>
111    </GlobalQuest>
112
113    <GlobalQuest id="quest3">
114        <QuestDescription title="Fight the first Wave" description="" failMessage="" completeMessage="" />
115        <hints>
116        </hints>
117        <complete-effects>
118            <AddQuest questId="quest4" />
119            <AddQuest questId="quest4.1" />
120            <AddQuest questId="quest4.2" />
121        </complete-effects>
122    </GlobalQuest>
123
124    <GlobalQuest id="quest4">
125        <QuestDescription title="Prepare for the next Wave" description="" failMessage="" completeMessage="" />
126        <hints>
127        </hints>
128        <subquests>
129            <GlobalQuest id="quest4.1">
130                <QuestDescription title="> Get to the Defense Station" description="" failMessage="" completeMessage="" />
131            </GlobalQuest>
132            <GlobalQuest id="quest4.2">
133                <QuestDescription title="> Find the turret" description="" failMessage="" completeMessage="" />
134            </GlobalQuest>
135        </subquests>
136        <complete-effects>
137            <AddQuest questId="quest5" />
138        </complete-effects>
139    </GlobalQuest>
140
141    <GlobalQuest id="quest5">
142        <QuestDescription title="Fight the Hord!" description="" failMessage="" completeMessage="" />
143        <hints>
144        </hints>
145        <complete-effects>
146            <AddQuest questId="quest6" />
147            <AddQuest questId="quest6.1" />
148            <AddQuest questId="quest6.2" />
149        </complete-effects>
150    </GlobalQuest>
151
152    <GlobalQuest id="quest6">
153        <QuestDescription title="Get back to the Transporter" description="" failMessage="" completeMessage="" />
154        <hints>
155        </hints>
156        <subquests>
157            <GlobalQuest id="quest6.1">
158                <QuestDescription title="> Collect the local Pickups" description="" failMessage="" completeMessage="" />
159            </GlobalQuest>
160            <GlobalQuest id="quest6.2">
161                <QuestDescription title="> Use Portal to the Transporter" description="" failMessage="" completeMessage="" />
162            </GlobalQuest>
163        </subquests>
164        <complete-effects>
165            <AddQuest questId="quest7" />
166        </complete-effects>
167    </GlobalQuest>
168
169    <GlobalQuest id="quest7">
170        <QuestDescription title="Fight the final Wave" description="" failMessage="" completeMessage="" />
171        <hints>
172        </hints>
173        <subquests>
174        </subquests>
175    </GlobalQuest>
176
177    <!--EVENTS AND TRIGGERS
178        Usable events and triggers:
179        _spawntrigger
180        _reachedA
181        _dock<A|B|C>
182        _docked<A>      WIP; see below
183        -joinedUnit
184        _wave<k>
185        _killedEnemy<k>.<i>
186        _waveClear<k>
187    -->
188
189    <EventMultiTrigger name="spawntrigger">
190        <events>
191            <trigger>
192                <EventListener event="playerSpawn" />
193            </trigger>
194        </events>
195    </EventMultiTrigger>
196
197    <DistanceTrigger name="reachedA" position="<?lua printC(cA) ?>" distance=1000 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
198
199    <!-- TODO: find out how to link an event to the COMPLETION of a dock. How is this not possible?? -->
200    <EventMultiTrigger name="dockedA" activations="1" stayactive="true" delay=3>
201        <events>
202            <trigger>
203                <EventListener event="dockA" />
204            </trigger>
205        </events>
206    </EventMultiTrigger>
207
208    <DistanceTrigger name="joinedUnit" active=false position="<?lua printC(cUnit) ?>" distance=100 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true>
209        <events>
210            <activity>
211                    <EventListener event="dockedA" />
212            </activity>
213        </events>
214    </DistanceTrigger>
215
216    <EventMultiTrigger name="wave1" activations="1" delay=4>
217        <events>
218            <trigger>
219                <EventListener event="joinedUnit" />
220            </trigger>
221        </events>
222    </EventMultiTrigger>
223
224    <!-- Recursive helper function for the end-of-wave events. F*ck the event system, seriously. -->
225    <?lua
226    function enemyTriggerRecursor(i, k)
227    if i > 0 then
228    return [[
229    <EventTrigger name=killedEnemy]] .. k .. [[.]] .. i .. [[ activations=1 stayactive=true delay=0.1>
230        <events>
231            <trigger>
232                <EventListener event=attackers]] .. k .. [[ />
233            </trigger>
234        </events>
235        ]] .. enemyTriggerRecursor(i-1, k) .. [[
236    </EventTrigger>
237    ]]
238    else return ""
239    end
240    end
241    ?>
242    <!-- Actual recursive Event(s) for the respective waves. -->
243    <?lua
244    for k = 1, waves, 1
245    do
246    print(enemyTriggerRecursor(enemies,k))
247    ?>
248    <EventMultiTrigger name="waveClear<?lua print(k) ?>" delay=4.0>
249        <events>
250            <trigger>
251                <EventListener event="killedEnemy<?lua print(k .. [[.]] .. enemies) ?>" />
252            </trigger>
253        </events>
254    </EventMultiTrigger>
255    <?lua end ?>
256
257    <!-- This controls the ally AI controller so it is only active when active enemies are around!
258    TODO: Find a way to control the allies in another case (Multiple controllers are not allowed). -->
259    <EventDispatcher name="allyControllerDispatcher">
260      <targets>
261        <EventTarget target="allyController" />
262      </targets>
263      <events>
264          <activity>
265              <?lua
266              for k = 1, waves, 1 do
267              ?>
268              <Trigger mode=and>
269                  <EventTrigger>
270                      <events>
271                          <trigger>
272                              <EventListener event="wave<?lua print(k) ?>" />
273                          </trigger>
274                      </events>
275                  </EventTrigger>
276                  <EventTrigger invert=true>
277                      <events>
278                          <trigger>
279                              <EventListener event="waveClear<?lua print(k) ?>" />
280                          </trigger>
281                      </events>
282                  </EventTrigger>
283              </Trigger>
284              <?lua end ?>
285          </activity>
286      </events>
287    </EventDispatcher>
288
289    <!-- FIXME: This trigger needs fixing, as endMission can only be called by a Pawn Distance Trigger. Herpaderp.
290    Also, the fix proposed in MissionOne does not work anymore... -->
291   <EventMultiTrigger name="missionFailed" target="Pawn" stayActive="true" delay=1.5>
292       <events>
293           <trigger>
294               <EventListener event="transporter" />
295           </trigger>
296       </events>
297   </EventMultiTrigger>
298
299    <Script code="Mission endMission fail" onLoad="false">
300        <events>
301            <trigger>
302                <EventListener event="missionFailed" />
303            </trigger>
304        </events>
305    </Script>
306
307    <!--QUEST EFFECT BEACONS -->
308
309    <QuestEffectBeacon times=1>
310        <effects>
311            <AddQuest questId="quest1" />
312        </effects>
313        <events>
314            <execute>
315                <EventListener event="spawntrigger" />
316            </execute>
317        </events>
318    </QuestEffectBeacon>
319
320    <QuestEffectBeacon times=1>
321        <effects>
322            <CompleteQuest questId="quest1" />
323        </effects>
324        <events>
325            <execute>
326                <EventListener event="reachedA" />
327            </execute>
328        </events>
329    </QuestEffectBeacon>
330
331    <QuestEffectBeacon times=1>
332        <effects>
333            <CompleteQuest questId="quest2.1" />
334        </effects>
335        <events>
336            <execute>
337                <EventListener event="dockedA" />
338            </execute>
339        </events>
340    </QuestEffectBeacon>
341
342    <QuestEffectBeacon times=1>
343        <effects>
344            <CompleteQuest questId="quest2.2" />
345            <CompleteQuest questId="quest2" />
346        </effects>
347        <events>
348            <execute>
349                <EventListener event="joinedUnit" />
350            </execute>
351        </events>
352    </QuestEffectBeacon>
353
354    <QuestEffectBeacon times=1>
355        <effects>
356            <CompleteQuest questId="quest3" />
357        </effects>
358        <events>
359            <execute>
360                <EventListener event="waveClear1" />
361            </execute>
362        </events>
363    </QuestEffectBeacon>
364
365    <!--NOTIFICATIONS -->
366
367    <SimpleNotification broadcast="true" message="Welcome, Commander. Please report at Station A.">
368        <events>
369            <trigger>
370                <EventTrigger stayactive="true" delay=4 >
371                   <events>
372                      <trigger>
373                         <EventListener event="spawntrigger" />
374                      </trigger>
375                   </events>
376                </EventTrigger>
377            </trigger>
378        </events>
379    </SimpleNotification>
380
381    <SimpleNotification broadcast="true" message="Our enemy is set to attack us very soon.">
382        <events>
383            <trigger>
384                <EventTrigger stayactive="true" delay=8 >
385                   <events>
386                      <trigger>
387                         <EventListener event="spawntrigger" />
388                      </trigger>
389                   </events>
390                </EventTrigger>
391            </trigger>
392        </events>
393    </SimpleNotification>
394
395    <SimpleNotification broadcast="true" message="Please study your mission briefing!">
396        <events>
397            <trigger>
398                <EventTrigger stayactive="true" delay=12 >
399                   <events>
400                      <trigger>
401                         <EventListener event="spawntrigger" />
402                      </trigger>
403                   </events>
404                </EventTrigger>
405            </trigger>
406        </events>
407    </SimpleNotification>
408
409    <SimpleNotification broadcast="true" message="Welcome to Station A, Commander.">
410        <events>
411            <trigger>
412                <EventListener event="reachedA" />
413            </trigger>
414        </events>
415    </SimpleNotification>
416
417    <SimpleNotification broadcast="true" message="We've prepared a reinforced Ship for you.">
418        <events>
419            <trigger>
420                <EventTrigger stayactive="true" delay=4 >
421                   <events>
422                      <trigger>
423                         <EventListener event="reachedA" />
424                      </trigger>
425                   </events>
426                </EventTrigger>
427            </trigger>
428        </events>
429    </SimpleNotification>
430
431    <SimpleNotification broadcast="true" message="Now join our defense Team.">
432        <events>
433            <trigger>
434                <EventListener event="dockedA" />
435            </trigger>
436        </events>
437    </SimpleNotification>
438
439    <SimpleNotification broadcast="true" message="Howdy Commander! Ready to kick alien ass?">
440        <events>
441            <trigger>
442                <EventListener event="joinedUnit" />
443            </trigger>
444        </events>
445    </SimpleNotification>
446
447    <SimpleNotification broadcast="true" message="An enemy wave is approaching the shuttle!">
448        <events>
449            <trigger>
450                <EventListener event="wave1" />
451                <EventListener event="wave2" />
452                <EventListener event="wave3" />
453            </trigger>
454        </events>
455    </SimpleNotification>
456
457    <SimpleNotification broadcast="true" message="yippie ki yay motherf*cker!">
458        <events>
459            <trigger>
460                <EventListener event="attackers1" />
461                <EventListener event="attackers2" />
462                <EventListener event="attackers3" />
463            </trigger>
464        </events>
465    </SimpleNotification>
466
467    <SimpleNotification broadcast="true" message="Phew, that was close! Well done, Commmander.">
468        <events>
469            <trigger>
470                <EventListener event="waveClear1" />
471                <EventListener event="waveClear2" />
472                <EventListener event="waveClear3" />
473            </trigger>
474        </events>
475    </SimpleNotification>
476
477    <SimpleNotification broadcast="true" message="It's over... we failed. Retreat!">
478        <events>
479            <trigger>
480                <EventListener event="missionFailed" />
481            </trigger>
482        </events>
483    </SimpleNotification>
484
485    <!--STATIONS -->
486
487    <!-- (Temporary) Template for stations. Used to define common features of all Stations. -->
488    <Template name="station">
489        <Pawn mass=10000 collisionType=dynamic friction=0.01>
490            <attached>
491                <Model mesh="HydroHarvester.mesh" position="0,0,0" scale=50 />
492                <DistanceTriggerBeacon name="NPC" />
493            </attached>
494            <collisionShapes>
495                <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
496                <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
497                <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
498                <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
499                <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
500                <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
501                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
502                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
503                <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
504                <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
505                <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
506                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
507                <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
508                <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
509                <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
510                <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
511            </collisionShapes>
512        </Pawn>
513    </Template>
514
515    <!-- A, Coordinates are approx. (cos(29pi/16), sin(29pi/16), 0)*3000 -->
516    <Pawn name="statA" team=0 radarname="Station A" position="<?lua printC(cA) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
517        <templates>
518            <Template link="station" />
519        </templates>
520        <attached>
521            <DockingTarget name="dockTargetA" />
522            <Dock position="0,0,0" active=true>
523                <animations>
524                    <MoveToDockingTarget target="dockTargetA" />
525                </animations>
526                <effects>
527                    <DockToShip target="newSpaceShip" />
528                </effects>
529                <events>
530                    <execute>
531                        <EventListener event="dockA" />
532                    </execute>
533                </events>
534                <attached>
535                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockA" />
536                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
537                </attached>
538            </Dock>
539        </attached>
540    </Pawn>
541
542    <!-- B, Coordinates are approx. (-cos(29pi/16), sin(29pi/16), 0)*3000 -->
543    <Pawn name="statB" team=0 radarname="Station B" position="<?lua printC(cB) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
544        <templates>
545            <Template link="station" />
546        </templates>
547        <attached>
548            <DockingTarget name="dockTargetB" />
549            <Dock position="0,0,0" active=true>
550                <animations>
551                    <MoveToDockingTarget target="dockTargetB" />
552                </animations>
553                <effects>
554                    <DockToShip target="newSpaceShip" />
555                </effects>
556                <events>
557                    <execute>
558                        <EventListener event="dockB" />
559                    </execute>
560                </events>
561                <attached>
562                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockB" />
563                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
564                </attached>
565            </Dock>
566        </attached>
567    </Pawn>
568
569    <!-- C -->
570    <Pawn name="statC" team=0 radarname="Station C" position="<?lua printC(cC) ?>" direction="<?lua printC(dStation) ?>" initialhealth=10000 maxhealth=10000>
571        <templates>
572            <Template link="station" />
573        </templates>
574        <attached>
575            <DockingTarget name="dockTargetC" />
576            <Dock position="0,0,0" active=true>
577                <animations>
578                    <MoveToDockingTarget target="dockTargetC" />
579                </animations>
580                <effects>
581                    <DockToShip target="fpsMode" />
582                </effects>
583                <events>
584                    <execute>
585                        <EventListener event="dockC" />
586                    </execute>
587                    <undocking>
588                        <EventListener event="undockC" />
589                    </undocking>
590                </events>
591                <attached>
592                    <DistanceTrigger position="0,0,0" distance="200" target="SpaceShip" beaconMode="exclude" targetname="NPC" name="dockC" />
593                    <Billboard position="0,0,0" amplitude=1 material="Flares/lensflare" colour="1,0,0.05" />
594                </attached>
595            </Dock>
596        </attached>
597    </Pawn>
598
599    <!-- New SpaceShip as destination of dock A-->
600    <SpaceShip
601            template            = "spaceshipassff"
602            team                = "0"
603            position            = "<?lua printC(cNewShip) ?>"
604            lookat              = "<?lua printC(cCenter) ?>"
605            health              = "400"
606            initialhealth       = "400"
607            maxhealth           = "500"
608            shieldhealth        = "80"
609            initialshieldhealth = "80"
610            maxshieldhealth     = "120"
611            shieldabsorption    = "0.8"
612            reloadrate          = "1"
613            reloadwaittime      = "1"
614            name                = "newSpaceShip"
615            radarname           = "Defender" >
616        <attached>
617            <DockingTarget name="newSpaceShip" />
618            <DistanceTriggerBeacon name="newSpaceShip" />
619        </attached>
620    </SpaceShip>
621
622    <!-- FPS Player as destination of dock C -->
623    <FpsPlayer team=0 template = "fps" radarname = "Cannon Suit" position = "<?lua printC(cFPS) ?>" lookat="<?lua printC(cCenter) ?>">
624        <attached>
625            <DockingTarget name="fpsMode" />
626            <DistanceTriggerBeacon name="fpsPlayer" />
627        </attached>
628        <collisionShapes>
629            <BoxCollisionShape position="0,0,0" halfExtents="1,1,1"/>
630        </collisionShapes>
631    </FpsPlayer>
632
633    <!-- Floor for FPS Player -->
634    <StaticEntity position="<?lua printC(cFPSGround) ?>" collisionType=static mass=100000 friction=0.01 >
635        <attached>
636            <Model position="0,0,0" mesh="crate.mesh" scale3D="80,5,80" />
637            <Billboard position="320,50,320" material="Flares/ringflare2" colour="0.2,0.4,0.8" />
638            <DistanceTrigger position="320,50,320" distance="50" target="Pawn" beaconMode="identify" targetname="fpsPlayer" name="undockC"/>
639            <ForceField active=false position="0,0,0" mode="homogen" diameter="600" forcedirection = "0,-500,0" />
640            <!-- TODO: Invisible boundaries to prevent falling off platform -->
641        </attached>
642        <collisionShapes>
643            <BoxCollisionShape position="0,0,0" halfExtents="400,25,400" />
644        </collisionShapes>
645    </StaticEntity>
646
647    <!--ELEMENTS -->
648
649    <?lua
650        dofile("includes/asteroidField.lua")
651       asteroidField(cField1[1], cField1[2], cField1[3], 20, 30, 2200, 250, 0)
652    ?>
653
654    <?lua
655        dofile("includes/asteroidField.lua")
656       asteroidField(cField2[1], cField2[2], cField2[3], 20, 30, 2200, 250, 0)
657    ?>
658
659    <Planet
660        position="<?lua printC(cPlanet1) ?>"
661        scale="2000"
662        collisionType="dynamic"
663        linearDamping="0.8"
664        angularDamping="0"
665        mass="5000000"
666        pitch="0"
667        mesh="planets/muunilinst.mesh"
668        atmosphere="atmosphere1"
669        rotationaxis="1,0,0"
670        rotationrate="1.0"
671        atmospheresize="80.0f"
672        imagesize="1024.0f"
673        collisiondamage = 2
674        enablecollisiondamage = true
675      >
676      <attached>
677        <ForceField position="0,0,0" mode="sphere" diameter="4000" velocity="-500" />
678        </attached>
679          <collisionShapes>
680            <SphereCollisionShape radius="2000" position="0,0,0" />
681      </collisionShapes>
682    </Planet>
683
684    <?lua
685        dofile("includes/asteroidField.lua")
686        asteroidBelt(cPlanet1[1], cPlanet1[2], cPlanet1[3], 30, 0, 30, 20, 40, 2800, 3000, 200, 1)
687    ?>
688
689    <Planet
690        position="<?lua printC(cPlanet2) ?>"
691        scale="3000"
692        collisionType="dynamic"
693        linearDamping="0.8"
694        angularDamping="0"
695        mass="5000000"
696        pitch="0"
697        mesh="planets/planet3.mesh"
698        atmosphere="atmosphere1"
699        rotationaxis="1,0,0"
700        rotationrate="1.0"
701        atmospheresize="80.0f"
702        imagesize="1024.0f"
703        collisiondamage = 2
704        enablecollisiondamage = true
705      >
706      <attached>
707        <ForceField position="0,0,0" mode="sphere" diameter="6000" velocity="-500" />
708        </attached>
709          <collisionShapes>
710            <SphereCollisionShape radius="3000" position="0,0,0" />
711      </collisionShapes>
712    </Planet>
713
714    <?lua
715        dofile("includes/asteroidField.lua")
716        asteroidBelt(cPlanet2[1], cPlanet2[2], cPlanet2[3], 30, 20, 100, 20, 40, 3400, 3700, 400, 1)
717    ?>
718
719    <!-- Allies -->
720    <?lua
721    for i = 1, allies, 1
722    do
723    x = rAllies[1] + math.cos(2*math.pi/allies*(i+1))*100
724    y = rAllies[2] + math.sin(2*math.pi/allies*(i+1))*100
725    ?>
726    <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>
727        <templates>
728            <Template link="spaceshipassff" />
729        </templates>
730        <events>
731            <visibility>
732                <EventListener event="dockedA" />
733            </visibility>
734            <activity>
735                <EventListener event="dockedA" />
736            </activity>
737        </events>
738        <attached>
739            <DistanceTriggerBeacon name="NPC" />
740        </attached>
741        <controller>
742            <!-- also see allyControllerDispatcher -->
743            <AIController name="allyController" accuracy=100 team=0 active=false />
744        </controller>
745    </SpaceShip>
746    <?lua end ?>
747
748    <!-- Enemies. Outer loop defines waves, inner loop defines enemies in every wave. -->
749    <?lua
750    for k = 1, waves, 1
751    do
752    ?>
753    <?lua
754    for i = 1, enemies, 1
755    do
756    x = math.cos(math.pi/(enemies + 3)*(i+1))*1500
757    y = math.sin(math.pi/(enemies + 3)*(i+1))*1500
758    ?>
759    <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>
760        <templates>
761            <Template link="spaceshippirate" />
762        </templates>
763        <events>
764            <visibility>
765                <EventListener event="wave<?lua print(k)?>" />
766            </visibility>
767            <activity>
768                <EventListener event="wave<?lua print(k)?>" />
769            </activity>
770        </events>
771        <attached>
772            <DistanceTriggerBeacon name="NPC" />
773        </attached>
774        <controller>
775            <WaypointPatrolController name="attackController" accuracy=100 alertnessradius=100 team=1 active=false>
776                <waypoints>
777                    <Attacher target="transporter" deletewithparent=false />
778                </waypoints>
779                <events>
780                    <activity>
781                        <EventListener event="wave<?lua print(k)?>" />
782                    </activity>
783                </events>
784            </WaypointPatrolController>
785        </controller>
786    </SpaceShip>
787    <?lua end ?>
788    <?lua end ?>
789
790    <!-- Transporter, starting Point is near A, end Point near B, the circle parameters for the waypoints are: Center = (0, -887, 0), r = 2613 -->
791    <SpaceShip position="<?lua printC(cA) ?>" lookat="<?lua printC(cB) ?>" team=0 name="transporter" radarname="Shuttle">
792        <templates>
793            <Template link="spaceshipTransporter" />
794        </templates>
795        <attached>
796            <DistanceTriggerBeacon name="NPC" />
797        </attached>
798        <controller>
799            <WaypointController accuracy=10 team=0>
800                <waypoints>
801                    <!-- A to B -->
802                    <?lua
803                    max = 5
804                    for i = 1, max, 1
805                    do
806                    x = math.cos(math.pi*(i+1)/8)*5000
807                    y = -math.sin(math.pi*(i+1)/8)*700-3000
808                    ?>
809                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
810                    <?lua end ?>
811
812                    <!-- Return Point -->
813                    <Billboard position="<?lua printC(cB) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
814
815                    <!-- B to A -->
816                    <?lua
817                    max = 5
818                    for i = 1, max, 1
819                    do
820                    x = math.cos(math.pi*(max+2-i)/8)*5000
821                    y = -math.sin(math.pi*(max+2-i)/8)*700-3000
822                    ?>
823                    <Billboard position="<?lua print(y) ?>,0,<?lua print(x) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
824                    <?lua end ?>
825
826                    <!-- Start Point -->
827                    <Billboard position="<?lua printC(cA) ?>" amplitude=1 material="Flares/lensflare" colour="1,1,0.05"/>
828                </waypoints>
829            </WaypointController>
830        </controller>
831    </SpaceShip>
832
833    </Scene>
834</Level>
Note: See TracBrowser for help on using the repository browser.