home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 54 / ClassicFond54.iso / games / stars.rar / multiplayer / WAR_Martian_Standoff.cs < prev    next >
Text File  |  1999-02-22  |  20KB  |  706 lines

  1. // WAR, war, what is it good for? -- TSL
  2.  
  3. $missionName = "WAR_Martian_Standoff";
  4.  
  5. exec("multiplayerStdLib.cs");
  6.  
  7. ///////////////////////////////////////////////////////////////////////////////////////////////////
  8. // Lots O' Globals
  9. ///////////////////////////////////////////////////////////////////////////////////////////////////
  10. $redKills = 0;
  11. $yellowKills = 0;
  12.  
  13. $redBuildingsDestroyed = 0;
  14. $yellowBuildingsDestroyed = 0;
  15.  
  16. $yellowHerc1RespawnTime = 0;
  17. $yellowHerc2RespawnTime = 0;
  18. $yellowHerc3RespawnTime = 0;
  19. $redHerc1RespawnTime = 0;
  20. $redHerc2RespawnTime = 0;
  21. $redHerc3RespawnTime = 0;
  22.  
  23. $yellowHerc1Path = "MissionGroup/yellowHerc1Path";
  24. $yellowHerc2Path = "MissionGroup/yellowHerc2Path";
  25. $yellowHerc3Path = "MissionGroup/yellowHerc3Path";
  26. $redHerc1Path = "MissionGroup/redHerc1Path";
  27. $redHerc2Path = "MissionGroup/redHerc2Path";
  28. $redHerc3Path = "MissionGroup/redHerc3Path";
  29.  
  30. $yellowHqDestroyed = false;
  31. $redHqDestroyed = false;
  32.  
  33. ///////////////////////////////////////////////////////////////////////////////////////////////////
  34. // the Game Info tab uses these variables in the rules
  35. ///////////////////////////////////////////////////////////////////////////////////////////////////
  36. $respawnDelay = 60;
  37. $respawnDelayNoHq = 120;
  38. $BUILDINGS_TO_DESTROY = 6;
  39.  
  40. ///////////////////////////////////////////////////////////////////////////////////////////////////
  41. // our base defender attributes
  42. //
  43. // The jump from 0.9 to 1.0 is a big one. At skill 1.0 and accuracy 1.0 the AI units will aim 
  44. // first for the weapons, then the legs. A little too much for this mission.
  45. //
  46. ///////////////////////////////////////////////////////////////////////////////////////////////////
  47. Pilot YellowPilot
  48. {
  49.    id = 28;
  50.    
  51.    name = *IDMULT_WAR_YELLOW_DEFENDER;
  52.    
  53.    skill = 0.9;
  54.    accuracy = 0.9;
  55.    aggressiveness = 1.0;
  56.    activateDist = 850.0;
  57.    deactivateBuff = 300.0;
  58.    targetFreq = 2.0;
  59.    trackFreq = 0.0;
  60.    fireFreq = 0.2;
  61.    LOSFreq = 0.2;
  62.    orderFreq = 2.0;
  63. };
  64.  
  65. Pilot RedPilot
  66. {
  67.    id = 29;
  68.    
  69.    name = *IDMULT_WAR_RED_DEFENDER;
  70.    
  71.    skill = 0.9;
  72.    accuracy = 0.9;
  73.    aggressiveness = 1.0;
  74.    activateDist = 850.0;
  75.    deactivateBuff = 300.0;
  76.    targetFreq = 2.0;
  77.    trackFreq = 0.0;
  78.    fireFreq = 0.2;
  79.    LOSFreq = 0.2;
  80.    orderFreq = 2.0;
  81. };
  82.  
  83. function initGlobalVars()
  84. {
  85.    $scoringFreeze = false;
  86.    
  87.    %playerCount = playerManager::getPlayerCount();
  88.     // clear all points for the players
  89.    for (%p = 0; %p < %playerCount; %p++)
  90.     {
  91.         %player = playerManager::getPlayerNum(%p);
  92.       %player.numKills = 0;
  93.       %player.buildingsDestroyed = 0;
  94.    }
  95. }
  96.  
  97. function setDefaultMissionOptions()
  98. {
  99.     $server::TeamPlay = True;
  100.     $server::AllowDeathmatch = False;
  101.     $server::AllowTeamPlay = True;    
  102.     
  103.     $server::AllowTeamRed = true;
  104.     $server::AllowTeamBlue = false;
  105.     $server::AllowTeamYellow = true;
  106.     $server::AllowTeamPurple = false;
  107.  
  108.    $server::disableTeamRed = false;
  109.    $server::disableTeamBlue = true;
  110.    $server::disableTeamYellow = false;
  111.    $server::disableTeamPurple = true;
  112. }
  113.  
  114. function setDefaultMissionItems()
  115. {
  116.    allowComponent(                                        830, FALSE  );      //Chameleon
  117.    allowComponent(                                        831, FALSE  );      //Cuttlefish cloak
  118.    allowComponent(                                        840, FALSE  );      //Shield Modulator
  119.    allowComponent(                                        914, FALSE  );      //UAP
  120. }
  121.  
  122. function onMissionLoad()
  123. {
  124.    cdAudioCycle("Purge", "Watching", "Mechsoul"); 
  125.  
  126.    // get the original ID for each AI Herc ( for use later when we clone them )
  127.    $yellowHerc1 = getObjectId( "MissionGroup/yellowHercs/h1" );
  128.    $yellowHerc2 = getObjectId( "MissionGroup/yellowHercs/h2" );
  129.    $yellowHerc3 = getObjectId( "MissionGroup/yellowHercs/h3" );
  130.    
  131.    $redHerc1 = getObjectId( "MissionGroup/redHercs/h1" );
  132.    $redHerc2 = getObjectId( "MissionGroup/redHercs/h2" );
  133.    $redHerc3 = getObjectId( "MissionGroup/redHercs/h3" );
  134.  
  135.    %rules = "<tIDMULT_WAR_GAMETYPE>"      @        
  136.             "<tIDMULT_WAR_MAPNAME>"       @ 
  137.             $missionName                  @  
  138.             "<tIDMULT_WAR_OBJECTIVES_1>"  @
  139.             timeDifference($respawnDelay, 0)       @
  140.             "<tIDMULT_WAR_OBJECTIVES_2>"  @
  141.             timeDifference($respawnDelayNoHq, 0)   @
  142.             "<tIDMULT_WAR_OBJECTIVES_3>"  @
  143.             "<tIDMULT_WAR_OBJECTIVES_4>"  @
  144.             $BUILDINGS_TO_DESTROY         @
  145.             "<tIDMULT_WAR_OBJECTIVES_5>"  @
  146.             "<tIDMULT_WAR_SCORING_1>"     @
  147.             "<tIDMULT_WAR_SCORING_2>"     @
  148.             "<tIDMULT_STD_ITEMS>"         @
  149.             "<tIDMULT_WAR_HQ>"            @
  150.             "<tIDMULT_WAR_GENERATORS>"    @
  151.             "<tIDMULT_WAR_TURRETS>"       @
  152.             "<tIDMULT_WAR_FLAGS>"         @
  153.             "<tIDMULT_WAR_GLOW>"          @
  154.             "<tIDMULT_STD_HEAL>"          @
  155.             "<tIDMULT_STD_RELOAD_1>"      @
  156.             $PadWaitTime                  @
  157.             "<tIDMULT_STD_RELOAD_2>";
  158.    
  159.    setGameInfo(%rules);
  160. }
  161.  
  162.  
  163. //-------------------------------------------------------------
  164. function player::onAdd(%this)
  165. {
  166.    say(%this, 0, *IDMULT_WAR_WELCOME);
  167. }
  168.  
  169. function vehicle::onAdd(%this)
  170. {
  171.    // see if it is a player
  172.    %player = playerManager::vehicleIdToPlayerNum(%this);
  173.    if(%player == 0) 
  174.       return;
  175.  
  176.    schedule( "setEnemyNavPoint(" @ %this @ ");", 1 );
  177. }
  178.  
  179. function setEnemyNavPoint( %this )
  180. {
  181.    if( getTeam(%this) == *IDSTR_TEAM_YELLOW )
  182.    {
  183.       setNavMarker( "MissionGroup/RedBase/n1", true, %this );
  184.    }
  185.    else
  186.    {
  187.       setNavMarker( "MissionGroup/YellowBase/n1", true, %this );
  188.    }
  189. }
  190.  
  191.  
  192. function vehicle::onDestroyed( %this, %destroyer )
  193. {
  194.    if( getTeam( %this ) == *IDSTR_TEAM_RED )
  195.    {
  196.       $yellowKills++;
  197.    }
  198.    else
  199.    {
  200.       $redKills++;
  201.    }
  202.  
  203.    // award the player a kill ( if the enemy is a different color )
  204.    if( getTeam( %destroyer ) != getTeam( %this ) )
  205.    {
  206.       %player = playerManager::vehicleIdToPlayerNum( %destroyer );
  207.       if(%player != 0)
  208.       {
  209.          %player.numKills++;      
  210.       }
  211.    }
  212.    
  213.    //----------------------------------------------------------------
  214.    // If any of our AI hercs die, give a message and re-clone/drop them
  215.    //----------------------------------------------------------------
  216.    if( %this == $yellowHerc1 )
  217.    {
  218.       $yellowHercsDestroyed++;
  219.       
  220.       if( $yellowHqDestroyed == false )
  221.       {
  222.          schedule( "trevorsCloneVehicle(\"$yellowHerc1\", " @ %this @ ", -320, -385, 1312);", $respawnDelay);
  223.       }
  224.       else
  225.       {
  226.          schedule( "trevorsCloneVehicle(\"$yellowHerc1\", " @ %this @ ", -320, -385, 1312);", $respawnDelayNoHq);
  227.       }
  228.    }
  229.    if( %this == $yellowHerc2 )
  230.    {
  231.       $yellowHercsDestroyed++;
  232.  
  233.       if( $yellowHqDestroyed == false )
  234.       {
  235.          schedule( "trevorsCloneVehicle(\"$yellowHerc2\", " @ %this @ ", -120, -15, 1328);", $respawnDelay);
  236.       }
  237.       else
  238.       {
  239.          schedule( "trevorsCloneVehicle(\"$yellowHerc2\", " @ %this @ ", -120, -15, 1328);", $respawnDelayNoHq);
  240.       }
  241.    }
  242.    if( %this == $yellowHerc3 )
  243.    {
  244.       $yellowHercsDestroyed++;
  245.       
  246.       if( $yellowHqDestroyed == false )
  247.       {
  248.          schedule( "trevorsCloneVehicle(\"$yellowHerc3\", " @ %this @ ", -63, -612, 1312);", $respawnDelay);
  249.       }
  250.       else
  251.       {
  252.          schedule( "trevorsCloneVehicle(\"$yellowHerc3\", " @ %this @ ", -63, -612, 1312);", $respawnDelayNoHq);
  253.       }
  254.    }
  255.  
  256.    if( %this == $redHerc1 )
  257.    {
  258.       $redHercsDestroyed++;
  259.       
  260.       if( $redHqDestroyed == false )
  261.       {
  262.          schedule( "trevorsCloneVehicle(\"$redHerc1\", " @ %this @ ", -2318, -38, 1478);", $respawnDelay);
  263.       }
  264.       else
  265.       {
  266.          schedule( "trevorsCloneVehicle(\"$redHerc1\", " @ %this @ ", -2318, -38, 1478);", $respawnDelayNoHq);
  267.       }
  268.    }
  269.    if( %this == $redHerc2 )
  270.    {
  271.       $redHercsDestroyed++;
  272.       
  273.       if( $redHqDestroyed == false )
  274.       {
  275.          schedule( "trevorsCloneVehicle(\"$redHerc2\