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

  1. fsm StockSiegeAssault : 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        Blue_Guard_team;
  19.         static integer        Red_Guard_team;
  20.         
  21.         static boolean      Winning;
  22.         static boolean      RedHQ;                  // This is whether the Red HQ building is alive
  23.         static boolean      RedComm;                // This is whether the Red Comm building is alive
  24.         
  25.         // Timers
  26.         static integer        game_timer;
  27.         static integer        pause_timer;
  28.         static integer      toggler;                // This makes it so there is a lengthier pause b/n some sounds
  29.  
  30. function PlayBigAlerts;
  31.     code
  32.         PlayTeamBettySound(1,SOUND_TRIGGER_MISSILE_LOCKED_ON_ME);
  33.         PlayTeamBettySound(2,SOUND_TRIGGER_MISSILE_LOCKED_ON_ME);
  34.         Return;
  35. endfunction;
  36.  
  37. function PlaySmallAlerts;
  38.     code
  39.         PlayTeamBettySound(1,SOUND_TRIGGER_NARC_SIGNAL_START);
  40.         PlayTeamBettySound(2,SOUND_TRIGGER_NARC_SIGNAL_START);
  41.         Return;
  42. endfunction;
  43.  
  44. function init;
  45.     code
  46.         SetupScoring_SiegeAssault;
  47.  
  48.         // Goal for Team 1 - Kill this
  49.         GroupAddObject(GroupObjectId(20),ebu_Red_HQ);
  50.         GroupAddObject(GroupObjectId(20),ebu_Red_Communications);
  51.         MarkBuildingAsScorable(ebu_Red_HQ);
  52.         MarkBuildingAsScorable(ebu_Red_Communications);
  53.         
  54.         Blue_Guard_team        = TeamObjectID(1);
  55.         Red_Guard_team        = TeamObjectID(2);
  56.  
  57.         Blue_score_add = 350;
  58.         Red_score_add = 350;
  59.         
  60.         LogDefendingTeam(team2);
  61.  
  62.         // Misc Setup
  63.         winning = false;
  64.         
  65.         // Timers
  66.         game_timer = gti_timer_1;
  67.         pause_timer = gti_timer_2;
  68.  
  69.  
  70. endfunction;
  71.  
  72. function BlueTeamScores;
  73.     code
  74.         AddPoints(Blue_Guard_team,Blue_score_add);
  75. endfunction;
  76.  
  77. function RedTeamScores;
  78.     code
  79.         AddPoints(Red_Guard_team,Red_score_add);
  80. endfunction;
  81.  
  82. state StartState;
  83.     code
  84.         
  85.         revealnavpoint(ena_Nav_Center);
  86.         revealnavpoint(ena_Blue_Drop_Zone);
  87.         revealnavpoint(ena_Red_Base);
  88.         TeamSetNav(1,ena_Red_Base);
  89.         TeamSetNav(2,ena_Nav_Center);
  90.         //ChatMessage("Game Starting.");
  91.  
  92.         //StartTimer(1);            // This is to make sure everyone is in
  93.         StartTimer(3);  // This is the defense point timer
  94.         ResetTimer(3);
  95.         StartTimer(4);  // This is the timer for the warning messages about buildings
  96.         ResetTimer(4);
  97.  
  98.         ResetTimer(Game_Timer);
  99.         trans GoState;
  100.         
  101. endstate;
  102.  
  103. state goState;
  104.     code
  105.         
  106.         if (timegreater(game_timer,90)) then
  107.             if (timegreater(3,30)) then
  108.                 AddPoints(Red_Guard_team,125);
  109.                 LogDefendTimeAward(team2,125);
  110.                 PlaySmallalerts;
  111.                 ResetTimer(3);
  112.             endif;
  113.         endif;
  114.  
  115.         if (GroupAllDead(GroupObjectID(20))) then
  116.             BlueTeamScores;
  117.             PlayBigAlerts;
  118.             ChatMessage("Red Base has been destroyed!");
  119.             // ChatMessage("Respawn 2x slowly in 5");
  120.             ChatMessage("Respawn in 5 seconds.");
  121.             ResetTimer(Pause_Timer);
  122.             trans deadstate;
  123.         endif;
  124.     
  125.         if (timegreater(4,5)) then
  126.             if (not RedComm) then
  127.                 if (isshot(GroupObjectID(20))) then
  128.                     if (toggler>3) then
  129.                         PlayTeamBettySound(2,SOUND_TRIGGER_ALARM1);
  130.                         ChatMessage("Red Base buildings are under attack.");
  131.                         toggler = 0;
  132.                     endif;
  133.                 endif;
  134.             endif;
  135.             
  136.             if (not RedHQ) then
  137.                 if (isdead(ebu_Red_HQ)) then
  138.                     BlueTeamScores;
  139.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  140.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  141.                     ChatMessage("Red HQ has been destroyed.");
  142.                     RedHQ = true;
  143.                 endif;
  144.             endif;
  145.             
  146.             if (not RedComm) then
  147.                 if (isdead(ebu_Red_Communications)) then
  148.                     BlueTeamScores;
  149.                     PlayTeamBettySound(1,SOUND_TRIGGER_ALARM2);
  150.                     PlayTeamBettySound(2,SOUND_TRIGGER_ALARM2);
  151.                     ChatMessage("Red Communications has been destroyed.");
  152.                     RedComm = true;
  153.                 endif;
  154.             endif;
  155.             
  156.             Toggler = Toggler + 1;
  157.             
  158.             resettimer(4);
  159.         endif;
  160.  
  161. endstate;
  162.  
  163. state deadState;
  164.     code
  165.  
  166.         if (timegreater (pause_timer,5)) then    
  167.             LogHQDestroyed(team2,team1);
  168.             LogMMapRespawn;
  169.             Winning = False;
  170.             RedComm = False;
  171.             RedHQ = False;
  172.             RespawnMission;
  173.             ResetTimer(Pause_timer);
  174.             //ChatMessage("Respawn Done, one more in 5 sec.");
  175.             // ChatMessage("Respawn in 5");
  176.             ChatMessage("Game respawned.");
  177.             // trans RestartState;
  178.             trans Startstate
  179.         endif;
  180.  
  181. endstate;
  182.  
  183. /* state RestartState;
  184.     code
  185.         
  186.         if (timegreater (pause_timer,5)) then    
  187.             ResetTimer(Game_Timer);
  188.             ResetTimer(Pause_Timer);
  189.             RespawnMission;
  190.             ChatMessage("2nd Respawn done.");
  191.             trans StartState;
  192.         endif;
  193.         
  194. endstate; */
  195.         
  196. endfsm.
  197.