home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-04-29 | 40.8 KB | 1,045 lines |
- /******************************************/
- /*************RISE OF NATIONS**************/
- /**************SANDBOX TUTORIAL**************/
- /**************Big Huge Games**************/
- /*******Scripted by: Brian A. Kaiser*******/
- /***********September 18, 2002**************/
- /******************************************/
-
- /*******************************************************
- The Scenario - Sandbox (Tutorial 5)
-
- Map: Your basic two player map. Players are on opposite sides of
- the map. Each player begins with one small city, one library, one
- woodcutter's camp with two citizens, three farms with citizens, one
- scout, and one random citizen who's just there.
-
- Setup: Standard rules. The only unique feature to this scenario
- is the reminders and hints that will pop up, assuring that a new
- player is collecting enough resources, expanding his nation,
- conducting enough research at the library, etc., etc.
- ********************************************************/
-
- include "tut_lib.bhs"
-
- // DEFINES *******
- labels {
- HUMAN = 1,
- COMPUTER = 2,
-
- }
-
- scenario {
-
-
-
- // STATIC VARIABLES *******
-
- // The main timer. Pushes back all other checks when one check is fired.
- static advice_time = 60;
- static library_time = 120;
-
- // To store the ID's of various units and buildings for later use:
- static camp_ID = find_build(HUMAN, "woodcutter's camp");
- static scout_ID = find_unit(HUMAN, "scout");
- static capitol_ID = find_capital(HUMAN);
- static library_ID = find_build(HUMAN, "library");
- static general_ID = 0;
- static spy_ID = 0;
- static merchant_ID = 0;
- static wagon_ID = 0;
-
- static capitol_health = object_health(HUMAN, capitol_ID); // The capitol city's HP.
- static enemy_cap_name = find_capital(COMPUTER);
- static enemy_cap_id = find_city_id(enemy_cap_name);
-
- // Bools
- static citizen_ok = false;
- static timber_ok = false;
- static food_ok = false;
- static wealth_ok = false;
- static mine_ok = false;
- static scout_ok = false;
- static barracks_ok = false;
- static temple_ok = false;
- static stable_ok = false;
- static university_ok = false;
- static zoom_ok = false;
- static scholars_ok = false;
- static expand_ok = false;
- static siege_ok = false;
- static attack_ok = false;
- static develop_ok = false;
-
- static have_objective = false; // Does the player have an objective to work towards?
- static deadscout = false; // Is the scout still alive?
- static knows_zoom = false; // Does the player already know how to zoom in and out?
- static timber_filled = false;
- static has_built_military_units = false;
-
- static foot = false;
- static mounted = false;
- static siege = false;
-
- static v_choice = false; // Voiceover Choice. True if they want voiceovers, false if they don't.
-
- static rare_resource_discussed = false;
- static rare_resource_timer_set = false;
-
- String player_city;
- int player_city_id;
- int player_x;
- int player_y;
-
- // BODY *******
-
- run_once {
- disable_all_triggers();
- set_music_volume(50);
- enable_trigger("Start");
- set_timer("attacking_ai", 900);
- }
-
- if (timer_expired("attacking_ai")) {
- capital = find_capital(2);
- capital_id = find_city_id(capital);
- cap_x = object_position_x(2, capital_id) + 3;
- cap_y = object_position_y(2, capital_id);
- create_unit_upgrade(2, cap_x, cap_y, "slingers", 2);
- create_unit_in_group(2, cap_x, cap_y, "hoplites", 1);
- create_unit_in_group(2, cap_x, cap_y, "bowmen", 1);
- if (age(2) > 0) create_unit_in_group(2, cap_x, cap_y, "cataphract", 1);
- player_city = find_city_name(1);
- player_city_id = find_city_id(player_city);
- player_x = object_position_x(1, player_city_id);
- player_y = object_position_y(1, player_city_id);
- group_attack_to_order(2, player_x, player_y);
- set_timer("attacking_ai", 300);
- }
-
- trigger Start () {
- play_sound("intro.wav");
- //WAV: ( "The leadership of your fledgling tribe has fallen on your shoulders. The first task is to unify"
- // "a new nation under your rule. You are free to build your nation at your own pace. Occasionally, you may receive some"
- // "advice to help keep things moving, but otherwise it's all up to you" );
- if ( is_conquest_scenario() ){
- enable_trigger("Conquest_prompt");
- }
- else{
- enable_trigger("Startup");
- }
- }
-
- trigger Conquest_prompt( sound_finished() ){
- v_choice = popup_choice($S("Would you like to enable the hint system for this scenario?"), $S("Hints ON"), $S("Hints OFF") );
- if (v_choice){
- enable_trigger("Startup");
- }
- }
-
- trigger Startup( ){
- enable_trigger("Resource_warn1");
- enable_trigger("Got_capital");
- enable_trigger("Five_farms");
- enable_trigger("Full_camp");
- //enable_trigger("Resource_select");
- enable_trigger("Library_check");
- set_timer( "Library_timer", library_time );
- enable_trigger("Reset_library_check");
- enable_trigger("Library_killed");
- enable_trigger("Dead_scout");
- enable_trigger("Early_scout");
- set_timer("early_scout_timer", 10);
- enable_trigger("Kill_early_scout");
- //enable_trigger("Set_barracks_time");
- enable_trigger("Classical_age");
- enable_trigger("Check_for_commcap");
- enable_trigger("Check_for_popcap");
- enable_trigger("Invasion_check");
- enable_trigger("Already_zoomed");
- enable_trigger("Check_military");
- enable_trigger("First_city_captured");
- enable_trigger("Scout_selected");
- enable_trigger("Have_general");
- enable_trigger("Have_spy");
- enable_trigger("Have_merchant");
- enable_trigger("Have_wagon");
- enable_trigger("Territory_win");
- set_timer( "Advice_timer", 60 );
- enable_trigger("Master_Check");
- }
-
- trigger Master_Check( !have_objective && sound_finished() && timer_expired("Advice_timer") ) {
-
- if( num_type(HUMAN, "citizen") < 7 && !citizen_ok ) {
- enable_trigger("Citizen_check");
- } else if( num_type(HUMAN, "Farm") < 4 && !food_ok) {
- enable_trigger("Food_check");
- } else if( ( num_workers_at_building(HUMAN, camp_ID) < 3 ) && !commerce_cap_warning(HUMAN) ){
- enable_trigger("Timber_check");
- } else if ( !find_build(HUMAN, "Library") && !find_inactive_build(HUMAN, "Library") ){
- enable_trigger("Library_killed");
- } else if ( !have_tech(HUMAN, "The Art of War") && !researching_tech(HUMAN, "The Art of War") ){
- enable_trigger("research_art_of_war");
- } else if ( !find_build(HUMAN, "Barracks") && !find_inactive_build(HUMAN, "Barracks") && !barracks_ok ){
- enable_trigger("Build_barracks");
- } else if ( !knows_zoom ){
- enable_trigger("Zoom_reminder");
- } else if ( !find_build(HUMAN, "Temple") && !find_inactive_build(HUMAN, "Temple") && !temple_ok){
- enable_trigger("Temple_check");
- } else if ( ( num_cities(HUMAN) < 2 ) ){
- enable_trigger("Expansion_check");
- } else if ( num_type(HUMAN, "Farm") < 7 && num_type(HUMAN, "Woodcutter's Camp") < 3 && !develop_ok){
- enable_trigger("Develop_check");
- } else if ( !has_built_military_units ) {
- enable_trigger("build_military_units");
- } else if( !have_tech(HUMAN, "Classical Age") && !researching_tech(HUMAN, "Classical Age") ){
- enable_trigger("Age_check");
- } else if( ( num_cities(HUMAN) > 1 ) && !find_unit(HUMAN, "Caravan") && !wealth_ok){
- enable_trigger("Wealth_check");
- } else if ( !find_build(HUMAN, "Mine") && !find_inactive_build(HUMAN, "Mine") && !mine_ok){
- enable_trigger("Metal_check");
- } else if ( !find_build(HUMAN, "University") && !find_inactive_build(HUMAN, "University") && !university_ok ){
- enable_trigger("Knowledge_check");
- } else if ( num_type(HUMAN, "Scholar") == 0 ){
- enable_trigger("Scholars_check");
- } else if( !find_build(HUMAN, "Stable") && !find_inactive_build(HUMAN, "Stable") && !stable_ok ) {
- enable_trigger("build_stables");
- } else if ( ( num_cities(HUMAN) == 2 ) && !expand_ok) {
- enable_trigger("Expansion_check2");
- } else if( !find_build(HUMAN, "Siege Factory") && !find_inactive_build(HUMAN, "Siege Factory") && !siege_ok ) {
- enable_trigger("Build_siege_factory");
- } else if ( ( num_cities(HUMAN) == 3 ) && !attack_ok ) {
- enable_trigger("Prepare_attack");
- } else if ( !deadscout && is_idle(HUMAN, scout_ID) ){
- enable_trigger("Scout_check");
- }
-
- set_timer("Advice_timer", advice_time);
- enable_trigger("Master_check");
- }
-
- trigger Citizen_check(){
- set_timer( "Advice_timer", advice_time );
- play_sound("citizen.wav");
- // WAV: Your first priority in the Ancient Age is to create citizens and gather resources. Click on your capitol
- // and click create citizen to add to your workforce. Put as many of your people to work gathering food and
- // wood as you can.
- print_game_msg($S("Create citizens to gather more resources."));
- citizen_ok = true;
- }
-
- trigger Timber_check( ){
- set_timer( "Advice_timer", advice_time );
- play_sound("timber.wav");
- // WAV: The woodcutter's camp isn't full. If you haven't yet reached your commerce cap, add more citizens to the
- // camp to gather as much wood as possible.
- add_objective($S("Place five citizens in the woodcutter's camp."), "Wood", "timber.wav");
- have_objective = true;
- enable_trigger("Got_wood");
- }
-
- trigger Got_wood( num_workers_at_building(HUMAN, camp_ID) >= 5 ){
- objective_complete("Wood");
- have_objective = false;
- timber_filled = true;
- timber_ok = true;
- }
-
- trigger Full_camp( num_workers_at_building(HUMAN, camp_ID) > 4 ){
- timber_ok = true;
- }
-
- trigger Food_check( ){
- set_timer( "Advice_timer", advice_time );
- play_sound("food.wav");
- // WAV: Each city can support a maximum of 5 farms. Go ahead and build as many as you can.
- add_objective($S("Build five farms."), "Farms", "food.wav");
- have_objective = true;
- enable_trigger("Got_farms");
- }
-
- trigger Got_farms( num_type(HUMAN, "Farm") == 5 ){
- objective_complete("Farms");
- have_objective = false;
- food_ok = true;
- }
-
- trigger Five_farms( num_type(HUMAN, "Farm") > 4 ){
- food_ok = true;
- }
-
- trigger Age_check(){
- set_timer( "Advice_timer", advice_time );
- play_sound("classical.wav");
- // WAV: By now, you should be thinking about advancing your nation to the Classical Age. As long as you've
- // researched enough technologies at the library and you have sufficient food, the Classical Age will be
- // available to you.
- add_objective($S("Advance your nation to the Classical Age"), "Classic", "classical.wav");
- enable_trigger("Second_classical_check");
- have_objective = true;
- }
-
- trigger Wealth_check(){
- set_timer( "Advice_timer", advice_time );
- play_sound("wealth.wav");
- // WAV: Now would be a good time to begin collecting wealth for your nation. Create markets and caravans to
- // set up trade between your cities.
- if( !have_tech(HUMAN, "Barter") && !researching_tech(HUMAN, "Barter") ){
- enable_trigger("Get_barter");
- }
- else{
- enable_trigger("Build_market");
- }
- }
-
- trigger Get_barter( sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("barter.wav");
- // WAV: First you'll need to research "Barter" on the green commerce track at the library.
- add_objective($S("Research\"Barter\" at the library."), "Barter_done", "barter.wav");
- have_objective = true;
- enable_trigger("Got_barter");
- }
-
- trigger Got_barter( have_tech(HUMAN, "Barter") ){
- objective_complete("Barter_done");
- enable_trigger("Build_market");
- }
-
- trigger Build_market( sound_finished() ){
- set_timer( "Advice_timer", advice_time);
- play_sound("now_market.wav");
- // WAV: You're ready to build a market.
- add_objective($S("Build a market."), "Market", "wealth.wav");
- have_objective = true;
- enable_trigger("Market_built");
- }
-
- trigger Market_built( find_build(HUMAN, "Market") ){
- objective_complete("Market");
- set_timer( "Advice_timer", advice_time );
- play_sound("caravan.wav");
- // WAV: To increase your wealth income, create caravans at your market.
- add_objective($S("Create a caravan"), "Caravan", "caravan.wav");
- have_objective = true;
- enable_trigger("Caravan_made");
- }
-
- trigger Caravan_made( find_unit(HUMAN, "Caravan") ){
- objective_complete("Caravan");
- have_objective = false;
- wealth_ok = true;
- }
-
- trigger Resource_warn1( resource_warning() && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("resource_warn1.wav");
- // WAV: If you're running low on resources, you can always build Farms to gather Food and
- // fill up Woodcutter's Camps with citizens to gather Timber. To generate wealth, use
- // markets and caravans to create trade routes between cities, or research Taxation at
- // a temple.
- }
-
- trigger Reset_library_check( object_selected(HUMAN, library_ID) ){
- set_timer( "Library_timer", library_time );
- enable_trigger("Reset_library_check");
- }
-
- trigger Library_check ( timer_expired("Library_timer") && sound_finished() ){
- play_sound("use_library.wav");
- // WAV: Don't forget to conduct research at your library! Researching new technologies is vital to
- // building your nation and advancing your people through the ages.
- print_game_msg($S("Conduct research at the Library."));
- disable_trigger("Reset_library_check");
- stop_timer("Library_timer");
- }
-
- trigger Library_killed( building_destroyed(HUMAN, library_ID) ){
- play_sound("new_library.wav");
- // WAV: Your library has been destroyed! The research conducted there is crucial to the
- // development of your nation. Build a new library as soon as you can!
- print_game_msg($S("Build a new Library."));
- }
-
- trigger Temple_check( sound_finished() ){
- play_sound("build_temple.wav");
- // WAV: Try building a temple in your capital to increase its defenses and expand your
- // borders.
- if ( !have_tech(HUMAN, "Written Word") && !researching_tech(HUMAN, "Written Word") ){
- enable_trigger("Get_written_word");
- } else{
- enable_trigger("Build_temple");
- }
- }
-
- trigger Get_written_word( sound_finished() ){
- have_objective = true;
- set_timer("Advice_timer", advice_time);
- play_sound("written_word.wav");
- // WAV: First you'll need to research "Written Word" on the yellow science track at the library.
- // Then your citizens will be able to build a temple.
- add_objective($S("Research \"Written Word\" at the Library."), "Written_word", "written_word.wav");
- enable_trigger("Got_written_word");
- }
-
- trigger Got_written_word( have_tech(HUMAN, "Written Word") ){
- objective_complete("Written_word");
- set_timer("Advice_timer", advice_time);
- enable_trigger("Build_temple");
- }
-
- trigger Build_temple( sound_finished() ){
- have_objective = true;
- add_objective($S("Build a temple."), "Temple", "build_temple.wav");
- enable_trigger("Temple_built");
- }
-
- trigger Temple_built( find_build(HUMAN, "Temple") ){
- objective_complete("Temple");
- have_objective = false;
- temple_ok = true;
- set_timer("Advice_timer", advice_time);
- play_sound("taxation.wav");
- // WAV: Now that you've built a temple, you can research "taxation" upgrades to increase
- // your wealth. Taxation is tied to the percentage of the map that you control. The
- // more territory you control, the more wealth you will receive.
- }
-
- trigger Expansion_check(){
- play_sound("expand.wav");
- // WAV: Building new cities to expand your national borders is key to the survival of your nation.
- if ( !have_tech(HUMAN, "City State") && !researching_tech(HUMAN, "City State") ){
- enable_trigger("Get_city_state");
- } else{
- enable_trigger("Build_city");
- }
- }
-
- trigger Get_city_state( sound_finished() ){
- have_objective = true;
- set_timer( "Advice_timer", advice_time);
- play_sound("civics.wav");
- // WAV: Research "City State" on the blue civics track in the library. Then, have one of your
- // citizens start building a new city.
- add_objective($S("Research \"City State\" at the Library."), "City_State", "civics.wav");
- enable_trigger("Got_city_state");
- }
-
- trigger Got_city_state( have_tech(HUMAN, "City State") ){
- objective_complete("City_State");
- set_timer( "Advice_timer", advice_time);
- enable_trigger("Build_city");
- }
-
- trigger Build_city( sound_finished() ){
- have_objective = true;
- play_sound("build_city.wav");
- // WAV: You're ready to begin construction on a new city.
- add_objective($S("Build a new city."), "New_city", "build_city.wav");
- enable_trigger("City_built");
- }
-
- trigger City_built( num_cities(HUMAN) == 2 ){
- objective_complete("New_city");
- have_objective = false;
- }
-
- trigger Develop_check( sound_finished() ){
- if ( num_type(HUMAN, "Farm") < 7 && num_type(HUMAN, "Woodcutter's Camp") < 3){
- play_sound("develop.wav");
- // WAV: Don't forget to put people to work at your new city. You can now support another 5
- // farms, and find new sources of timber nearby.
- }
- develop_ok = true;
- }
-
- trigger expansion_check2() {
- play_sound("expand2.wav");
- // WAV: We have two cities currently, but we can expand our nation and collect more resources if we build more.
- if( !have_tech(HUMAN, "Empire") && !researching_tech(HUMAN, "Empire") ) {
- enable_trigger("get_empire");
- } else {
- enable_trigger("build_city2");
- }
- }
-
- trigger get_empire( sound_finished() ) {
- set_timer( "Advice_timer", advice_time );
- // WAV: Research the blue civics track in the library. You can build
- // one additional city for each civics technology you've researched.
- add_objective($S("Research Empire at the Library."), "empire", "empire.wav" );
- have_objective = true;
- play_objective_sound("empire");
- enable_trigger("got_empire");
- }
-
- trigger got_empire( have_tech( HUMAN, "Empire" ) ) {
- objective_complete("empire");
- play_sound("got_empire.wav");
- // WAV: Now that we have researched a blue civics technology, we can build another city.
- enable_trigger("build_city2");
- }
-
- trigger build_city2( sound_finished() ) {
- have_objective = true;
- add_objective($S("Build a city near your borders."), "build_city2", "build_city2.wav");
- play_objective_sound("build_city2");
- // Build a new city. Place it near the edge of your territory so that you will expand your borders and
- // control a larger portion of the map.
- enable_trigger("city_built2");
- }
-
- trigger city_built2( num_cities(HUMAN) > 2 ) {
- objective_complete("build_city2");
- play_sound("built_city2.wav");
- // WAV: Good job. You have built another city and expanded your territory. Remember to build more
- // caravans to take advantage of the new trade routes that have opened up.
- have_objective = false;
- expand_ok = true;
- }
-
- trigger Remind_of_goals( sound_finished() ) {
- play_sound("Remind_of_goals.wav");
- // WAV: There are a number of paths to victory in Rise of Nations.
- // In this scenario, there are two common ways to win.
- // The first way involves having 70% or more of the territory under your control.
- // You can check your current percentage in the bottom right corner of the screen.
- // The second way to win involves capturing the enemy capital.
- // In order to do this, build units at the barracks, stable, and siege factory and attack the enemy city.
- //
- }
-
- trigger Got_capital( city_captured_by(COMPUTER, HUMAN, enemy_cap_id) && sound_finished() ){
- play_sound("capital_timer.wav");
- // WAV: You have captured the enemy's capital city! If he cannot retake it before the timer
- // in the upper right expires, he will be defeated! Hold on to the enemy's capital city
- // for a little while longer to achieve victory.
- }
-
- trigger Territory_win( (get_territory(HUMAN) >= 70) && sound_finished() ){
- play_sound("territory_timer.wav");
- // WAV: You now control at least 70% of the map! If your opponent cannot get more land
- // before the timer in the upper right expires, he will be defeated. Hold on to at
- // least 70% of the map for a little while longer to achieve victory!
- }
-
- trigger Prepare_attack(){
- play_sound("prepare_attack.wav");
- // WAV: By now your nation should be advanced enough for you to concentrate on building a stronger military
- // force. See if you can build an attack force powerful enough to seize one of your enemy's cities.
- if ( !find_build(HUMAN, "Barracks") ){
- enable_trigger("Rebuild_barracks");
- } else{
- enable_trigger("Make_foot");
- }
- if ( !find_build(HUMAN, "Stable") ){
- enable_trigger("Rebuild_stable");
- } else{
- enable_trigger("Make_mounted");
- }
- if ( !find_build(HUMAN, "Siege Factory") ){
- enable_trigger("Rebuild_siege");
- } else{
- enable_trigger("Make_siege");
- }
- enable_trigger("Check_troops");
- disable_trigger("First_city_captured");
- attack_ok = true;
- }
-
- trigger Rebuild_barracks( ){
- add_objective($S("Rebuild your barracks."), "new_barracks", "build_troops.wav");
- enable_trigger("New_barracks");
- }
-
- trigger New_barracks( find_build(HUMAN, "Barracks") ){
- objective_complete("new_barracks");
- enable_trigger("Make_foot");
- }
-
- trigger Make_foot( num_unit_category(HUMAN, "Foot") < 8 && sound_finished() ){
- play_sound("make_foot.wav");
- add_objective($S("Train 8 troops at your barracks."), "make_foot", "make_foot.wav");
- have_objective = true;
- // WAV: Train 8 troops of your choice at the barracks. Remember, each unit has its own strengths and
- // weaknesses, so try to train a variety of different types.
- enable_trigger("Foot_made");
- }
-
- trigger Rebuild_stable( ){
- add_objective($S("Rebuild your stable."), "new_stable", "build_stable.wav");
- enable_trigger("New_stable");
- }
-
- trigger New_stable( find_build(HUMAN, "Stable") ){
- objective_complete("new_stable");
- enable_trigger("Make_mounted");
- }
-
- trigger Make_mounted( num_unit_category(HUMAN, "Mounted") < 4 && sound_finished() ){
- play_sound("make_mounted.wav");
- add_objective($S("Train 4 troops at your stables."), "make_mounted", "make_mounted.wav");
- have_objective = true;
- // WAV: Train 4 mounted troops at your stables.
- enable_trigger("Mounted_made");
- }
-
- trigger Rebuild_siege( ){
- add_objective($S("Rebuild your siege factory."), "new_siege", "build_siege_factory.wav");
- enable_trigger("New_siege");
- }
-
- trigger New_siege( find_build(HUMAN, "Siege Factory") ){
- objective_complete("new_siege");
- enable_trigger("Make_siege");
- }
-
- trigger Make_siege( num_unit_category(HUMAN, "Artillery") < 3 && sound_finished() ){
- play_sound("make_siege.wav");
- add_objective($S("Build 3 siege weapons at your siege factory."), "make_siege", "make_siege.wav");
- have_objective = true;
- // WAV: Build 3 siege weapons at your siege factory.
- enable_trigger("Siege_made");
- }
-
- trigger Check_troops( ){
- if ( num_unit_category(HUMAN, "Foot") >= 8 ){
- if ( num_unit_category(HUMAN, "Mounted") >= 4 ){
- if ( num_unit_category(HUMAN, "Artillery") >= 3 ){
- enable_trigger("Ready_to_attack");
- }
- else{
- enable_trigger("Check_troops");
- }
- }
- else{
- enable_trigger("Check_troops");
- }
- }
- else{
- enable_trigger("Check_troops");
- }
- }
-
- trigger Foot_made( num_unit_category(HUMAN, "Foot") >= 8 ){
- objective_complete("make_foot");
- foot = true;
- }
-
- trigger Mounted_made( num_unit_category(HUMAN, "Mounted") >= 4 ){
- objective_complete("make_mounted");
- mounted = true;
- }
-
- trigger Siege_made( num_unit_category(HUMAN, "Artillery") >= 3 ){
- objective_complete("make_siege");
- siege = true;
- }
-
- trigger Ready_to_attack( ){
- play_sound("ready_attack.wav");
- add_objective($S("Capture an enemy city!"), "capture_city", "ready_attack.wav");
- //enable_trigger("Near_enemy_city");
- enable_trigger("Captured_city");
- // WAV: Your army is prepared to march into enemy territory and take a city in your nation's name!
- // If your scout has not located any enemy cities, have him hunt around until he finds one.
- // Marching blindly into your enemy's nation is not a good strategy.
- }
-
- trigger First_city_captured( city_captured_by(COMPUTER, HUMAN, "") ){
- play_sound("captured_city.wav");
- // WAV: Excellent work! You have captured an enemy city an will begin assimilating it into
- // your nation!
- enable_trigger("Remind_of_goals");
- }
-
- trigger Captured_city ( city_captured_by(COMPUTER, HUMAN, "") ){
- play_sound("captured_city.wav");
- objective_complete("capture_city");
- enable_trigger("Remind_of_goals");
- // WAV: Excellent work! You have captured an enemy city an will begin assimilating it into
- // your nation!
- }
-
- trigger Kill_early_scout( timer_expired("early_scout_timer") ){
- stop_timer("early_scout_timer");
- disable_trigger("Early_scout");
- }
-
- trigger Early_scout( object_selected(HUMAN, scout_ID) ){
- disable_trigger("Scout_selected");
- }
-
- trigger Dead_scout( unit_killed(HUMAN, scout_ID) ){
- deadscout = true;
- disable_trigger("Scout_check");
- disable_trigger("Scout_selected");
- }
-
- trigger Scout_check( sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("bored_scout.wav");
- // WAV: Remember to explore! Your scout can uncover rare resources and locate the enemy's position.
- ping_object(1, 1, 1, scout_ID);
- print_game_msg($S("Use your scout to explore new territory."));
- }
-
- ///////////////////// UNIT DEFINITIONS ////////////////////////////
-
- trigger Scout_selected( object_selected(HUMAN, scout_ID) && sound_finished() ){
-
- play_sound("scout_selected.wav");
-
- // WAV: This is your scout. Use him to discover rare resources or locate the enemy position. Scouts
- // are very fast and can see farther than most units, but cannot attack. You can move
- // your scout around the map manually, or click on the "auto-explore" button to have him explore
- // on his own.
- }
-
- trigger Have_general( find_unit(HUMAN, "general") ){
- general_ID = find_unit(HUMAN, "general");
- enable_trigger("General_selected");
- }
-
- trigger General_selected( object_selected(HUMAN, general_ID) && sound_finished() ){
- play_sound("general_selected.wav");
- // WAV: This is a general. Keep him near your troops to have them fight more efficiently. If he has
- // enough "craft", represented by the blue line above him, he can use special abilities like forced
- // march and entrenchment. Read more about these abilities by selecting your general and rolling the
- // mouse over the buttons in the lower left panel.
- }
-
- trigger Have_spy( find_unit(HUMAN, "spy") ){
- spy_ID = find_unit(HUMAN, "spy");
- enable_trigger("Spy_selected");
- }
-
- trigger Spy_selected( object_selected(HUMAN, spy_ID) && sound_finished() ){
- play_sound("spy_selected.wav");
- // WAV: This is a spy. When not moving, she's invisible to most enemies. If she has enough "craft",
- // represented by the blue line above her, she can use special abilities like bribing enemy troops
- // and stealing from cities. Read more about these abilities by selecting your spy and rolling the
- // mouse over the buttons in the lower left panel.");
- }
-
- trigger Have_merchant( find_unit(HUMAN, "merchant") ){
- merchant_ID = find_unit(HUMAN, "merchant");
- enable_trigger("merchant_selected");
- }
-
- trigger Merchant_selected( object_selected(HUMAN, merchant_ID) && sound_finished() ){
- play_sound("merchant_selected.wav");
- // WAV: This is a merchant. Use merchants to take advantage of the rare resources scattered around the map.
- // These resources provide a number of benefits for your nation. To enjoy these benefits, simply select
- // your merchant and then right-click a rare resource to have him set-up shop.");
- }
-
-
-
-
- if (!rare_resource_discussed && get_resource_at_mouse()) {
- if (!rare_resource_timer_set) {
- set_timer("resource_timer", 2);
- rare_resource_timer_set = true;
- }
-
- if (timer_expired("resource_timer")) {
- rare_resource_discussed = true;
- play_sound("resource_selected.wav");
- // WAV: This is a rare resource. Rare resources offer a wide variety of benefits to
- // your nation. By placing the mouse cursor over a resource, you can see what specific
- // bonuses it will provide. To take advantage of this resource, first create a merchant
- // at your market. Then, select your merchant and right-click on the rare resource.
- }
- } else {
- stop_timer("resource_timer");
- rare_resource_timer_set = false;
- }
-
- trigger Have_wagon( find_unit(HUMAN, "supply wagon") ){
- wagon_ID = find_unit(HUMAN, "supply wagon");
- enable_trigger("Wagon_selected");
- }
-
- trigger Wagon_selected( object_selected(HUMAN, wagon_ID) && sound_finished() ){
- play_sound("wagon_selected.wav");
- // WAV: This is a supply wagon. It will help your siege weapons fire more rapidly,
- // and prevent your units from being damaged by attrition.
- }
-
- trigger research_art_of_war( sound_finished() ) {
- // WAV: We need to build units to defend our nation and attack the enemy. In order to
- // build a barracks, we need to research the first red military technology, The Art of War
- // at the library.
- have_objective = true;
- add_objective($S( "Research The Art of War at your library."), "art_of_war", "art_of_war.wav");
- play_objective_sound("art_of_war");
- enable_trigger("have_art_of_war");
- }
-
- trigger have_art_of_war( have_tech( HUMAN, "The Art of War") ) {
- objective_complete("art_of_war");
- have_objective = false;
- set_timer("Advice_timer", advice_time);
- }
-
- trigger Build_barracks( sound_finished() ){
- play_sound("build_troops.wav");
- // WAV: Now that you have studied the Art of War, you can build a barracks and begin training troops
- // to protect your nation.
- have_objective = true;
- add_objective($S("Build a barracks."), "Barracks", "build_troops.wav");
- play_objective_sound("Barracks");
- enable_trigger("Barracks_built");
- }
-
- trigger Barracks_built( find_build(HUMAN, "Barracks") ){
- objective_complete("Barracks");
- have_objective = false;
- set_timer("Advice_timer", advice_time);
- barracks_ok = true;
- }
-
- trigger check_military( num_military_units( HUMAN ) >= 1 ) {
- has_built_military_units = true;
- }
-
- trigger build_military_units( sound_finished() ) {
- // WAV: You need to build military units at your barracks to defend your nation.
- play_sound("build_military_units.wav");
- }
-
- trigger build_stables( sound_finished() ) {
- enable_trigger("construct_stables");
- //if( have_tech( HUMAN, "Mercenaries" ) ) {
- // enable_trigger("construct_stables");
- //} else {
- // enable_trigger("research_mercenaries");
- //}
- }
-
- trigger research_mercenaries( sound_finished() ) {
- have_objective = true;
- add_objective( $S("Research the Mercenaries at the library."), "research_mercenaries", "research_mercenaries.wav");
- play_objective_sound("research_mercenaries");
- // WAV: We need to expand our army and develop horse units. Before we can build a stables, we need to research the second
- // red military technology, Mercenaries, at the library.
- enable_trigger("construct_stables");
- }
-
- trigger construct_stables( sound_finished() ) {
- have_objective = true;
- objective_complete("research_mercenaries");
-
- add_objective($S( "Build a stable."), "build_stable", "build_stable.wav");
- play_objective_sound("build_stable");
- // WAV: Build a stable so we can start building horse units to expand our army.
- enable_trigger( "stable_built");
- }
-
- trigger stable_built( find_build( HUMAN, "Stable" ) ) {
- objective_complete("build_stable");
- stable_ok = true;
- play_sound("built_stable.wav");
- // WAV: We now have a stable to build horse units. Horse units are fast, tough units
- // that are excellent at destroying siege units.
- have_objective = false;
- }
-
- trigger Build_siege_factory( sound_finished() ) {
- have_objective = true;
-
- add_objective($S("Build a siege factory"), "build_siege_factory", "build_siege_factory.wav");
- play_objective_sound("build_siege_factory");
- // WAV: To be able to effectively attack and capture enemy cities, we need to build a
- // siege factory to build siege units like catapults.
-
- enable_trigger("siege_factory_built");
- }
-
- trigger siege_factory_built( find_build( HUMAN, "Siege Factory") ) {
- objective_complete("build_siege_factory");
- play_sound("siege_factory_built.wav");
- // WAV: Units built at siege factories, like catapults, are lethal
- // against buildings.
- have_objective = false;
- siege_ok = true;
- }
-
-
- trigger Check_for_commcap( !commerce_cap_warning(HUMAN) ){
- enable_trigger("Comm_cap_hit");
- }
-
- trigger Comm_cap_hit( commerce_cap_warning(HUMAN) && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("comm_cap.wav");
- // WAV: Looks like you've hit your commerce cap. That means some of the resources you're gathering are
- // going to waste. Research the green commerce track at the library to increase the amount of
- // resources you can gather.
- print_game_msg($S("Research COMMERCE (green track) at the library."));
- }
-
- trigger Check_for_popcap( !pop_cap_warning(HUMAN) ){
- enable_trigger("Pop_cap_hit");
- }
-
- trigger Pop_cap_hit( pop_cap_warning(HUMAN) && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("pop_cap.wav");
- // WAV: You can't support any more people. You'll have to study the red military track at the library
- // to increase your population limit.
- print_game_msg($S("Research MILITARY (red track) at the library."));
- }
-
- trigger Invasion_check((was_city_attacked(HUMAN, "", -1) || was_city_raided(HUMAN, "", -1)) && sound_finished() ){
- play_sound("invasion.wav");
- // WAV: Danger! The enemy has invaded your territory! You must drive them away as quickly as possible.
- set_timer("Alarm_timer", 20);
- //enable_trigger("Military_emergency");
- enable_trigger("Save_citizens");
- enable_trigger("Capitol_health_check");
- }
-
- /*
- trigger Military_emergency( num_military_buildings(HUMAN) == 0 && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("defenseless.wav");
- // WAV: You don't have any military buildings! Quickly build a barracks or a tower or whatever is
- // available to you to repel this attack!
- print_game_msg($S("Build a barracks and defend yourself!"));
- }
- */
-
- trigger Save_citizens( timer_expired("Alarm_timer") && !city_alarm_sounded(HUMAN, "") && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("sound_alarm.wav");
- // WAV: Don't forget: You can protect your citizens by sounding the alarm at your city.
- print_game_msg($S("Don't forget, you can protect your citizens by sounding the alarm at your city!"));
- enable_trigger("Alarm_sounded");
- stop_timer("Alarm_timer");
- }
-
- trigger Alarm_sounded( city_alarm_sounded(HUMAN, "") && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("citizens_safe.wav");
- // WAV: Good. Now your citizens are safe unless the enemy takes your city.
- print_game_msg($S("Good. Now your citizens are safe."));
- }
-
- trigger Capitol_health_check( object_health(HUMAN, capitol_ID) < capitol_health ){
- set_object_health( HUMAN, capitol_ID, capitol_health );
- enable_trigger("Capitol_health_check");
- }
-
- trigger Already_zoomed( is_zoomed_out() ){
- knows_zoom = true;
- }
-
- trigger Zoom_reminder( !knows_zoom && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("zoom_reminder.wav");
- // WAV: If you want to see more of the map, you can always zoom in and out by using the
- // scroll-wheel on your mouse, or pressing PageUp and PageDown on the keyboard.
- knows_zoom = true;
- }
-
- trigger Classical_age( have_tech(HUMAN, "Classical Age") ){
- enable_trigger("Military_check");
- //enable_trigger("Metal_check");
- enable_trigger("Medieval_age");
- enable_trigger("Resource_warn2");
- disable_trigger("Resource_warn1");
- }
-
- trigger Second_classical_check( have_tech(HUMAN, "Classical Age") ){
- objective_complete("Classic");
- have_objective = false;
- }
-
- trigger Military_check( !have_tech(HUMAN, "The Art of War") && !researching_tech(HUMAN, "The Art of War") && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("military.wav");
- // WAV: Congratulations on advancing to the Classical Age. Start thinking about building a
- // military to protect your bigger and better nation. Research "The Art of War" on the
- // red military track at the library.
- print_game_msg($S("Research MILITARY (red track) at the library."));
- }
-
- trigger Metal_check(){
- set_timer( "Advice_timer", advice_time );
- play_sound("metal.wav");
- // WAV: One of the new resources you can gather in the Classical Age is metal. Build a mine
- // and begin gathering this important resource.
- add_objective($S("Build a mine."), "Mine", "metal.wav");
- have_objective = true;
- enable_trigger("Mine_built");
- }
-
- trigger Mine_built( find_build(HUMAN, "Mine") ){
- objective_complete("Mine");
- have_objective = false;
- mine_ok = true;
- play_sound("miners.wav");
- // WAV: Well done. Assign more citizens to work in the mine to increase your output of metal.
- }
-
- trigger Knowledge_check( ){
- play_sound("knowledge.wav");
- // WAV: You haven't built a university yet. Knowledge may be the most valuable resource
- // available to you, so set up a university and start gathering knowledge.
- add_objective($S("Build a university"), "University", "knowledge.wav");
- have_objective = true;
- enable_trigger("University_built");
- }
-
- trigger University_built( find_build(HUMAN, "University") ){
- objective_complete("University");
- have_objective = false;
- set_timer("Advice_timer", advice_time);
- university_ok = true;
- }
-
- trigger Scholars_check( ){
- play_sound("scholars.wav");
- // WAV: An empty university isn't a great source of knowledge. Click on a university and
- // click "create scholars" to gather more knowledge. Create at least four scholars.
- add_objective( $S("Create 4 scholars."), "Smart_guys", "scholars.wav" );
- have_objective = true;
- enable_trigger("Scholars_made");
- }
-
- trigger Scholars_made( num_type(HUMAN, "Scholar") > 3 ){
- objective_complete("Smart_guys");
- have_objective = false;
- set_timer("Advice_timer", advice_time);
- }
-
- trigger Resource_warn2( resource_warning() && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("resource_warn2.wav");
- // WAV: Now that you're in the Classical Age, new methods of gathering resources are
- // available to you. Remember: build mines to gather metal and universities to
- // generate knowledge. If you don't have a lot of wealth or food, building new cities
- // opens up new trade routes and allows you to build more farms.
- }
-
- trigger Medieval_age( have_tech(HUMAN, "Medieval Age") ){
- disable_trigger("Resource_warn2");
- enable_trigger("Resource_warn3");
- }
-
- trigger Resource_warn3( resource_warning() && sound_finished() ){
- set_timer( "Advice_timer", advice_time );
- play_sound("resource_warn3.wav");
- // WAV: By now you know how to gather all of your resources. If you run low on one, concentrate
- // on increasing the gather rate of that resource. Remember to fill you mines and
- // universities, and create a caravan for every trade route available. If you've researched
- // at least two of the yellow science tags at the library, you can build granaries and lumber
- // mills to increase your food and wood production.
- }
- }
-
-
-