Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 25, 2015, 1:26:44 AM (9 years ago)
Author:
paulsc
Message:

Made further improvements to events and quests. Some things need fixing though, see comments.

File:
1 edited

Legend:

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

    r10684 r10689  
    2828    <?lua include("includes/notifications.oxi") ?>
    2929    <NotificationQueueCEGUI
    30       name="narrative"
    31       targets="simpleNotification"
    32       size=3
    33       displayTime=3.9
    34       position="0.15, 0, 0.1, 0"
    35       fontSize="23"
    36       fontColor="0.3, 1, 0.2, 0.8"
    37       alignment="HorzCentred"
    38       displaySize="0.7, 0, 0, 0"
    39       />
     30        name="narrative"
     31        targets="simpleNotification"
     32        size=3
     33        displayTime=3.9
     34        position="0.15, 0, 0.1, 0"
     35        fontSize="23"
     36        fontColor="0.3, 1, 0.2, 0.8"
     37        alignment="HorzCentred"
     38        displaySize="0.7, 0, 0, 0"
     39    />
     40
     41    <!-- GLOBAL LUA VARIABLES -->
     42    <?lua
     43        waves = 3
     44        enemies = 5
     45    ?>
    4046
    4147    <Scene
     
    4450    >
    4551
    46     <SpawnPoint name="PlayerSpawn" team=1 position="0,-50,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
     52    <SpawnPoint name="playerSpawn" team=1 position="0,-50,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
    4753
    4854    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
     
    5864        </hints>
    5965        <complete-effects>
     66            <!-- Quest 2 not made as of yet
    6067            <AddQuest questId="quest2" />
    6168            <AddQuest questId="quest2.1" />
    6269            <AddQuest questId="quest2.2" />
    6370            <AddQuest questId="quest2.3" />
     71            -->
     72            <AddQuest questId="quest3" />
    6473        </complete-effects>
    6574    </GlobalQuest>
     
    153162        _spawntrigger
    154163        _reachedA
    155         _wave<1|2|3>
     164        _wave<k>
     165        _killedEnemy<k>.<i>
     166        _waveClear<k>
    156167    -->
    157168
     
    159170        <events>
    160171            <trigger>
    161                 <EventListener event="PlayerSpawn" />
     172                <EventListener event="playerSpawn" />
    162173            </trigger>
    163174        </events>
    164175    </EventMultiTrigger>
     176
     177    <DistanceTrigger name="reachedA" position="2494,-1667,0" distance=200 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
     178
     179    <EventMultiTrigger name="wave1" activations="1" stayactive="true" >
     180        <events>
     181            <trigger>
     182                <EventListener event="reachedA" />
     183            </trigger>
     184        </events>
     185    </EventMultiTrigger>
     186
     187    <!-- Recursive helper function for the end-of-wave events. F*ck the event system, seriously. -->
     188    <?lua
     189    function enemyTriggerRecursor(i, k)
     190    if i > 0 then
     191    return [[
     192    <EventTrigger name=killedEnemy]] .. k .. [[.]] .. i .. [[ activations=1 stayactive=true delay=0.1>
     193        <events>
     194            <trigger>
     195                <EventListener event=attackers]] .. k .. [[ />
     196            </trigger>
     197        </events>
     198        ]] .. enemyTriggerRecursor(i-1, k) .. [[
     199    </EventTrigger>
     200    ]]
     201    else return ""
     202    end
     203    end
     204    ?>
     205    <!-- Actual recursive Event(s) for the respective waves. -->
     206    <?lua
     207    for k = 1, waves, 1
     208    do
     209    print(enemyTriggerRecursor(enemies,k))
     210    ?>
     211    <EventMultiTrigger name="waveClear<?lua print(k) ?>" delay=4.0>
     212        <events>
     213            <trigger>
     214                <EventListener event="killedEnemy<?lua print(k .. [[.]] .. enemies) ?>" />
     215            </trigger>
     216        </events>
     217    </EventMultiTrigger>
     218    <?lua end ?>
     219
     220    <!-- This trigger needs fixing, as endMission can only be called by a Pawn Distance Trigger. Herpaderp -->
     221    <EventMultiTrigger name="missionFailed" target="Pawn" stayActive="true" delay=1.5>
     222        <events>
     223            <trigger>
     224                <EventListener event="transporter" />
     225            </trigger>
     226        </events>
     227    </EventMultiTrigger>
     228
     229    <Script code="Mission endMission fail" onLoad="false" times="1">
     230        <events>
     231            <trigger>
     232                <EventListener event="missionFailed" />
     233            </trigger>
     234        </events>
     235    </Script>
     236
     237    <!--QUEST EFFECT BEACONS -->
    165238
    166239    <QuestEffectBeacon times=1>
     
    175248    </QuestEffectBeacon>
    176249
    177     <DistanceTrigger name="reachedA" position="2494,-1667,0" distance=200 target="SpaceShip" beaconMode="exclude" targetname="NPC" stayactive=true />
    178 
    179     <EventMultiTrigger name="wave1">
    180         <events>
    181             <trigger>
     250    <QuestEffectBeacon times=1>
     251        <effects>
     252            <CompleteQuest questId="quest1" />
     253        </effects>
     254        <events>
     255            <execute>
    182256                <EventListener event="reachedA" />
    183             </trigger>
    184         </events>
    185     </EventMultiTrigger>
     257            </execute>
     258        </events>
     259    </QuestEffectBeacon>
     260
     261    <QuestEffectBeacon times=1>
     262        <effects>
     263            <CompleteQuest questId="quest3" />
     264        </effects>
     265        <events>
     266            <execute>
     267                <EventListener event="waveClear1" />
     268            </execute>
     269        </events>
     270    </QuestEffectBeacon>
    186271
    187272    <!--NOTIFICATIONS -->
     
    211296                <EventListener event="attackers2" />
    212297                <EventListener event="attackers3" />
     298            </trigger>
     299        </events>
     300    </SimpleNotification>
     301
     302    <SimpleNotification broadcast="true" message="Phew, that was close! Well done, Commmander.">
     303        <events>
     304            <trigger>
     305                <EventListener event="waveClear1" />
     306                <EventListener event="waveClear2" />
     307                <EventListener event="waveClear3" />
     308            </trigger>
     309        </events>
     310    </SimpleNotification>
     311
     312    <SimpleNotification broadcast="true" message="It's over... we failed. Retreat!">
     313        <events>
     314            <trigger>
     315                <EventListener event="missionFailed" />
    213316            </trigger>
    214317        </events>
     
    251354    <!-- Enemies. Outer loop defines waves, inner loop defines enemies in every wave. -->
    252355    <?lua
    253     waves = 5
    254356    for k = 1, waves, 1
    255357    do
    256358    ?>
    257359    <?lua
    258     enemies = 5
    259360    for i = 1, enemies, 1
    260361    do
Note: See TracChangeset for help on using the changeset viewer.