home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 July / Disc 2 / PCU0703CD2.iso / entertn / demos / files / ron.exe / scenario / tutorial5_trial / tut5.bhs < prev    next >
Encoding:
Text File  |  2003-04-29  |  40.8 KB  |  1,045 lines

  1. /******************************************/
  2. /*************RISE OF NATIONS**************/
  3. /**************SANDBOX TUTORIAL**************/
  4. /**************Big Huge Games**************/
  5. /*******Scripted by: Brian A. Kaiser*******/
  6. /***********September 18, 2002**************/
  7. /******************************************/
  8.  
  9. /*******************************************************
  10. The Scenario - Sandbox (Tutorial 5)
  11.  
  12. Map: Your basic two player map. Players are on opposite sides of
  13. the map. Each player begins with one small city, one library, one
  14. woodcutter's camp with two citizens, three farms with citizens, one
  15. scout, and one random citizen who's just there.
  16.  
  17. Setup: Standard rules. The only unique feature to this scenario
  18. is the reminders and hints that will pop up, assuring that a new 
  19. player is collecting enough resources, expanding his nation, 
  20. conducting enough research at the library, etc., etc.
  21. ********************************************************/
  22.  
  23. include "tut_lib.bhs"
  24.  
  25. // DEFINES *******
  26. labels {
  27.   HUMAN = 1,
  28.   COMPUTER = 2,
  29.  
  30. }
  31.  
  32. scenario {
  33.  
  34.  
  35.  
  36. // STATIC VARIABLES *******
  37.   
  38.   // The main timer. Pushes back all other checks when one check is fired.
  39.   static advice_time = 60;
  40.   static library_time = 120;
  41.  
  42.   // To store the ID's of various units and buildings for later use:
  43.   static camp_ID = find_build(HUMAN, "woodcutter's camp");
  44.   static scout_ID = find_unit(HUMAN, "scout");
  45.   static capitol_ID = find_capital(HUMAN);
  46.   static library_ID = find_build(HUMAN, "library");
  47.   static general_ID = 0;
  48.   static spy_ID = 0;
  49.   static merchant_ID = 0;
  50.   static wagon_ID = 0;
  51.   
  52.   static capitol_health = object_health(HUMAN, capitol_ID); // The capitol city's HP.
  53.   static enemy_cap_name = find_capital(COMPUTER);
  54.   static enemy_cap_id = find_city_id(enemy_cap_name);
  55.  
  56.   // Bools  
  57.   static citizen_ok = false;
  58.   static timber_ok = false;
  59.   static food_ok = false;
  60.   static wealth_ok = false;
  61.   static mine_ok = false;
  62.   static scout_ok = false;
  63.   static barracks_ok = false;
  64.   static temple_ok = false;
  65.   static stable_ok = false;
  66.   static university_ok = false;
  67.   static zoom_ok = false;
  68.   static scholars_ok = false;
  69.   static expand_ok = false;
  70.   static siege_ok = false;
  71.   static attack_ok = false;
  72.   static develop_ok = false;
  73.   
  74.   static have_objective = false; // Does the player have an objective to work towards?
  75.   static deadscout = false;  // Is the scout still alive?
  76.   static knows_zoom = false; // Does the player already know how to zoom in and out?
  77.   static timber_filled  = false;
  78.   static has_built_military_units = false;
  79.   
  80.   static foot = false;
  81.   static mounted = false;
  82.   static siege = false;
  83.  
  84.   static v_choice = false; // Voiceover Choice. True if they want voiceovers, false if they don't. 
  85.  
  86.   static rare_resource_discussed = false;
  87.   static rare_resource_timer_set = false;
  88.  
  89.   String player_city;
  90.   int player_city_id;
  91.   int player_x;
  92.   int player_y;
  93.   
  94. // BODY *******
  95.  
  96.   run_once {
  97.     disable_all_triggers();
  98.     set_music_volume(50);
  99.     enable_trigger("Start");
  100.     set_timer("attacking_ai", 900);
  101.   }
  102.  
  103.   if (timer_expired("attacking_ai")) {
  104.     capital = find_capital(2);
  105.     capital_id = find_city_id(capital);
  106.     cap_x = object_position_x(2, capital_id) + 3;
  107.     cap_y = object_position_y(2, capital_id);
  108.     create_unit_upgrade(2, cap_x, cap_y, "slingers", 2);
  109.     create_unit_in_group(2, cap_x, cap_y, "hoplites", 1);
  110.     create_unit_in_group(2, cap_x, cap_y, "bowmen", 1);
  111.     if (age(2) > 0) create_unit_in_group(2, cap_x, cap_y, "cataphract", 1);
  112.     player_city = find_city_name(1);
  113.     player_city_id = find_city_id(player_city);
  114.     player_x = object_position_x(1, player_city_id);
  115.     player_y = object_position_y(1, player_city_id);
  116.     group_attack_to_order(2, player_x, player_y);
  117.     set_timer("attacking_ai", 300);
  118.   }
  119.  
  120.   trigger Start () {
  121.     play_sound("intro.wav");
  122.     //WAV: ( "The leadership of your fledgling tribe has fallen on your shoulders. The first task is to unify"
  123.     //       "a new nation under your rule. You are free to build your nation at your own pace. Occasionally, you may receive some"
  124.     //       "advice to help keep things moving, but otherwise it's all up to you" );
  125.     if ( is_conquest_scenario() ){
  126.       enable_trigger("Conquest_prompt");
  127.     }
  128.     else{
  129.       enable_trigger("Startup");
  130.     }
  131.   }
  132.  
  133.   trigger Conquest_prompt( sound_finished() ){
  134.     v_choice = popup_choice($S("Would you like to enable the hint system for this scenario?"), $S("Hints ON"), $S("Hints OFF") );
  135.     if (v_choice){
  136.       enable_trigger("Startup");
  137.     }
  138.   }
  139.  
  140.   trigger Startup( ){
  141.     enable_trigger("Resource_warn1");
  142.     enable_trigger("Got_capital");
  143.     enable_trigger("Five_farms");
  144.     enable_trigger("Full_camp");
  145.     //enable_trigger("Resource_select");
  146.     enable_trigger("Library_check");
  147.     set_timer( "Library_timer", library_time );
  148.     enable_trigger("Reset_library_check");
  149.     enable_trigger("Library_killed");
  150.     enable_trigger("Dead_scout");
  151.     enable_trigger("Early_scout");
  152.     set_timer("early_scout_timer", 10);
  153.     enable_trigger("Kill_early_scout");
  154.     //enable_trigger("Set_barracks_time");
  155.     enable_trigger("Classical_age");
  156.     enable_trigger("Check_for_commcap");
  157.     enable_trigger("Check_for_popcap");
  158.     enable_trigger("Invasion_check");
  159.     enable_trigger("Already_zoomed");
  160.     enable_trigger("Check_military");
  161.     enable_trigger("First_city_captured");
  162.     enable_trigger("Scout_selected");
  163.     enable_trigger("Have_general");
  164.     enable_trigger("Have_spy");
  165.     enable_trigger("Have_merchant");
  166.     enable_trigger("Have_wagon");
  167.     enable_trigger("Territory_win");
  168.     set_timer( "Advice_timer", 60 );
  169.     enable_trigger("Master_Check");
  170.   }
  171.   
  172.   trigger Master_Check( !have_objective && sound_finished() && timer_expired("Advice_timer") ) {
  173.  
  174.     if( num_type(HUMAN, "citizen") < 7 && !citizen_ok ) {
  175.       enable_trigger("Citizen_check");
  176.     } else if( num_type(HUMAN, "Farm") < 4 && !food_ok) {
  177.       enable_trigger("Food_check");
  178.     } else if( ( num_workers_at_building(HUMAN, camp_ID)  < 3 ) && !commerce_cap_warning(HUMAN) ){
  179.       enable_trigger("Timber_check");
  180.     } else if ( !find_build(HUMAN, "Library") && !find_inactive_build(HUMAN, "Library") ){
  181.       enable_trigger("Library_killed");
  182.     }  else if ( !have_tech(HUMAN, "The Art of War") && !researching_tech(HUMAN, "The Art of War") ){
  183.       enable_trigger("research_art_of_war");
  184.     } else if ( !find_build(HUMAN, "Barracks") && !find_inactive_build(HUMAN, "Barracks") && !barracks_ok ){
  185.       enable_trigger("Build_barracks");
  186.     } else if ( !knows_zoom ){
  187.       enable_trigger("Zoom_reminder");
  188.     } else if ( !find_build(HUMAN, "Temple") && !find_inactive_build(HUMAN, "Temple") && !temple_ok){
  189.       enable_trigger("Temple_check");
  190.     } else if ( ( num_cities(HUMAN) < 2 ) ){
  191.       enable_trigger("Expansion_check");
  192.     } else if ( num_type(HUMAN, "Farm") < 7 && num_type(HUMAN, "Woodcutter's Camp") < 3 && !develop_ok){
  193.       enable_trigger("Develop_check");
  194.     }  else if ( !has_built_military_units ) {
  195.       enable_trigger("build_military_units");
  196.     } else if( !have_tech(HUMAN, "Classical Age") && !researching_tech(HUMAN, "Classical Age") ){
  197.       enable_trigger("Age_check");
  198.     } else if( ( num_cities(HUMAN) > 1 ) && !find_unit(HUMAN, "Caravan") && !wealth_ok){
  199.       enable_trigger("Wealth_check");
  200.     } else if ( !find_build(HUMAN, "Mine") && !find_inactive_build(HUMAN, "Mine") && !mine_ok){
  201.       enable_trigger("Metal_check");
  202.     } else if ( !find_build(HUMAN, "University") && !find_inactive_build(HUMAN, "University") && !university_ok ){
  203.       enable_trigger("Knowledge_check");
  204.     } else if ( num_type(HUMAN, "Scholar") == 0 ){
  205.       enable_trigger("Scholars_check");
  206.     } else if( !find_build(HUMAN, "Stable") && !find_inactive_build(HUMAN, "Stable") && !stable_ok ) {
  207.       enable_trigger("build_stables");
  208.     } else if ( ( num_cities(HUMAN) == 2 ) && !expand_ok) {
  209.       enable_trigger("Expansion_check2");
  210.     } else if( !find_build(HUMAN, "Siege Factory") && !find_inactive_build(HUMAN, "Siege Factory") && !siege_ok ) {
  211.       enable_trigger("Build_siege_factory");
  212.     } else if ( ( num_cities(HUMAN) == 3 ) && !attack_ok ) {
  213.       enable_trigger("Prepare_attack");
  214.     } else if ( !deadscout && is_idle(HUMAN, scout_ID) ){
  215.       enable_trigger("Scout_check");
  216.     }
  217.     
  218.     set_timer("Advice_timer", advice_time);
  219.     enable_trigger("Master_check");
  220.   }
  221.  
  222.   trigger Citizen_check(){
  223.     set_timer( "Advice_timer", advice_time );
  224.     play_sound("citizen.wav");
  225.     // WAV:  Your first priority in the Ancient Age is to create citizens and gather resources. Click on your capitol 
  226.     //      and click create citizen to add to your workforce. Put as many of your people to work gathering food and 
  227.     //      wood as you can.
  228.     print_game_msg($S("Create citizens to gather more resources."));
  229.     citizen_ok = true;
  230.   }
  231.   
  232.   trigger Timber_check( ){
  233.     set_timer( "Advice_timer", advice_time );
  234.     play_sound("timber.wav");
  235.     // WAV: The woodcutter's camp isn't full.  If you haven't yet reached your commerce cap, add more citizens to the 
  236.     //      camp to gather as much wood as possible.
  237.     add_objective($S("Place five citizens in the woodcutter's camp."), "Wood", "timber.wav");
  238.     have_objective = true;
  239.     enable_trigger("Got_wood");
  240.   }
  241.  
  242.   trigger Got_wood( num_workers_at_building(HUMAN, camp_ID) >= 5 ){
  243.     objective_complete("Wood");
  244.     have_objective = false;
  245.     timber_filled = true;
  246.     timber_ok = true;
  247.   }
  248.  
  249.   trigger Full_camp( num_workers_at_building(HUMAN, camp_ID) > 4 ){
  250.     timber_ok = true;
  251.   }
  252.  
  253.   trigger Food_check( ){
  254.     set_timer( "Advice_timer", advice_time );
  255.     play_sound("food.wav");
  256.     // WAV:  Each city can support a maximum of 5 farms. Go ahead and build as many as you can.
  257.     add_objective($S("Build five farms."), "Farms", "food.wav");
  258.     have_objective = true;
  259.     enable_trigger("Got_farms");
  260.   }
  261.  
  262.   trigger Got_farms( num_type(HUMAN, "Farm") == 5 ){
  263.     objective_complete("Farms");
  264.     have_objective = false;
  265.     food_ok = true;
  266.   }
  267.  
  268.   trigger Five_farms( num_type(HUMAN, "Farm") > 4 ){
  269.     food_ok = true;
  270.   }
  271.  
  272.   trigger Age_check(){
  273.     set_timer( "Advice_timer", advice_time );
  274.     play_sound("classical.wav");
  275.     // WAV:  By now, you should be thinking about advancing your nation to the Classical Age. As long as you've 
  276.     //      researched enough technologies at the library and you have sufficient food, the Classical Age will be 
  277.     //      available to you.
  278.     add_objective($S("Advance your nation to the Classical Age"), "Classic", "classical.wav");
  279.     enable_trigger("Second_classical_check");
  280.     have_objective = true;
  281.   }
  282.  
  283.   trigger Wealth_check(){
  284.     set_timer( "Advice_timer", advice_time );
  285.     play_sound("wealth.wav");
  286.     // WAV:  Now would be a good time to begin collecting wealth for your nation. Create markets and caravans to 
  287.     //      set up trade between your cities.
  288.     if( !have_tech(HUMAN, "Barter") && !researching_tech(HUMAN, "Barter") ){
  289.       enable_trigger("Get_barter");
  290.     }
  291.     else{
  292.       enable_trigger("Build_market");
  293.     }
  294.   }
  295.  
  296.   trigger Get_barter( sound_finished() ){
  297.     set_timer( "Advice_timer", advice_time );
  298.     play_sound("barter.wav");
  299.     // WAV:  First you'll need to research "Barter" on the green commerce track at the library.
  300.     add_objective($S("Research\"Barter\" at the library."), "Barter_done", "barter.wav");
  301.     have_objective = true;
  302.     enable_trigger("Got_barter");
  303.   }
  304.  
  305.   trigger Got_barter( have_tech(HUMAN, "Barter") ){
  306.     objective_complete("Barter_done");
  307.     enable_trigger("Build_market");
  308.   }
  309.  
  310.   trigger Build_market( sound_finished() ){
  311.     set_timer( "Advice_timer", advice_time);
  312.     play_sound("now_market.wav");
  313.     // WAV:  You're ready to build a market.
  314.     add_objective($S("Build a market."), "Market", "wealth.wav");
  315.     have_objective = true;
  316.     enable_trigger("Market_built");
  317.   }
  318.  
  319.   trigger Market_built( find_build(HUMAN, "Market") ){
  320.     objective_complete("Market");
  321.     set_timer( "Advice_timer", advice_time );
  322.     play_sound("caravan.wav");
  323.     // WAV:  To increase your wealth income, create caravans at your market. 
  324.     add_objective($S("Create a caravan"), "Caravan", "caravan.wav");
  325.     have_objective = true;
  326.     enable_trigger("Caravan_made");
  327.   }
  328.  
  329.   trigger Caravan_made( find_unit(HUMAN, "Caravan") ){
  330.     objective_complete("Caravan");
  331.     have_objective = false;
  332.     wealth_ok = true;
  333.   }
  334.  
  335.   trigger Resource_warn1( resource_warning() && sound_finished() ){
  336.     set_timer( "Advice_timer", advice_time );
  337.     play_sound("resource_warn1.wav");
  338.     // WAV:    If you're running low on resources, you can always build Farms to gather Food and 
  339.     //        fill up Woodcutter's Camps with citizens to gather Timber. To generate wealth, use
  340.     //        markets and caravans to create trade routes between cities, or research Taxation at 
  341.     //        a temple.
  342.   }
  343.  
  344.   trigger Reset_library_check( object_selected(HUMAN, library_ID) ){
  345.     set_timer( "Library_timer", library_time );
  346.     enable_trigger("Reset_library_check");
  347.   }
  348.   
  349.   trigger Library_check ( timer_expired("Library_timer") && sound_finished() ){
  350.     play_sound("use_library.wav");
  351.     // WAV:  Don't forget to conduct research at your library! Researching new technologies is vital to 
  352.     //      building your nation and advancing your people through the ages.
  353.     print_game_msg($S("Conduct research at the Library."));
  354.     disable_trigger("Reset_library_check");
  355.     stop_timer("Library_timer");
  356.   }
  357.  
  358.   trigger Library_killed( building_destroyed(HUMAN, library_ID) ){
  359.     play_sound("new_library.wav");
  360.     // WAV: Your library has been destroyed! The research conducted there is crucial to the 
  361.     //      development of your nation. Build a new library as soon as you can!
  362.     print_game_msg($S("Build a new Library."));
  363.   }
  364.  
  365.   trigger Temple_check( sound_finished() ){
  366.     play_sound("build_temple.wav");
  367.     // WAV:  Try building a temple in your capital to increase its defenses and expand your 
  368.     //      borders.
  369.     if ( !have_tech(HUMAN, "Written Word") && !researching_tech(HUMAN, "Written Word") ){
  370.       enable_trigger("Get_written_word");
  371.     } else{
  372.       enable_trigger("Build_temple");
  373.     }
  374.   }
  375.  
  376.   trigger Get_written_word( sound_finished() ){
  377.     have_objective = true;
  378.     set_timer("Advice_timer", advice_time);
  379.     play_sound("written_word.wav");
  380.     // WAV:    First you'll need to research "Written Word" on the yellow science track at the library.
  381.     //        Then your citizens will be able to build a temple.
  382.     add_objective($S("Research \"Written Word\" at the Library."), "Written_word", "written_word.wav");
  383.     enable_trigger("Got_written_word");
  384.   }
  385.  
  386.   trigger Got_written_word( have_tech(HUMAN, "Written Word") ){
  387.     objective_complete("Written_word");
  388.     set_timer("Advice_timer", advice_time);
  389.     enable_trigger("Build_temple");
  390.   }
  391.  
  392.   trigger Build_temple( sound_finished() ){
  393.     have_objective = true;
  394.     add_objective($S("Build a temple."), "Temple", "build_temple.wav");
  395.     enable_trigger("Temple_built");  
  396.   }
  397.  
  398.   trigger Temple_built( find_build(HUMAN, "Temple") ){
  399.     objective_complete("Temple");
  400.     have_objective = false;
  401.     temple_ok = true;
  402.     set_timer("Advice_timer", advice_time);
  403.     play_sound("taxation.wav");
  404.     // WAV:  Now that you've built a temple, you can research "taxation" upgrades to increase 
  405.     //      your wealth. Taxation is tied to the percentage of the map that you control. The 
  406.     //      more territory you control, the more wealth you will receive.
  407.   }
  408.  
  409.   trigger Expansion_check(){
  410.     play_sound("expand.wav");
  411.     // WAV:  Building new cities to expand your national borders is key to the survival of your nation.
  412.     if ( !have_tech(HUMAN, "City State") && !researching_tech(HUMAN, "City State") ){
  413.       enable_trigger("Get_city_state");
  414.     } else{
  415.       enable_trigger("Build_city");
  416.     }
  417.   }
  418.  
  419.   trigger Get_city_state( sound_finished() ){
  420.     have_objective = true;
  421.     set_timer( "Advice_timer", advice_time);
  422.     play_sound("civics.wav");
  423.     // WAV:  Research "City State" on the blue civics track in the library. Then, have one of your 
  424.     //      citizens start building a new city.
  425.     add_objective($S("Research \"City State\" at the Library."), "City_State", "civics.wav");
  426.     enable_trigger("Got_city_state");
  427.   }
  428.  
  429.   trigger Got_city_state( have_tech(HUMAN, "City State") ){
  430.     objective_complete("City_State");
  431.     set_timer( "Advice_timer", advice_time);
  432.     enable_trigger("Build_city");
  433.   }
  434.  
  435.   trigger Build_city( sound_finished() ){
  436.     have_objective = true;
  437.     play_sound("build_city.wav");
  438.     // WAV:  You're ready to begin construction on a new city.
  439.     add_objective($S("Build a new city."), "New_city", "build_city.wav");
  440.     enable_trigger("City_built");
  441.   }
  442.  
  443.   trigger City_built( num_cities(HUMAN) == 2 ){
  444.     objective_complete("New_city");
  445.     have_objective = false;
  446.   }
  447.  
  448.   trigger Develop_check( sound_finished() ){
  449.     if ( num_type(HUMAN, "Farm") < 7 && num_type(HUMAN, "Woodcutter's Camp") < 3){
  450.       play_sound("develop.wav");
  451.       // WAV:    Don't forget to put people to work at your new city. You can now support another 5
  452.       //        farms, and find new sources of timber nearby.
  453.     }
  454.     develop_ok = true;
  455.   }
  456.  
  457.   trigger expansion_check2() {
  458.     play_sound("expand2.wav");
  459.     // WAV:  We have two cities currently, but we can expand our nation and collect more resources if we build more.
  460.     if( !have_tech(HUMAN, "Empire") && !researching_tech(HUMAN, "Empire") ) {
  461.       enable_trigger("get_empire");
  462.     } else {
  463.       enable_trigger("build_city2");
  464.     }
  465.   }
  466.  
  467.   trigger get_empire( sound_finished() ) {
  468.     set_timer( "Advice_timer", advice_time );
  469.     // WAV:  Research the blue civics track in the library.  You can build 
  470.     //       one additional city for each civics technology you've researched.
  471.     add_objective($S("Research Empire at the Library."), "empire", "empire.wav" );
  472.     have_objective = true;
  473.     play_objective_sound("empire");
  474.     enable_trigger("got_empire");
  475.   }
  476.  
  477.   trigger got_empire( have_tech( HUMAN, "Empire" ) ) {
  478.     objective_complete("empire");
  479.     play_sound("got_empire.wav");
  480.     // WAV:  Now that we have researched a blue civics technology, we can build another city.
  481.     enable_trigger("build_city2");
  482.   }
  483.   
  484.   trigger build_city2( sound_finished() ) {
  485.     have_objective = true;
  486.     add_objective($S("Build a city near your borders."), "build_city2", "build_city2.wav");
  487.     play_objective_sound("build_city2");
  488.     // Build a new city.  Place it near the edge of your territory so that you will expand your borders and
  489.     // control a larger portion of the map.
  490.     enable_trigger("city_built2");
  491.   }
  492.  
  493.   trigger city_built2( num_cities(HUMAN) > 2 ) {
  494.     objective_complete("build_city2");
  495.     play_sound("built_city2.wav");
  496.     // WAV:  Good job.  You have built another city and expanded your territory.  Remember to build more
  497.     //       caravans to take advantage of the new trade routes that have opened up.
  498.     have_objective = false;
  499.     expand_ok = true;
  500.   }
  501.  
  502.   trigger Remind_of_goals( sound_finished() ) {
  503.     play_sound("Remind_of_goals.wav");
  504.     // WAV:  There are a number of paths to victory in Rise of Nations.  
  505.     //       In this scenario, there are two common ways to win.
  506.     //       The first way involves having 70% or more of the territory under your control.
  507.     //       You can check your current percentage in the bottom right corner of the screen.
  508.     //       The second way to win involves capturing the enemy capital.
  509.     //       In order to do this, build units at the barracks, stable, and siege factory and attack the enemy city.
  510.     //       
  511.   }
  512.  
  513.   trigger Got_capital( city_captured_by(COMPUTER, HUMAN, enemy_cap_id) && sound_finished() ){
  514.     play_sound("capital_timer.wav");
  515.     // WAV: You have captured the enemy's capital city! If he cannot retake it before the timer 
  516.     //      in the upper right expires, he will be defeated! Hold on to the enemy's capital city 
  517.     //      for a little while longer to achieve victory.
  518.   }
  519.  
  520.   trigger Territory_win( (get_territory(HUMAN) >= 70) && sound_finished() ){
  521.     play_sound("territory_timer.wav");
  522.     // WAV:  You now control at least 70% of the map! If your opponent cannot get more land 
  523.     //      before the timer in the upper right expires, he will be defeated. Hold on to at 
  524.     //      least 70% of the map for a little while longer to achieve victory!
  525.   }
  526.  
  527.   trigger Prepare_attack(){
  528.     play_sound("prepare_attack.wav");
  529.     // WAV: By now your nation should be advanced enough for you to concentrate on building a stronger military 
  530.     //      force. See if you can build an attack force powerful enough to seize one of your enemy's cities.
  531.     if ( !find_build(HUMAN, "Barracks") ){
  532.       enable_trigger("Rebuild_barracks");
  533.     } else{
  534.       enable_trigger("Make_foot");
  535.     }
  536.     if ( !find_build(HUMAN, "Stable") ){
  537.       enable_trigger("Rebuild_stable");
  538.     } else{
  539.       enable_trigger("Make_mounted");
  540.     }
  541.     if ( !find_build(HUMAN, "Siege Factory") ){
  542.       enable_trigger("Rebuild_siege");  
  543.     } else{
  544.       enable_trigger("Make_siege");
  545.     }
  546.     enable_trigger("Check_troops");
  547.     disable_trigger("First_city_captured");
  548.     attack_ok = true;
  549.   }
  550.  
  551.   trigger Rebuild_barracks( ){
  552.     add_objective($S("Rebuild your barracks."), "new_barracks", "build_troops.wav");
  553.     enable_trigger("New_barracks");
  554.   }
  555.  
  556.   trigger New_barracks( find_build(HUMAN, "Barracks") ){
  557.     objective_complete("new_barracks");
  558.     enable_trigger("Make_foot");
  559.   }
  560.     
  561.   trigger Make_foot( num_unit_category(HUMAN, "Foot") < 8 && sound_finished() ){
  562.     play_sound("make_foot.wav");
  563.     add_objective($S("Train 8 troops at your barracks."), "make_foot", "make_foot.wav");
  564.     have_objective = true;
  565.     // WAV: Train 8 troops of your choice at the barracks. Remember, each unit has its own strengths and 
  566.     //      weaknesses, so try to train a variety of different types.
  567.     enable_trigger("Foot_made");
  568.   }
  569.   
  570.   trigger Rebuild_stable( ){
  571.     add_objective($S("Rebuild your stable."), "new_stable", "build_stable.wav");
  572.     enable_trigger("New_stable");
  573.   }
  574.  
  575.   trigger New_stable( find_build(HUMAN, "Stable") ){
  576.     objective_complete("new_stable");
  577.     enable_trigger("Make_mounted");
  578.   }
  579.  
  580.   trigger Make_mounted( num_unit_category(HUMAN, "Mounted") < 4 && sound_finished() ){
  581.     play_sound("make_mounted.wav");
  582.     add_objective($S("Train 4 troops at your stables."), "make_mounted", "make_mounted.wav");
  583.     have_objective = true;
  584.     // WAV:  Train 4 mounted troops at your stables.
  585.     enable_trigger("Mounted_made");
  586.   }
  587.  
  588.   trigger Rebuild_siege( ){
  589.     add_objective($S("Rebuild your siege factory."), "new_siege", "build_siege_factory.wav");
  590.     enable_trigger("New_siege");
  591.   }
  592.  
  593.   trigger New_siege( find_build(HUMAN, "Siege Factory") ){
  594.     objective_complete("new_siege");
  595.     enable_trigger("Make_siege");
  596.   }
  597.  
  598.   trigger Make_siege( num_unit_category(HUMAN, "Artillery") < 3 && sound_finished() ){
  599.     play_sound("make_siege.wav");
  600.     add_objective($S("Build 3 siege weapons at your siege factory."), "make_siege", "make_siege.wav");
  601.     have_objective = true;
  602.     // WAV:  Build 3 siege weapons at your siege factory.
  603.     enable_trigger("Siege_made");
  604.   }
  605.  
  606.   trigger Check_troops( ){
  607.     if ( num_unit_category(HUMAN, "Foot") >= 8 ){
  608.       if ( num_unit_category(HUMAN, "Mounted") >= 4 ){
  609.         if ( num_unit_category(HUMAN, "Artillery") >= 3 ){
  610.           enable_trigger("Ready_to_attack");
  611.         }
  612.         else{
  613.           enable_trigger("Check_troops");
  614.         }
  615.       }
  616.       else{
  617.         enable_trigger("Check_troops");
  618.       }
  619.     } 
  620.     else{
  621.       enable_trigger("Check_troops");
  622.     }
  623.   }
  624.  
  625.   trigger Foot_made( num_unit_category(HUMAN, "Foot") >= 8 ){
  626.     objective_complete("make_foot");
  627.     foot = true;
  628.   }
  629.  
  630.   trigger Mounted_made( num_unit_category(HUMAN, "Mounted") >= 4 ){
  631.     objective_complete("make_mounted");
  632.     mounted = true;
  633.   }
  634.  
  635.   trigger Siege_made( num_unit_category(HUMAN, "Artillery") >= 3 ){
  636.     objective_complete("make_siege");
  637.     siege = true;
  638.   }
  639.   
  640.   trigger Ready_to_attack( ){
  641.     play_sound("ready_attack.wav");
  642.     add_objective($S("Capture an enemy city!"), "capture_city", "ready_attack.wav");
  643.     //enable_trigger("Near_enemy_city");
  644.     enable_trigger("Captured_city");
  645.     // WAV:  Your army is prepared to march into enemy territory and take a city in your nation's name!
  646.     //      If your scout has not located any enemy cities, have him hunt around until he finds one. 
  647.     //      Marching blindly into your enemy's nation is not a good strategy.
  648.   }
  649.  
  650.   trigger First_city_captured( city_captured_by(COMPUTER, HUMAN, "") ){
  651.     play_sound("captured_city.wav");
  652.     // WAV: Excellent work! You have captured an enemy city an will begin assimilating it into 
  653.     //      your nation!
  654.     enable_trigger("Remind_of_goals");
  655.   }
  656.  
  657.   trigger Captured_city ( city_captured_by(COMPUTER, HUMAN, "") ){
  658.     play_sound("captured_city.wav");
  659.     objective_complete("capture_city");
  660.     enable_trigger("Remind_of_goals");
  661.     // WAV: Excellent work! You have captured an enemy city an will begin assimilating it into 
  662.     //      your nation!
  663.   }
  664.  
  665.   trigger Kill_early_scout( timer_expired("early_scout_timer") ){
  666.     stop_timer("early_scout_timer");
  667.     disable_trigger("Early_scout");
  668.   }
  669.  
  670.   trigger Early_scout( object_selected(HUMAN, scout_ID) ){
  671.     disable_trigger("Scout_selected");
  672.   }
  673.   
  674.   trigger Dead_scout( unit_killed(HUMAN, scout_ID) ){
  675.     deadscout = true;
  676.     disable_trigger("Scout_check");
  677.     disable_trigger("Scout_selected");
  678.   }
  679.  
  680.   trigger Scout_check( sound_finished() ){
  681.     set_timer( "Advice_timer", advice_time );
  682.     play_sound("bored_scout.wav");
  683.     // WAV:  Remember to explore! Your scout can uncover rare resources and locate the enemy's position. 
  684.     ping_object(1, 1, 1, scout_ID);
  685.     print_game_msg($S("Use your scout to explore new territory."));
  686.   }
  687.  
  688.   ///////////////////// UNIT DEFINITIONS ////////////////////////////
  689.  
  690.   trigger Scout_selected( object_selected(HUMAN, scout_ID) && sound_finished() ){
  691.     
  692.       play_sound("scout_selected.wav");
  693.     
  694.     // WAV: This is your scout. Use him to discover rare resources or locate the enemy position. Scouts 
  695.     //      are very fast and can see farther than most units, but cannot attack. You can move 
  696.     //      your scout around the map manually, or click on the "auto-explore" button to have him explore 
  697.     //      on his own.
  698.   }
  699.  
  700.   trigger Have_general( find_unit(HUMAN, "general") ){
  701.     general_ID = find_unit(HUMAN, "general");
  702.     enable_trigger("General_selected");
  703.   }
  704.  
  705.   trigger General_selected( object_selected(HUMAN, general_ID) && sound_finished() ){
  706.     play_sound("general_selected.wav");
  707.     // WAV:  This is a general. Keep him near your troops to have them fight more efficiently. If he has 
  708.     //      enough "craft", represented by the blue line above him, he can use special abilities like forced 
  709.     //      march and entrenchment. Read more about these abilities by selecting your general and rolling the 
  710.     //      mouse over the buttons in the lower left panel.
  711.   }
  712.  
  713.   trigger Have_spy( find_unit(HUMAN, "spy") ){
  714.     spy_ID = find_unit(HUMAN, "spy");
  715.     enable_trigger("Spy_selected");
  716.   }
  717.  
  718.   trigger Spy_selected( object_selected(HUMAN, spy_ID) && sound_finished() ){
  719.     play_sound("spy_selected.wav");
  720.     // WAV:  This is a spy. When not moving, she's invisible to most enemies. If she has enough "craft", 
  721.     //      represented by the blue line above her, she can use special abilities like bribing enemy troops 
  722.     //      and stealing from cities. Read more about these abilities by selecting your spy and rolling the 
  723.     //      mouse over the buttons in the lower left panel.");
  724.   }
  725.  
  726.   trigger Have_merchant( find_unit(HUMAN, "merchant") ){
  727.     merchant_ID = find_unit(HUMAN, "merchant");
  728.     enable_trigger("merchant_selected");
  729.   }
  730.   
  731.   trigger Merchant_selected( object_selected(HUMAN, merchant_ID) && sound_finished() ){
  732.     play_sound("merchant_selected.wav");
  733.     // WAV:  This is a merchant. Use merchants to take advantage of the rare resources scattered around the map. 
  734.     //      These resources provide a number of benefits for your nation. To enjoy these benefits, simply select 
  735.     //      your merchant and then right-click a rare resource to have him set-up shop.");
  736.   }
  737.  
  738.   
  739.  
  740.  
  741.   if (!rare_resource_discussed && get_resource_at_mouse()) {
  742.     if (!rare_resource_timer_set) {
  743.       set_timer("resource_timer", 2);
  744.       rare_resource_timer_set = true;
  745.     } 
  746.     
  747.     if (timer_expired("resource_timer")) {
  748.       rare_resource_discussed = true;
  749.       play_sound("resource_selected.wav");
  750.       // WAV:  This is a rare resource. Rare resources offer a wide variety of benefits to 
  751.       //      your nation. By placing the mouse cursor over a resource, you can see what specific
  752.       //      bonuses it will provide. To take advantage of this resource, first create a merchant 
  753.       //      at your  market. Then, select your merchant and right-click on the rare resource.
  754.     }
  755.   } else {
  756.     stop_timer("resource_timer");
  757.     rare_resource_timer_set = false;
  758.   }
  759.  
  760.   trigger Have_wagon( find_unit(HUMAN, "supply wagon") ){
  761.     wagon_ID = find_unit(HUMAN, "supply wagon");
  762.     enable_trigger("Wagon_selected");
  763.   }
  764.   
  765.   trigger Wagon_selected( object_selected(HUMAN, wagon_ID) && sound_finished() ){
  766.     play_sound("wagon_selected.wav");
  767.     // WAV: This is a supply wagon. It will help your siege weapons fire more rapidly, 
  768.     //      and prevent your units from being damaged by attrition.
  769.   }
  770.  
  771.   trigger research_art_of_war( sound_finished() ) {
  772.     // WAV:  We need to build units to defend our nation and attack the enemy.  In order to 
  773.     //       build a barracks, we need to research the first red military technology, The Art of War
  774.     //       at the library.
  775.     have_objective = true;
  776.     add_objective($S( "Research The Art of War at your library."), "art_of_war", "art_of_war.wav");
  777.     play_objective_sound("art_of_war");
  778.     enable_trigger("have_art_of_war");
  779.   }
  780.  
  781.   trigger have_art_of_war( have_tech( HUMAN, "The Art of War") ) {
  782.     objective_complete("art_of_war");
  783.     have_objective = false;
  784.     set_timer("Advice_timer", advice_time);
  785.   }
  786.  
  787.   trigger Build_barracks( sound_finished() ){
  788.     play_sound("build_troops.wav");
  789.     // WAV:  Now that you have studied the Art of War, you can build a barracks and begin training troops 
  790.     //      to protect your nation. 
  791.     have_objective = true;
  792.     add_objective($S("Build a barracks."), "Barracks", "build_troops.wav");
  793.     play_objective_sound("Barracks");
  794.     enable_trigger("Barracks_built");
  795.   }
  796.     
  797.   trigger Barracks_built( find_build(HUMAN, "Barracks") ){
  798.     objective_complete("Barracks");
  799.     have_objective = false;
  800.     set_timer("Advice_timer", advice_time);
  801.     barracks_ok = true;
  802.   }
  803.  
  804.   trigger check_military( num_military_units( HUMAN ) >= 1 ) {
  805.     has_built_military_units = true;
  806.   }
  807.  
  808.   trigger build_military_units( sound_finished() ) {
  809.     // WAV:  You need to build military units at your barracks to defend your nation.
  810.     play_sound("build_military_units.wav");
  811.   }
  812.  
  813.   trigger build_stables( sound_finished() ) {
  814.     enable_trigger("construct_stables");
  815.     //if( have_tech( HUMAN, "Mercenaries" ) ) {
  816.     //  enable_trigger("construct_stables");
  817.     //} else {
  818.     //  enable_trigger("research_mercenaries");
  819.     //}
  820.   }
  821.  
  822.   trigger research_mercenaries( sound_finished() ) {
  823.     have_objective = true;
  824.     add_objective( $S("Research the Mercenaries at the library."), "research_mercenaries", "research_mercenaries.wav");
  825.     play_objective_sound("research_mercenaries");
  826.     // WAV:  We need to expand our army and develop horse units.  Before we can build a stables, we need to research the second
  827.     //       red military technology, Mercenaries, at the library.
  828.     enable_trigger("construct_stables");
  829.   }
  830.  
  831.   trigger construct_stables( sound_finished() ) {
  832.     have_objective = true;
  833.     objective_complete("research_mercenaries");
  834.  
  835.     add_objective($S( "Build a stable."), "build_stable", "build_stable.wav");
  836.     play_objective_sound("build_stable");
  837.     // WAV:  Build a stable so we can start building horse units to expand our army.
  838.     enable_trigger( "stable_built");
  839.   }
  840.   
  841.   trigger stable_built( find_build( HUMAN, "Stable" ) ) {
  842.     objective_complete("build_stable");
  843.     stable_ok = true;
  844.     play_sound("built_stable.wav");
  845.     // WAV:  We now have a stable to build horse units.  Horse units are fast, tough units 
  846.     //       that are excellent at destroying siege units.
  847.     have_objective = false;
  848.   }
  849.  
  850.   trigger Build_siege_factory( sound_finished() ) {
  851.     have_objective = true;
  852.     
  853.     add_objective($S("Build a siege factory"), "build_siege_factory", "build_siege_factory.wav");
  854.     play_objective_sound("build_siege_factory");
  855.     // WAV:  To be able to effectively attack and capture enemy cities, we need to build a 
  856.     //       siege factory to build siege units like catapults.  
  857.  
  858.     enable_trigger("siege_factory_built");
  859.   }
  860.  
  861.   trigger siege_factory_built( find_build( HUMAN, "Siege Factory") ) {
  862.     objective_complete("build_siege_factory");
  863.     play_sound("siege_factory_built.wav");
  864.     // WAV:  Units built at siege factories, like catapults, are lethal
  865.     //       against buildings.  
  866.     have_objective = false;
  867.     siege_ok = true;
  868.   }
  869.   
  870.  
  871.   trigger Check_for_commcap( !commerce_cap_warning(HUMAN) ){
  872.     enable_trigger("Comm_cap_hit");
  873.   }
  874.  
  875.   trigger Comm_cap_hit( commerce_cap_warning(HUMAN) && sound_finished() ){
  876.     set_timer( "Advice_timer", advice_time );
  877.     play_sound("comm_cap.wav");
  878.     // WAV:  Looks like you've hit your commerce cap. That means some of the resources you're gathering are 
  879.     //      going to waste. Research the green commerce track at the library to increase the amount of 
  880.     //      resources you can gather.
  881.     print_game_msg($S("Research COMMERCE (green track) at the library."));
  882.   }
  883.  
  884.   trigger Check_for_popcap( !pop_cap_warning(HUMAN) ){
  885.     enable_trigger("Pop_cap_hit");
  886.   }
  887.  
  888.   trigger Pop_cap_hit( pop_cap_warning(HUMAN) && sound_finished() ){
  889.     set_timer( "Advice_timer", advice_time );
  890.     play_sound("pop_cap.wav");
  891.     // WAV:  You can't support any more people. You'll have to study the red military track at the library 
  892.     //      to increase your population limit.
  893.     print_game_msg($S("Research MILITARY (red track) at the library."));
  894.   }
  895.  
  896.   trigger Invasion_check((was_city_attacked(HUMAN, "", -1) || was_city_raided(HUMAN, "", -1)) && sound_finished() ){
  897.     play_sound("invasion.wav");
  898.     // WAV:  Danger! The enemy has invaded your territory! You must drive them away as quickly as possible. 
  899.     set_timer("Alarm_timer", 20);
  900.     //enable_trigger("Military_emergency");
  901.     enable_trigger("Save_citizens");
  902.     enable_trigger("Capitol_health_check");
  903.   }
  904.  
  905.   /*
  906.   trigger Military_emergency( num_military_buildings(HUMAN) == 0 && sound_finished() ){
  907.     set_timer( "Advice_timer", advice_time );
  908.     play_sound("defenseless.wav");
  909.     // WAV:  You don't have any military buildings! Quickly build a barracks or a tower or whatever is 
  910.     //      available to you to repel this attack!
  911.     print_game_msg($S("Build a barracks and defend yourself!"));
  912.   }
  913.   */
  914.  
  915.   trigger Save_citizens( timer_expired("Alarm_timer") && !city_alarm_sounded(HUMAN, "") && sound_finished() ){
  916.     set_timer( "Advice_timer", advice_time );
  917.     play_sound("sound_alarm.wav");
  918.     // WAV: Don't forget: You can protect your citizens by sounding the alarm at your city.
  919.     print_game_msg($S("Don't forget, you can protect your citizens by sounding the alarm at your city!"));
  920.     enable_trigger("Alarm_sounded");
  921.     stop_timer("Alarm_timer");
  922.   }
  923.  
  924.   trigger Alarm_sounded( city_alarm_sounded(HUMAN, "") && sound_finished() ){
  925.     set_timer( "Advice_timer", advice_time );
  926.     play_sound("citizens_safe.wav");
  927.     // WAV:  Good. Now your citizens are safe unless the enemy takes your city.
  928.     print_game_msg($S("Good. Now your citizens are safe."));
  929.   }
  930.  
  931.   trigger Capitol_health_check( object_health(HUMAN, capitol_ID) < capitol_health ){
  932.     set_object_health( HUMAN, capitol_ID, capitol_health );
  933.     enable_trigger("Capitol_health_check");
  934.   }
  935.  
  936.   trigger Already_zoomed( is_zoomed_out() ){
  937.     knows_zoom = true;
  938.   }
  939.   
  940.   trigger Zoom_reminder( !knows_zoom && sound_finished() ){
  941.     set_timer( "Advice_timer", advice_time );
  942.     play_sound("zoom_reminder.wav");
  943.     // WAV:  If you want to see more of the map, you can always zoom in and out by using the 
  944.     //      scroll-wheel on your mouse, or pressing PageUp and PageDown on the keyboard.
  945.     knows_zoom = true;
  946.   }
  947.  
  948.   trigger Classical_age( have_tech(HUMAN, "Classical Age") ){
  949.     enable_trigger("Military_check");
  950.     //enable_trigger("Metal_check");
  951.     enable_trigger("Medieval_age");
  952.     enable_trigger("Resource_warn2");
  953.     disable_trigger("Resource_warn1");
  954.   }
  955.  
  956.   trigger Second_classical_check( have_tech(HUMAN, "Classical Age") ){
  957.     objective_complete("Classic");
  958.     have_objective = false;
  959.   }
  960.  
  961.   trigger Military_check( !have_tech(HUMAN, "The Art of War") && !researching_tech(HUMAN, "The Art of War") && sound_finished() ){
  962.     set_timer( "Advice_timer", advice_time );
  963.     play_sound("military.wav");
  964.     // WAV:  Congratulations on advancing to the Classical Age. Start thinking about building a 
  965.     //      military to protect your bigger and better nation. Research "The Art of War" on the 
  966.     //      red military track at the library.
  967.     print_game_msg($S("Research MILITARY (red track) at the library."));
  968.   }
  969.  
  970.   trigger Metal_check(){
  971.     set_timer( "Advice_timer", advice_time );
  972.     play_sound("metal.wav");
  973.     // WAV: One of the new resources you can gather in the Classical Age is metal. Build a mine 
  974.     //      and begin gathering this important resource.
  975.     add_objective($S("Build a mine."), "Mine", "metal.wav");
  976.     have_objective = true;
  977.     enable_trigger("Mine_built");
  978.   }
  979.  
  980.   trigger Mine_built( find_build(HUMAN, "Mine") ){
  981.     objective_complete("Mine");
  982.     have_objective = false;
  983.     mine_ok = true;
  984.     play_sound("miners.wav");
  985.     // WAV: Well done. Assign more citizens to work in the mine to increase your output of metal.
  986.   }
  987.  
  988.   trigger Knowledge_check( ){
  989.     play_sound("knowledge.wav");
  990.     // WAV:  You haven't built a university yet. Knowledge may be the most valuable resource 
  991.     //      available to you, so set up a university and start gathering knowledge.
  992.     add_objective($S("Build a university"), "University", "knowledge.wav");
  993.     have_objective = true;
  994.     enable_trigger("University_built");
  995.   }
  996.  
  997.   trigger University_built( find_build(HUMAN, "University") ){
  998.     objective_complete("University");
  999.     have_objective = false;
  1000.     set_timer("Advice_timer", advice_time);
  1001.     university_ok = true;
  1002.   }
  1003.  
  1004.   trigger Scholars_check( ){
  1005.     play_sound("scholars.wav");
  1006.     // WAV:  An empty university isn't a great source of knowledge. Click on a university and 
  1007.     //      click "create scholars" to gather more knowledge. Create at least four scholars.
  1008.     add_objective( $S("Create 4 scholars."), "Smart_guys", "scholars.wav" );
  1009.     have_objective = true;
  1010.     enable_trigger("Scholars_made");
  1011.   }
  1012.  
  1013.   trigger Scholars_made( num_type(HUMAN, "Scholar") > 3 ){
  1014.     objective_complete("Smart_guys");
  1015.     have_objective = false;
  1016.     set_timer("Advice_timer", advice_time);
  1017.   }
  1018.  
  1019.   trigger Resource_warn2( resource_warning() && sound_finished() ){
  1020.     set_timer( "Advice_timer", advice_time );
  1021.     play_sound("resource_warn2.wav");
  1022.     // WAV:  Now that you're in the Classical Age, new methods of gathering resources are 
  1023.     //      available to you. Remember: build mines to gather metal and universities to 
  1024.     //      generate knowledge. If you don't have a lot of wealth or food, building new cities 
  1025.     //      opens up new trade routes and allows you to build more farms.
  1026.   }
  1027.  
  1028.   trigger Medieval_age( have_tech(HUMAN, "Medieval Age") ){
  1029.     disable_trigger("Resource_warn2");
  1030.     enable_trigger("Resource_warn3");
  1031.   }
  1032.  
  1033.   trigger Resource_warn3( resource_warning() && sound_finished() ){
  1034.     set_timer( "Advice_timer", advice_time );
  1035.     play_sound("resource_warn3.wav");
  1036.     // WAV:  By now you know how to gather all of your resources. If you run low on one, concentrate 
  1037.     //      on increasing the gather rate of that resource. Remember to fill you mines and 
  1038.     //      universities, and create a caravan for every trade route available. If you've researched 
  1039.     //      at least two of the yellow science tags at the library, you can build granaries and lumber 
  1040.     //      mills to increase your food and wood production.
  1041.   }
  1042. }
  1043.  
  1044.  
  1045.