home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2003 January / maximum-cd-2003-01.iso / Software / Games / AoM / mtrial.exe / AOM / AI / SCN15P2.XS < prev    next >
Encoding:
Text File  |  2002-08-15  |  4.2 KB  |  130 lines

  1. //==============================================================================
  2. // Scn15p2: AI Scenario Script for scenario 15 player 2
  3. //==============================================================================
  4. /*
  5.    AI owner:  Mike Kidd
  6.    Scenario owner: Jeff Brown
  7.  
  8.    Overview:
  9.    This player controls "Kemset's Army", which is the ominous, unstoppable force
  10.    that embodies the time limit for the human player.  (The HP must accomplish
  11.    his/her objective before Kemset's army returns.)
  12.  
  13.    Units are spawned into the defend plan (via trigger) early in the scenario, and
  14.    the HP can see them destroying the first of three towns on the perimeter of the
  15.    map.  Over time, the army moves on, under the control of the move() AIFunc.  
  16.  
  17.    Finally, Kemset's army reaches the fortress.   A trigger teleports some specific 
  18.    units into Kemset's army just before this, and if those units reach the fortress,
  19.    the loss condition is triggered.
  20. */
  21.  
  22. include "scn lib.xs";
  23.  
  24.  
  25.  
  26. // Cinematic blocks
  27. const string cbTown1 = "3260";
  28. const string cbTown12 = "3266";
  29. const string cbTown2 = "3261";
  30. const string cbTown23 = "3267";
  31. const string cbTown3 = "3262";
  32. const string cbCourtyard = "3263";     // Inside player 3's town
  33. int defendPlan = -1;
  34.  
  35.  
  36. void wakeup(int ignore = 1)
  37. {
  38.    aiEcho("Wakeup running at "+timeString());
  39.    defendPlan =aiPlanCreate("Defend Plan", cPlanDefend);
  40.    if (defendPlan >= 0)
  41.    {
  42.       aiPlanAddUnitType(defendPlan, cUnitTypeMilitary, 0, 200, 200);    // All unassigned mil units
  43.       aiPlanSetDesiredPriority(defendPlan, 10);                       // Way low, below scouting and attack
  44.       aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbTown1));
  45.       aiPlanSetVariableFloat(defendPlan, cDefendPlanEngageRange, 0, 20.0);
  46.       aiPlanSetVariableBool(defendPlan, cDefendPlanPatrol, 0, false);
  47.       aiPlanSetVariableFloat(defendPlan, cDefendPlanGatherDistance, 0, 20.0);
  48.       aiPlanSetInitialPosition(defendPlan, kbGetBlockPosition(cbTown1));
  49.       aiPlanSetUnitStance(defendPlan, cUnitStanceDefensive);
  50.  
  51.       aiPlanSetVariableInt(defendPlan, cDefendPlanRefreshFrequency, 0, 5);
  52.       aiPlanSetNumberVariableValues(defendPlan, cDefendPlanAttackTypeID, 2, true);
  53.       aiPlanSetVariableInt(defendPlan, cDefendPlanAttackTypeID, 0, cUnitTypeUnit);
  54.       aiPlanSetVariableInt(defendPlan, cDefendPlanAttackTypeID, 1, cUnitTypeBuilding);
  55.  
  56.       aiPlanSetActive(defendPlan); 
  57.       aiEcho("Creating defend plan");
  58.    }
  59. }
  60.  
  61. void move(int ingore=-1)
  62. {
  63.    static int town=1;
  64.  
  65.    switch(town)
  66.    {
  67.    case 1:
  68.       {  // Move between towns 1 and 2
  69.          aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbTown12));
  70.          town = town+1;
  71.          aiEcho("Moving between towns 1 and 2.");
  72.          break;
  73.       }
  74.    case 2:
  75.       {  // Move to town 2
  76.          aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbTown2));
  77.          town = town+1;
  78.          aiEcho("Moving to city 2.");
  79.          break;
  80.       }
  81.    case 3:
  82.       {  // Move between towns 2 and 3
  83.          aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbTown23));
  84.          town = town+1;
  85.          aiEcho("Moving between towns 2 and 3.");
  86.          break;
  87.       }
  88.    case 4:
  89.       {  // Move to town 3
  90.          aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbTown3));
  91.          town = town+1;
  92.          aiEcho("Moving to city 3.");
  93.          break;
  94.       }
  95.    case 5:
  96.       {  // Move to player 2's town, attack anything
  97.          aiPlanSetVariableVector(defendPlan, cDefendPlanDefendPoint, 0, kbGetBlockPosition(cbCourtyard));
  98.          aiSetAttackResponseDistance(5.0);
  99.          aiPlanSetVariableFloat(defendPlan, cDefendPlanEngageRange, 0, 15.0);
  100.          aiPlanSetUnitStance(defendPlan, cUnitStanceDefensive);
  101.          aiEcho("Moving to main fortress.");
  102.          town = town+1;
  103.          break;
  104.       }
  105.    }
  106. }
  107.  
  108.  
  109.  
  110. void main()
  111. {
  112.    aiEcho("Starting Scn15p2.xs");
  113.    aiRandSetSeed();
  114.    kbSetTownLocation(kbGetBlockPosition(cbTown1));
  115.    //Calculate some areas.
  116.    kbAreaCalculate(1200.0);
  117.  
  118.    aiSetAttackResponseDistance(10.0);
  119.  
  120.  
  121.  
  122. }
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.