home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 January / GSSH0104TT.iso / Levels / Riseofnations / mp_scenarios.exe / Custom / capture / capture.bhs next >
Encoding:
Text File  |  2003-10-15  |  28.0 KB  |  857 lines

  1. scenario
  2. {
  3.  
  4.   static int temp_capture;
  5.   static int old_scholar_size = 1;
  6.  
  7.  
  8.   //player one military buildings
  9.   static int one_rax_1 = find_build(1, "Barracks");
  10.   static int one_rax_2 = find_build(1, "Barracks");
  11.   static int one_rax_3 = find_build(1, "Barracks");
  12.   static int one_stable_1 = find_build(1, "Stable");
  13.   static int one_stable_2 = find_build(1, "Stable");
  14.   static int one_stable_3 = find_build(1, "Stable");
  15.  
  16.   //player two military buildings
  17.   static int two_rax_1 = find_build(2, "Barracks");
  18.   static int two_rax_2 = find_build(2, "Barracks");
  19.   static int two_rax_3 = find_build(2, "Barracks");
  20.   static int two_stable_1 = find_build(2, "Stable");
  21.   static int two_stable_2 = find_build(2, "Stable");
  22.   static int two_stable_3 = find_build(2, "Stable");
  23.  
  24.   //player three military buildings
  25.   static int three_rax_1 = find_build(3, "Barracks");
  26.   static int three_rax_2 = find_build(3, "Barracks");
  27.   static int three_rax_3 = find_build(3, "Barracks");
  28.   static int three_stable_1 = find_build(3, "Stable");
  29.   static int three_stable_2 = find_build(3, "Stable");
  30.   static int three_stable_3 = find_build(3, "Stable");
  31.  
  32.   //player four military buildings
  33.   static int four_rax_1 = find_build(4, "Barracks");
  34.   static int four_rax_2 = find_build(4, "Barracks");
  35.   static int four_rax_3 = find_build(4, "Barracks");
  36.   static int four_stable_1 = find_build(4, "Stable");
  37.   static int four_stable_2 = find_build(4, "Stable");
  38.   static int four_stable_3 = find_build(4, "Stable");
  39.  
  40.   static int high_kill1;
  41.   static int high_kill2;
  42.   static int high_kill3;
  43.   static int high_kill4;
  44.   static int low_kill1;
  45.   static int low_kill2;
  46.   static int low_kill3;
  47.   static int low_kill4;
  48.   static int high_kill1_time;
  49.   static int high_kill2_time;
  50.   static int high_kill3_time;
  51.   static int high_kill4_time;
  52.   static int low_kill1_time;
  53.   static int low_kill2_time;
  54.   static int low_kill3_time;
  55.   static int low_kill4_time;
  56.  
  57.   static int who_is_it = find_unit(8, "scholar");
  58.   static int who = 8;
  59.   static origin_size = get_unit_scale(who, who_is_it);
  60.   static int fort_id = find_build(8, "Fort");
  61.  
  62.   int high_num;
  63.   static int high_nation = 8;
  64.   int temp_num;
  65.  
  66.   static int x;
  67.   static int y;
  68.   int nation;
  69.   int age_up;
  70.   static int upgrade_level1 = 10; 
  71.   static int upgrade_level2 = 10; 
  72.   static int upgrade_level3 = 10; 
  73.   static int upgrade_level4 = 10; 
  74.   int nation_age;
  75.   int building;
  76.  
  77.   static int scholar_step = 2;
  78.  
  79.   static int revealed;
  80.  
  81.   static factor = 1.5;
  82.  
  83.   static int capture1;
  84.   static int capture2;
  85.   static int capture3;
  86.   static int capture4;
  87.  
  88.   static int step1 = 1;
  89.   int new_step1;
  90.  
  91.   static int step2 = 1;
  92.   int new_step2;
  93.  
  94.   static int step3 = 1;
  95.   int new_step3;
  96.  
  97.   static int step4 = 1;
  98.   int new_step4;
  99.  
  100.   int train_amount;
  101.  
  102.   static int scholar_penalty = 5;
  103.  
  104.   String text_cap1;
  105.   String text_cap2;
  106.   String text_cap3;
  107.   String text_cap4;
  108.  
  109.   static int old_size = 1;
  110.   int cur_size;
  111.  
  112.   static int high_killer;
  113.   static int low_killer;
  114.   static int high_kills;
  115.   static int low_kills;
  116.   int kills;
  117.   int kill_difference;
  118.  
  119.   static int top = 92;
  120.   static int bottom = 141;
  121.   static int left = 96;
  122.   static int right = 149;
  123.  
  124.   static int game_over = get_time_limit();
  125.   static int cur_time;
  126.  
  127.   int high_capture;
  128.   int who_capture;
  129.   
  130.   static int num_players;
  131.  
  132.   run_once {
  133.     set_victory_message($S("You have captured the scholar!"));
  134.     set_defeat_message($S("You never made it home."));
  135.     //INIT SOME STUFF
  136.     //for (n = 2; n < 8; n++) {
  137.       //if (get_leader_name(n) == "Computer") {
  138.         //defeat(n);
  139.       //}
  140.     //}
  141.     //for (nation = 1; nation < 8; nation++) {
  142.       //if (is_defeated(nation)) break;
  143.      // else num_players++;
  144.    // }//num players
  145.     num_players = 4;
  146.     //set_time_limit(10);//set time limit
  147.     unit_costs_disable();//disable unit costs
  148.     set_object_type_max_health("scholar", 1000);//set scholar health
  149.     
  150.     //make everyone friendly like
  151.     for (nation = num_players; nation > 0; nation--) {
  152.       //for (tribe = num_players; tribe > 1; tribe--) {
  153.        // if (tribe == nation) {
  154.           //tribe++;
  155.        // }
  156.        // if (tribe >= num_players) break;
  157.         //if (!have_peace(nation, tribe)) make_peace(nation, tribe);
  158.       //}
  159.       disable_city_defeat(nation);
  160.       //gain_tech(nation, "The Art of War");
  161.       //gain_tech(nation, "Mercenaries");
  162.       //gain_tech(nation, "Standing Army");
  163.       //set_population_cap(nation, 100);            
  164.     }
  165.     disable_city_defeat(8);
  166.  
  167.     //set scholar scale (starts as usual)
  168.     set_unit_scale(who, who_is_it, 4);
  169.  
  170.     //set text box values
  171.     text_cap1 = real_time(capture1);
  172.     text_cap2 = real_time(capture2);
  173.     text_cap3 = real_time(capture3);
  174.     text_cap4 = real_time(capture4);
  175.  
  176.     add_objective_text($S("Win by holding the scholar for 3 minutes."), 13, "");
  177.     add_objective_text("", 10, "");
  178.     add_objective_text(parse("Red time held " + text_cap1), 1, "");
  179.     if (num_players >= 2) add_objective_text(parse("Blue time held " + text_cap2), 2, "");
  180.     if (num_players >= 3) add_objective_text(parse("Purple time held " + text_cap3), 3, "");
  181.     if (num_players >= 4) add_objective_text(parse("Green time held " + text_cap4), 4, "");   
  182.     add_objective_text(" ", 11, "");
  183.     add_objective_text(" ", 12, ""); 
  184.  
  185.     //queue up units
  186.     train_amount = 1;
  187.  
  188.     train_unit_at(1, train_amount, "hoplites", one_rax_1);
  189.     train_unit_at(1, train_amount, "bowmen", one_rax_2);
  190.     train_unit_at(1, train_amount, "slingers", one_rax_3);
  191.     train_unit_at(2, train_amount, "hoplites", two_rax_1);
  192.     train_unit_at(2, train_amount, "bowmen", two_rax_2);
  193.     train_unit_at(2, train_amount, "slingers", two_rax_3);
  194.     train_unit_at(3, train_amount, "hoplites", three_rax_1);
  195.     train_unit_at(3, train_amount, "bowmen", three_rax_2);
  196.     train_unit_at(3, train_amount, "slingers", three_rax_3);
  197.     train_unit_at(4, train_amount, "hoplites", four_rax_1);
  198.     train_unit_at(4, train_amount, "bowmen", four_rax_2);
  199.     train_unit_at(4, train_amount, "slingers", four_rax_3);
  200.  
  201.     train_unit_at(1, train_amount, "light horse", one_stable_1);
  202.     train_unit_at(1, train_amount, "cataphract", one_stable_2);
  203.     train_unit_at(1, train_amount, "horse archer", one_stable_3);
  204.     train_unit_at(2, train_amount, "light horse", two_stable_1);
  205.     train_unit_at(2, train_amount, "cataphract", two_stable_2);
  206.     train_unit_at(2, train_amount, "horse archer", two_stable_3);
  207.     train_unit_at(3, train_amount, "light horse", three_stable_1);
  208.     train_unit_at(3, train_amount, "cataphract", three_stable_2);
  209.     train_unit_at(3, train_amount, "horse archer", three_stable_3);
  210.     train_unit_at(4, train_amount, "light horse", four_stable_1);
  211.     train_unit_at(4, train_amount, "cataphract", four_stable_2);
  212.     train_unit_at(4, train_amount, "horse archer", four_stable_3);
  213.  
  214.     for (nation = num_players; nation > 0; nation--) {
  215.       for (n = 6; n > 0; n--) {
  216.         building = find_military_build(nation);
  217.         toggle_infinite_queue(nation, building, 1);
  218.       }
  219.     }
  220.  
  221.     //set build time factors
  222.     factor = .7;
  223.  
  224.     time = type_build_time("Slingers") * factor;
  225.     set_type_build_time("Slingers", time);
  226.     time = type_build_time("Javelineers") * factor;
  227.     set_type_build_time("Javelineers", time);
  228.     time = type_build_time("Elite Javelineers") * factor;
  229.     set_type_build_time("Elite Javelineers", time);
  230.     time = type_build_time("Fire Lances") * factor;
  231.     set_type_build_time("Fire Lances", time);
  232.     time = type_build_time("Arquebusiers") * factor;
  233.     set_type_build_time("Arquebusiers", time);
  234.     time = type_build_time("Heavy Fire Lances") * factor;
  235.     set_type_build_time("Heavy Fire Lances", time);
  236.     time = type_build_time("Musketeers") * factor;
  237.     set_type_build_time("Musketeers", time);
  238.     time = type_build_time("Manchu Musketeers") * factor;
  239.     set_type_build_time("Manchu Musketeers", time);
  240.     time = type_build_time("Riflemen") * factor;
  241.     set_type_build_time("Riflemen", time);
  242.     time = type_build_time("Manchu Riflemen") * factor;
  243.     set_type_build_time("Manchu Riflemen", time);
  244.     time = type_build_time("Infantry") * factor;
  245.     set_type_build_time("Infantry", time);
  246.     time = type_build_time("Jaguar Infantry") * factor;
  247.     set_type_build_time("Jaguar Infantry", time);
  248.     time = type_build_time("Manchu Infantry") * factor;
  249.     set_type_build_time("Manchu Infantry", time);
  250.     time = type_build_time("Volksgrenadiers") * factor;
  251.     set_type_build_time("Volksgrenadiers", time);
  252.     time = type_build_time("Red Guards Infantry") * factor;
  253.     set_type_build_time("Red Guards Infantry", time);
  254.     time = type_build_time("Assault Infantry") * factor;
  255.     set_type_build_time("Assault Infantry", time);
  256.     time = type_build_time("Jaguar Assault Infantry") * factor;
  257.     set_type_build_time("Jaguar Assault Infantry", time);
  258.     time = type_build_time("Shock Infantry") * factor;
  259.     set_type_build_time("Shock Infantry", time);
  260.  
  261.     time = type_build_time("Hoplites") * factor;
  262.     set_type_build_time("Hoplites", time);
  263.     time = type_build_time("Solduri") * factor;
  264.     set_type_build_time("Solduri", time);
  265.     time = type_build_time("Phalanx") * factor;
  266.     set_type_build_time("Phalanx", time);
  267.     time = type_build_time("Barbarians") * factor;
  268.     set_type_build_time("Barbarians", time);
  269.     time = type_build_time("Pikemen") * factor;
  270.     set_type_build_time("Pikemen", time);
  271.     time = type_build_time("Elite Bushi") * factor;
  272.     set_type_build_time("Elite Bushi", time);
  273.     time = type_build_time("Vandals") * factor;
  274.     set_type_build_time("Vandals", time);
  275.     time = type_build_time("Elite Pikemen") * factor;
  276.     set_type_build_time("Elite Pikemen", time);
  277.     time = type_build_time("Samurai") * factor;
  278.     set_type_build_time("Samurai", time);
  279.     time = type_build_time("Landsknechts") * factor;
  280.     set_type_build_time("Landsknechts", time);
  281.     time = type_build_time("Fusiliers") * factor;
  282.     set_type_build_time("Fusiliers", time);
  283.     time = type_build_time("Gun Samurai") * factor;
  284.     set_type_build_time("Gun Samurai", time);
  285.     time = type_build_time("Anti-Tank Rifle") * factor;
  286.     set_type_build_time("Anti-Tank Rifle", time); 
  287.     time = type_build_time("Bazooka") * factor;
  288.     set_type_build_time("Bazooka", time);
  289.     time = type_build_time("Anti-Tank Missile") * factor;
  290.     set_type_build_time("Anti-Tank Missile", time);
  291.  
  292.     time = type_build_time("Bowmen") * factor;
  293.     set_type_build_time("Bowmen", time);
  294.     time = type_build_time("Archers") * factor;
  295.     set_type_build_time("Archers", time); 
  296.     time = type_build_time("Crossbowmen") * factor;
  297.     set_type_build_time("Crossbowmen", time);
  298.  
  299.     time = type_build_time("Machine Gun") * factor;
  300.     set_type_build_time("Machine Gun", time);
  301.     time = type_build_time("Heavy Machine Gun") * factor;
  302.     set_type_build_time("Heavy Machine Gun", time);
  303.     time = type_build_time("MG42") * factor;
  304.     set_type_build_time("MG42", time);
  305.     time = type_build_time("Advanced Machine Gun") * factor;
  306.     set_type_build_time("Advanced Machine Gun", time);
  307.  
  308.     time = type_build_time("Flamethrower") * factor;
  309.     set_type_build_time("Flamethrower", time);
  310.  
  311.     time = type_build_time("Scout") * factor;
  312.     set_type_build_time("Scout", time);
  313.     time = type_build_time("Explorer") * factor;
  314.     set_type_build_time("Explorer", time);
  315.     time = type_build_time("Commando") * factor;
  316.     set_type_build_time("Commando", time);
  317.     time = type_build_time("Special Forces") * factor;
  318.     set_type_build_time("Special Forces", time);
  319.     time = type_build_time("Elite Special Forces") * factor;
  320.     set_type_build_time("Elite Special Forces", time);
  321.  
  322.     time = type_build_time("Light Horse") * factor;
  323.     set_type_build_time("Light Horse", time); 
  324.     time = type_build_time("Light Cavalry") * factor;
  325.     set_type_build_time("Light Cavalry", time);
  326.     time = type_build_time("Rusiny Lancer") * factor;
  327.     set_type_build_time("Rusiny Lancer", time);
  328.     time = type_build_time("Elite Light Cavalry") * factor;
  329.     set_type_build_time("Elite Light Cavalry", time);
  330.     time = type_build_time("Cossack") * factor;
  331.     set_type_build_time("Cossack", time);
  332.     time = type_build_time("Hussar") * factor;
  333.     set_type_build_time("Hussar", time);
  334.     time = type_build_time("Don Cossack") * factor;
  335.     set_type_build_time("Don Cossack", time);
  336.     time = type_build_time("Armored Car") * factor;
  337.     set_type_build_time("Armored Car", time);
  338.     time = type_build_time("Armored Scout Car") * factor;
  339.     set_type_build_time("Armored Scout Car", time);
  340.     time = type_build_time("Armored Cavalry") * factor;
  341.     set_type_build_time("Armored Cavalry", time);
  342.  
  343.     time = type_build_time("Cataphract") * factor;
  344.     set_type_build_time("Cataphract", time);
  345.     time = type_build_time("Knight") * factor;
  346.     set_type_build_time("Knight", time);
  347.     time = type_build_time("Heavy Knight") * factor;
  348.     set_type_build_time("Heavy Knight", time);
  349.     time = type_build_time("Cuirassier") * factor;
  350.     set_type_build_time("Cuirassier", time);
  351.     time = type_build_time("Light Tank") * factor;
  352.     set_type_build_time("Light Tank", time);
  353.     time = type_build_time("Tank") * factor;
  354.     set_type_build_time("Tank", time);
  355.     time = type_build_time("Leopard Tank") * factor;
  356.     set_type_build_time("Leopard Tank", time);
  357.     time = type_build_time("Main Battle Tank") * factor;
  358.     set_type_build_time("Main Battle Tank", time);
  359.     time = type_build_time("Tiger Tank") * factor;
  360.     set_type_build_time("Tiger Tank", time);
  361.     time = type_build_time("T80 Tank") * factor;
  362.     set_type_build_time("T80 Tank", time);
  363.  
  364.     time = type_build_time("Horse Archer") * factor;
  365.     set_type_build_time("Horse Archer", time);
  366.     time = type_build_time("Heavy Horse Archer") * factor;
  367.     set_type_build_time("Heavy Horse Archer", time);
  368.     time = type_build_time("Dragoon") * factor;
  369.     set_type_build_time("Dragoon", time);
  370.     time = type_build_time("Carbineer") * factor;
  371.     set_type_build_time("Carbineer", time);
  372.  
  373.     //set timers
  374.     set_timer("hold_scholar", 1);
  375.     set_timer("kill_adjuster", 30);
  376.     set_timer("scholar_move_order", rand_int(3, 15));
  377.     
  378.   }
  379.   
  380.   //find if game is over and award victor
  381.   cur_time = time_min();
  382.  
  383.   if (capture1 >= 180) {
  384.     high_capture = capture1;
  385.     who_capture = 1;
  386.     victory(1);
  387.   } 
  388.   else if (capture2 >= 180) {
  389.     high_capture = capture2;
  390.     who_capture = 2;
  391.     victory(2);
  392.   }
  393.   else if (capture3 >= 180) {
  394.     high_capture = capture3;
  395.     who_capture = 3;
  396.     victory(3);
  397.   }
  398.   else if (capture4 >= 180) {
  399.     high_capture = capture4;
  400.     who_capture = 4;
  401.     victory(4);
  402.   }
  403.       
  404.   if (timer_expired("hold_scholar")) {
  405.  
  406.    if (territory_object(who, who_is_it) != 8) {
  407.       if (who == 1) {
  408.         capture1 = capture1 - 1;
  409.       }
  410.  
  411.       if (who == 2) {
  412.         capture2 = capture2 - 1;
  413.       }
  414.  
  415.       if (who == 3) {
  416.         capture3 = capture3 - 1;
  417.       }
  418.  
  419.       if (who == 4) {
  420.         capture4 = capture4 - 1;
  421.       }
  422.     } else {
  423.       if (who == 1) {
  424.         capture1 = capture1 + 1;
  425.       }
  426.  
  427.       if (who == 2) {
  428.         capture2 = capture2 + 1;
  429.       }
  430.  
  431.       if (who == 3) {
  432.         capture3 = capture3 + 1;
  433.       }
  434.  
  435.       if (who == 4) {
  436.         capture4 = capture4 + 1;
  437.       }
  438.     }
  439.     
  440.     set_timer("hold_scholar", 1);
  441.   
  442.   }
  443.  
  444.   //UPDATE SCORE LIST
  445.   if (who == 1) {
  446.     text_cap1 = real_time(capture1);
  447.     change_objective_text(1, parse("Red time held " + text_cap1));
  448.   } else if (who == 2) {
  449.     text_cap2 = real_time(capture2);
  450.     change_objective_text(2, parse("Blue time held " + text_cap2));
  451.   } else if (who == 3) {
  452.     text_cap3 = real_time(capture3);
  453.     change_objective_text(3, parse("Purple time held " + text_cap3));
  454.   } else if (who == 4) {
  455.     text_cap4 = real_time(capture4);
  456.     change_objective_text(4, parse("Green time held " + text_cap4));   
  457.   } 
  458.   
  459.   for (nation = num_players; nation > 0; nation--) {
  460.     for (n = num_military_buildings(nation); n > 0; n--) {
  461.       building = find_military_build(nation);
  462.       set_object_health(nation, building, 100);
  463.     }
  464.   }
  465.   
  466.   set_object_health(8, fort_id, 100);
  467.  
  468.   for (nation = num_players; nation > 0; nation--) {
  469.  
  470.     temp_num = any_object_near(nation, 1, x, y, 2) - num_type(nation, "Scholar");
  471.  
  472.     if (temp_num > high_num) {
  473.       high_num = temp_num;
  474.       high_nation = nation;
  475.     }
  476.   
  477.   }
  478.  
  479.   if (high_nation != who) {
  480.     /*if (who == 1) upgrade_level1 = upgrade_level1 - scholar_penalty;
  481.     else if (who == 2) upgrade_level2 = upgrade_level2 - scholar_penalty;
  482.     else if (who == 3) upgrade_level3 = upgrade_level3 - scholar_penalty;
  483.     else if (who == 4) upgrade_level4 = upgrade_level4 - scholar_penalty;*/
  484.     for (nation = num_players; nation > 0; nation--) {
  485.       if (nation == who) nation--;
  486.       if (nation == 0) break;
  487.       if (who != 8) make_peace(who, nation);
  488.     }
  489.     who_is_it = switch_teams(high_nation, who, who_is_it);
  490.     set_unit_scale(high_nation, who_is_it, 4);
  491.     who = high_nation;
  492.     x = object_position_x(who, who_is_it);
  493.     y = object_position_y(who, who_is_it);
  494.     ping_object_all(8, who, who_is_it);
  495.     temp_capture = 0;
  496.  
  497.     if (who == 1) {
  498.       change_objective_text(12, $S("Red has control of the Scholar"));
  499.       print_msg($S("Red has captured the Scholar!"));
  500.       //upgrade_level1 = upgrade_level1 + scholar_penalty;     
  501.     } else if (who == 2) {
  502.       change_objective_text(12, $S("Blue has control of the Scholar"));
  503.       print_msg($S("Blue has captured the Scholar!"));
  504.       //upgrade_level2 = upgrade_level1 + scholar_penalty;
  505.     } else if (who == 3) {
  506.       change_objective_text(12, $S("Purple has control of the Scholar"));
  507.       print_msg($S("Purple has captured the Scholar!"));
  508.       //upgrade_level3 = upgrade_level1 + scholar_penalty;
  509.     } else if (who == 4) {
  510.       change_objective_text(12, $S("Green has control of the Scholar"));
  511.       print_msg($S("Green has captured the Scholar!"));
  512.       //upgrade_level4 = upgrade_level1 + scholar_penalty;
  513.     }
  514.     for (nation = num_players; nation > 0; nation--) {
  515.       if (nation == who) nation--;
  516.       if (nation == 0) break;
  517.       declare_war(who, nation);
  518.     }
  519.   }
  520.  
  521.   if (timer_expired("scholar_move_order")) {
  522.     if (is_idle(who, who_is_it)) {
  523.       //x = rand_int(top, bottom);
  524.       //y = rand_int(right, left);
  525.       //set_timer("too_long", 1);
  526.       //while(!map_is_passable(x, y) || !timer_expired("too_long")) {
  527.       //  x = rand_int(top, bottom);
  528.       //  y = rand_int(right, left);
  529.       //}
  530.       center = get_map_size()/2;
  531.       unit_move_order(who, who_is_it, center, center);
  532.     }
  533.     
  534.     set_timer("scholar_move_order", rand_int(3, 10));
  535.  
  536.   }
  537.   
  538.   x = object_position_x(who, who_is_it);
  539.   y = object_position_y(who, who_is_it);
  540.   
  541.   set_object_health(who, who_is_it, 100);
  542.  
  543.   for (nation = num_players; nation > 0; nation--) {
  544.     clear_reveal_points(nation);
  545.     add_reveal_point(nation, x, y, 15);
  546.     revealed++;
  547.   }
  548.  
  549.   if (num_units_killed(1) >= upgrade_level1) {
  550.     if (age_comparison(1) == 0) {
  551.       new_step1 = upgrade_units(1, step1);
  552.       step1 = new_step1;
  553.       upgrade_level1 = upgrade_level1 + (6 * age(1)) + (step1);
  554.     } else {
  555.       upgrade_level1 = num_units_killed(1) + (6 * age(1)) + step1;
  556.     }
  557.   }
  558.  
  559.   if (num_units_killed(2) >= upgrade_level2) {
  560.     if (age_comparison(2) == 0) {
  561.       new_step2 = upgrade_units(2, step2);
  562.       step2 = new_step2;
  563.       upgrade_level2 = upgrade_level2 + (6 * age(2)) + (step2);
  564.     } else {
  565.       upgrade_level2 = num_units_killed(2) + (6 * age(2)) + step2;
  566.     }
  567.   }
  568.  
  569.   if (num_units_killed(3) >= upgrade_level3) {
  570.     if (age_comparison(3) == 0) {
  571.       new_step3 = upgrade_units(3, step3);
  572.       step3 = new_step3;
  573.       upgrade_level3 = upgrade_level3 + (6 * age(3)) + step3;
  574.     } else {
  575.       upgrade_level3 = num_units_killed(3) + (6 * age(3)) + step3;
  576.     }
  577.   }
  578.  
  579.   if (num_units_killed(4) >= upgrade_level4) {
  580.     if (age_comparison(4) == 0) {
  581.       new_step4 = upgrade_units(4, step4);
  582.       step4 = new_step4;
  583.       upgrade_level4 = upgrade_level4 + (6 * age(4)) + (step4);
  584.     } else {
  585.       upgrade_level4 = num_units_killed(4) + (6 * age(4)) + step4;
  586.     }
  587.   }
  588.  
  589.   x = object_position_x(who, who_is_it);
  590.   y = object_position_y(who, who_is_it);
  591.   
  592.   //for (nation = num_players; nation > 0; nation--) {
  593.     //for (n = num_units(nation); n > 0; n--) {
  594.       //unit = find_unit(nation, "");
  595.      // if (is_idle(nation, unit)) {
  596.         //it_attack_to_order(nation, unit, x, y);
  597.      
  598.    // }
  599.   //}
  600.  
  601.  
  602. }
  603.  
  604. int scenario age_comparison( int who ) {
  605.  
  606.   int nation;
  607.   int too_high;
  608.   int num_players;
  609.  
  610.   for (n = 1; n < 8; n++) {
  611.     if (is_defeated(n)) break;
  612.     else num_players++;
  613.   }//num players
  614.  
  615.   who_age = age(who);
  616.   
  617.   for (nation = num_players; nation > 0; nation--) {
  618.     if (nation == who) nation--;
  619.     if (nation == 0) break;
  620.     //if (nation == 5) break;
  621.     nation_age = age(nation);
  622.     if (who_age - nation_age > 1) too_high = 1;
  623.     else too_high = 0;
  624.   }
  625.  
  626.   return too_high;
  627.  
  628. }
  629.  
  630. int scenario gain_next_level(int who, int level) {
  631.  
  632.   if (level == 0) {
  633.     gain_tech(who, "The Art of War");
  634.     gain_tech(who, "City State");
  635.     gain_tech(who, "Barter");
  636.     gain_tech(who, "Written Word");
  637.     gain_tech(who, "Classical Age");
  638.   } else if (level == 1) {
  639.     gain_tech(who, "Mercenaries");
  640.     gain_tech(who, "Empire");
  641.     gain_tech(who, "Coinage");
  642.     gain_tech(who, "Mathematics");
  643.     gain_tech(who, "Medieval Age");
  644.   } else if (level == 2) {
  645.     gain_tech(who, "Standing Army");
  646.     gain_tech(who, "Feudalism");
  647.     gain_tech(who, "Trade");
  648.     gain_tech(who, "Chemistry");
  649.     gain_tech(who, "Gunpowder Age");
  650.   } else if (level == 3) {
  651.     gain_tech(who, "Conscription");
  652.     gain_tech(who, "Divine Right");
  653.     gain_tech(who, "Mercantilism");
  654.     gain_tech(who, "Laws of Nature");
  655.     gain_tech(who, "Enlightenment Age");
  656.   } else if (level == 4) {
  657.     gain_tech(who, "Levee en Masse");
  658.     gain_tech(who, "Constitution");
  659.     gain_tech(who, "Finance");
  660.     gain_tech(who, "Electricity");
  661.     gain_tech(who, "Industrial Age");
  662.   } else if (level == 5) {
  663.     gain_tech(who, "Nation-in-Arms");
  664.     gain_tech(who, "Great Power");
  665.     gain_tech(who, "Assembly Line");
  666.     gain_tech(who, "Electronics");
  667.     gain_tech(who, "Modern Age");
  668.   } else if (level == 6) {
  669.     gain_tech(who, "Selective Service");
  670.     gain_tech(who, "International Law");
  671.     gain_tech(who, "Globalization");
  672.     gain_tech(who, "Computerization");
  673.     gain_tech(who, "Information Age");
  674.   }
  675.  
  676.   return age(who);
  677.  
  678. }
  679.  
  680.  
  681. String scenario upgrade_units ( int who, int step ) 
  682. {
  683.  
  684.   String nation = find_nation(who);
  685.   int nation_age = age(who);
  686.  
  687.   switch(step) {
  688.     case 1:
  689.       gain_next_level(who, nation_age);
  690.       if (nation == "Chinese") gain_upgrade(who, "Fire Lances");
  691.       else if (nation == "Aztecs") gain_upgrade(who, "Xopilli Atl-Atls");
  692.       else gain_upgrade(who, "Elite Javelineers");
  693.       break;
  694.     case 2:
  695.       if (nation == "Germans") gain_upgrade(who, "Vandals");
  696.       else if (nation == "Japanese") gain_upgrade(who, "Elite Bushi");
  697.       else gain_upgrade(who, "Pikemen");
  698.       break;
  699.     case 3:
  700.       if (nation == "British") gain_upgrade(who, "King's Longbowmen");
  701.       else gain_upgrade(who, "Crossbowmen");
  702.       break;
  703.     case 4:
  704.       if (nation == "Egyptians") gain_upgrade(who, "Camel Warrior");
  705.       else if (nation == "Russians") gain_upgrade(who, "Rusiny Lancer");
  706.       else gain_upgrade(who, "Light Cavalry");
  707.       break;
  708.     case 5:
  709.       gain_upgrade(who, "Knight");
  710.       break;
  711.     case 6:
  712.       if (nation == "Egyptians") gain_upgrade(who, "Heavy Chariot");
  713.       else gain_upgrade(who, "Heavy Horse Archer");
  714.       break;
  715.     case 7:
  716.       gain_next_level(who, nation_age);
  717.       if (nation == "Chinese") gain_upgrade(who, "Heavy Fire Lances");     
  718.       else gain_upgrade(who, "Arquebusiers");
  719.       if (nation == "British") gain_upgrade(who, "King's Yeomanry");
  720.       break;
  721.     case 8:
  722.       if (nation == "Germans") gain_upgrade(who, "Landsknechts");
  723.       else if (nation == "Japanese") gain_upgrade(who, "Samurai");
  724.       else gain_upgrade(who, "Elite Pikemen");
  725.       break;
  726.     case 9:
  727.       if (nation == "Egyptians") gain_upgrade(who, "Elite Camel Warrior");
  728.       else if (nation == "Russians") gain_upgrade(who, "Cossack");
  729.       else gain_upgrade(who, "Elite Light Cavalry");
  730.       break;
  731.     case 10:
  732.       gain_upgrade(who, "Heavy Knight");
  733.       break;
  734.     case 11:
  735.       if (nation == "Egyptians") gain_upgrade(who, "Mameluke");
  736.       else gain_upgrade(who, "Dragoon");
  737.       break;
  738.     case 12:
  739.       gain_next_level(who, nation_age);
  740.       if (nation == "Chinese") gain_upgrade(who, "Manchu Musketeers");
  741.       else if (nation == "British") gain_upgrade(who, "Highlanders");
  742.       else gain_upgrade(who, "Musketeers");
  743.       break;
  744.     case 13:
  745.       if (nation == "Japanese") gain_upgrade(who, "Gun Samurai");
  746.       else gain_upgrade(who, "Fusiliers");
  747.       break;
  748.     case 14:
  749.       if (nation == "Russians") gain_upgrade(who, "Don Cossack");
  750.       else gain_upgrade(who, "Hussar");
  751.       break;
  752.     case 15:
  753.       gain_upgrade(who, "Cuirassier");
  754.       if (nation == "Egyptians") gain_upgrade(who, "Royal Mameluke");
  755.       else gain_upgrade(who, "Carbineer");
  756.       break;
  757.     case 16:
  758.       gain_next_level(who, nation_age);
  759.       break;
  760.     case 17:
  761.       if (nation == "Chinese") gain_upgrade(who, "Manchu Riflemen");
  762.       else if (nation == "Germans") gain_upgrade(who, "Volksgrenadiers");
  763.       else if (nation == "British") gain_upgrade(who, "Black Watch");
  764.       else gain_upgrade(who, "Riflemen");
  765.       break;
  766.     case 18:  
  767.       gain_upgrade(who, "Anti-Tank Rifle");
  768.       gain_upgrade(who, "Armored Car");
  769.       break;
  770.     case 19:
  771.       gain_upgrade(who, "Light Tank");
  772.       break;
  773.     case 20:
  774.       gain_next_level(who, nation_age);
  775.       if (nation == "Chinese") gain_upgrade(who, "Manchu Infantry");
  776.       else if (nation == "Russians") gain_upgrade(who, "Red Guards Infantry");
  777.       else if (nation == "Aztecs") gain_upgrade(who, "Jaguar Infantry");
  778.       else gain_upgrade(who, "Infantry");
  779.       break;
  780.     case 21:
  781.       gain_upgrade(who, "Bazooka");
  782.       break;
  783.     case 22:
  784.       if (nation == "Germans") gain_upgrade(who, "MG42");
  785.       else gain_upgrade(who, "Heavy Machine Gun");
  786.       break;
  787.     case 23:
  788.       gain_upgrade(who, "Armored Scout Car");
  789.       break;
  790.     case 24:
  791.       if (nation == "Germans") gain_upgrade(who, "Leopard Tank");
  792.       else gain_upgrade(who, "Tank");
  793.       break;
  794.     case 25:
  795.       gain_next_level(who, nation_age);
  796.       if (nation == "Russians") gain_upgrade(who, "Shock Infantry");
  797.       else if (nation == "Aztecs") gain_upgrade(who, "Jaguar Assault Infantry");
  798.       else gain_upgrade(who, "Assault Infantry");
  799.       break;
  800.     case 26:
  801.       gain_upgrade(who, "Anti-Tank Missile");
  802.       break;
  803.     case 27:
  804.       gain_upgrade(who, "Advanced Machine Gun");
  805.       break;
  806.     case 28:
  807.       gain_upgrade(who, "Armored Cavalry");
  808.       break;
  809.     case 29:
  810.       if (nation == "Germans") gain_upgrade(who, "Tiger Tank");
  811.       else if (nation == "Russians") gain_upgrade(who, "T80 Tank");
  812.       else gain_upgrade(who, "Main Battle Tank");
  813.       break;
  814.     case 30:
  815.       building = find_military_build(nation);
  816.       x = object_position_x(nation, building);
  817.       y = object_position_y(nation, building);
  818.       create_unit_upgrade(nation, x + 2, y, "attack helicopter", 2);
  819.       break;
  820.   }   
  821.  
  822.   step++;
  823.   if (step == 30) step--;
  824.  
  825.   return step;
  826.  
  827. }   
  828.  
  829. String scenario real_time ( int the_time ) {
  830.  
  831.   int min = the_time/60;
  832.   int sec = the_time%60;
  833.   String time_data;
  834.   int neg;
  835.  
  836.   if (min < 0) {
  837.     neg = 1;
  838.     min = min * -1;
  839.   }
  840.   if (sec < 0) {
  841.     neg = 1;
  842.     sec = sec * -1;
  843.   }
  844.  
  845.   if (sec < 10) {
  846.     time_data = min + ":0" + sec;
  847.   } else {
  848.     time_data = min + ":" + sec;
  849.   }
  850.  
  851.   if (neg == 1) {
  852.     time_data = "-" + time_data;
  853.   }
  854.  
  855.   return time_data;
  856.  
  857. }