home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 2 (DVD) / XENIADVD2.iso / Fragzone / Files / mw4mercseditor.exe / content / ABLScripts / StockScripts / Stock_Strongholds.abl < prev    next >
Encoding:
Text File  |  2002-10-11  |  7.2 KB  |  235 lines

  1. fsm StockStrongholds : integer;        
  2.  
  3.     const
  4.         #include_ <content\ABLScripts\mwconst.abi>
  5.  
  6.     type
  7.         #include_ <content\ABLScripts\mwtype.abi>
  8.  
  9.     var
  10.         static ObjectID        Blue_goal1;
  11.         static ObjectID        Blue_goal2;
  12.         static ObjectID        Red_goal1;
  13.         static ObjectID        Red_goal2;
  14.  
  15.         static integer        Blue_score_add;
  16.         static integer        Red_score_add;
  17.  
  18.         static integer        game_timer;
  19.         static integer        pause_timer;
  20.         static integer        respawn_timer;
  21.  
  22.         static integer        Blue_Guard_team;
  23.         static integer        Red_Guard_team;
  24.         static boolean         winning;
  25.         static boolean      RedHQ;                  // This is whether the Red HQ building is alive
  26.         static boolean      RedComm;                // This is whether the Red Comm building is alive
  27.         static boolean      BlueHQ;                 // This is whether the Blue HQ building is alive
  28.         static boolean      BlueComm;               // This is whether the Blue Comm building is alive
  29.         static integer      toggler1;               // This makes it so there is a lengthier pause b/n some sounds
  30.         static integer      toggler2;               // This makes it so there is a lengthier pause b/n some sounds
  31.  
  32. function PlayBigAlerts;
  33.     code
  34.         PlayTeamBettySound(1,SOUND_TRIGGER_MISSILE_LOCKED_ON_ME);
  35.         PlayTeamBettySound(2,SOUND_TRIGGER_MISSILE_LOCKED_ON_ME);
  36.         Return;
  37. endfunction;
  38.  
  39. function PlaySmallAlerts;
  40.     code
  41.         PlayTeamBettySound(1,SOUND_TRIGGER_NARC_SIGNAL_START);
  42.         PlayTeamBettySound(2,SOUND_TRIGGER_NARC_SIGNAL_START);
  43.         Return;
  44. endfunction;
  45.  
  46. function init;
  47.     code
  48.         // Goal for Team 2 - Kill this
  49.         GroupAddObject(GroupObjectId(20),ebu_Blue_HQ);
  50.         GroupAddObject(GroupObjectId(20),ebu_Blue_Communications);
  51.         MarkBuildingAsScorable(ebu_Blue_HQ);
  52.         MarkBuildingAsScorable(ebu_Blue_Communications);
  53.         
  54.         // Goal for Team 1 - Kill this
  55.         GroupAddObject(GroupObjectId(30),ebu_Red_HQ);
  56.         GroupAddObject(GroupObjectId(30),ebu_Red_Communications);
  57.         MarkBuildingAsScorable(ebu_Red_HQ);
  58.         MarkBuildingAsScorable(ebu_Red_Communications);
  59.         
  60.         Blue_Guard_team    = TeamObjectID(1);
  61.         Red_Guard_team    = TeamObjectID(2);
  62.  
  63.         Blue_score_add = 350;
  64.         Red_score_add = 350;
  65.  
  66.         SetupScoring_Strongholds; 
  67.       
  68.         // Misc setup
  69.           winning = false;
  70.         game_timer = gti_timer_1;
  71.         pause_timer = gti_timer_2;
  72.         respawn_timer = gti_timer_3;
  73.         
  74. endfunction;
  75.  
  76. function BlueTeamScores;
  77.     code
  78.         AddPoints(Blue_Guard_team,Blue_score_add);
  79. endfunction;
  80.  
  81. function RedTeamScores;
  82.     code
  83.         AddPoints(Red_Guard_team,Red_score_add);
  84. endfunction;
  85.  
  86. state StartState;
  87.     code
  88.         revealnavpoint(ena_Nav_Center);
  89.         revealnavpoint(ena_Blue_Base);
  90.         revealnavpoint(ena_Red_Base);
  91.         TeamSetNav(1,ena_Red_Base);
  92.         TeamSetNav(2,ena_Blue_Base);
  93.         ResetTimer(Game_timer);
  94.  
  95.         StartTimer(4);  // This is the timer for the warning messages about buildings
  96.         ResetTimer(4);
  97.         
  98.         trans goState;
  99.         
  100. endstate;
  101.  
  102. state goState;
  103.     code
  104.  
  105.         if (not winning) then
  106.             if (GroupAllDead(GroupObjectID(20))) then
  107.                 RedTeamScores;
  108.                 ChatMessage("Blue Team's Base has been destroyed!");
  109.                 ChatMessage("Respawn in 5 seconds.");
  110.                 LogHQDestroyed(team1,team2);
  111.                 ResetTimer(Pause_Timer);
  112.                 ResetTimer(Respawn_Timer);
  113.                 winning = true;
  114.                    trans deadState;
  115.             endif;
  116.         endif;
  117.             
  118.         if (not winning) then
  119.             if (GroupAllDead(GroupObjectID(30))) then
  120.                 BlueTeamScores;
  121.                 ChatMessage("Red Team's Base has been destroyed!");
  122.                 ChatMessage("Respawn in 5 seconds.");
  123.                 LogHQDestroyed(team2,team1);
  124.                 ResetTimer(Pause_Timer);
  125.                 ResetTimer(Respawn_Timer);
  126.                 winning = true;
  127.                   trans deadState;
  128.             endif;
  129.         endif;
  130.  
  131.         if (timegreater(4,5)) then
  132.             if (not RedComm) then
  133.                 if (isshot(GroupObjectID(30))) then
  134.                     if (toggler1>3) then
  135.                         PlayTeamBettySound(2,SOUND_TRIGGER_ALARM1);
  136.                         ChatMessage("Red base is under attack.");
  137.                         toggler1=0;
  138.                     endif;
  139.                 endif;
  140.             endif;
  141.             
  142.             if (not RedHQ) then
  143.                 if (isdead(ebu_Red_HQ)) then
  144.                     BlueTeamScores;
  145.                     ChatMessage("Red HQ has been destroyed.");
  146.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  147.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  148.                     PlayBigAlerts;
  149.                     RedHQ = true;
  150.                 endif;
  151.             endif;
  152.             
  153.             if (not RedComm) then
  154.                 if (isdead(ebu_Red_Communications)) then
  155.                     BlueTeamScores;
  156.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  157.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  158.                     ChatMessage("Red Communications has been destroyed.");
  159.                     PlayBigAlerts;
  160.                     RedComm = true;
  161.                 endif;
  162.             endif;
  163.  
  164.             if (not BlueComm) then
  165.                 if (isshot(GroupObjectID(20))) then
  166.                     if (toggler2>3) then
  167.                         PlayTeamBettySound(1,SOUND_TRIGGER_ALARM1);
  168.                         ChatMessage("Blue base is under attack.");
  169.                         toggler2=0;
  170.                     endif;
  171.                 endif;
  172.             endif;
  173.             
  174.             if (not BlueHQ) then
  175.                 if (isdead(ebu_Blue_HQ)) then
  176.                     RedTeamScores;
  177.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  178.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  179.                     ChatMessage("Blue HQ has been destroyed.");
  180.                     PlayBigAlerts;
  181.                     BlueHQ = true;
  182.                 endif;
  183.             endif;
  184.             
  185.             if (not BlueComm) then
  186.                 if (isdead(ebu_Blue_Communications)) then
  187.                     RedTeamScores;
  188.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  189.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  190.                     ChatMessage("Blue Communications has been destroyed.");
  191.                     PlayBigAlerts;
  192.                     BlueComm = true;
  193.                 endif;
  194.             endif;
  195.             
  196.             Toggler1 = Toggler1 + 1;
  197.             Toggler2 = Toggler2 + 1;
  198.             
  199.             resettimer(4);
  200.         endif;
  201.         
  202.         if (not ismusicplaying) then
  203.             StartMusic("Music\DesertAmbLoop",0.0,10.0,20);
  204.         endif;
  205.         
  206. endstate;
  207.  
  208. state deadState;
  209.     code
  210.  
  211.         if (timegreater (pause_timer,5)) then    
  212.             LogMMapRespawn;
  213.             Winning = False;
  214.             RedComm = False;
  215.             RedHQ = False;
  216.             BlueComm = False;
  217.             BlueHQ = False;
  218.             RespawnMission;
  219.             ResetTimer(Pause_timer);
  220.             //ChatMessage("Respawn Done, one more in 5 sec.");
  221.             // ChatMessage("Respawn in 5");
  222.             ChatMessage("Game respawned.");
  223.             // trans RestartState;
  224.             trans Startstate
  225.         endif;
  226.  
  227. endstate;
  228.  
  229. state over;
  230.     code
  231.  
  232. endstate;
  233.  
  234. endfsm.
  235.