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

  1. //==============================================================================
  2. // Scn05p2: AI Scenario Script for p2
  3. //==============================================================================
  4. /*
  5.    AI owner:  Dave Leary
  6.    Scenario owner: Dave Leary
  7. */
  8. //==============================================================================
  9. // Set Town Location
  10. //==============================================================================
  11. void setTownLocation(void)
  12. {
  13.    //Look for the "Town Location" marker.
  14.    kbSetTownLocation(kbGetBlockPosition("2443"));
  15. }
  16.  
  17. //==============================================================================
  18. // miscStartup
  19. //==============================================================================
  20. void miscStartup(void)
  21. {
  22.     // Difficulty Level check.
  23.     int difflevel=-1;        
  24.     difflevel=aiGetWorldDifficulty();
  25.  
  26.     //Startup message(s).
  27.    aiEcho("");
  28.    aiEcho("");
  29.    aiEcho("Scn05P2 AI Start, filename='"+cFilename+"'.");
  30.    //Spit out the map size.
  31.    aiEcho("  Map size is ("+kbGetMapXSize()+", "+kbGetMapZSize()+").");
  32.    //Cheat like a bastard.  Once only, though.
  33.    kbLookAtAllUnitsOnMap();
  34.    //Calculate some areas.
  35.    kbAreaCalculate(1200.0);
  36.    //Set our town location.
  37.    setTownLocation();
  38.     //Reset random seed
  39.     aiRandSetSeed();
  40.    //Allocate all resources to the root escrow.
  41.    kbEscrowAllocateCurrentResources();
  42. }
  43.  
  44. //=====================================================================================
  45. // When Kamos arrives on his little hilltop, create a defend plan that keeps him up
  46. // there in one spot.
  47. //=====================================================================================
  48. void kamosArrives(int scriptCall = -1)
  49. {
  50.     vector defendLoc=kbGetBlockPosition("2443");
  51.  
  52.     int defendPlanID=aiPlanCreate("Kamos Defense", cPlanDefend);
  53.    if (defendPlanID >= 0)
  54.    {
  55.       //Add the unit(s).
  56.       aiPlanAddUnitType(defendPlanID, cUnitTypeKamos, 1, 1, 1);
  57.         
  58.       //Setup the vars.
  59.       aiPlanSetDesiredPriority(defendPlanID, 90);
  60.       aiPlanSetVariableVector(defendPlanID, cDefendPlanDefendPoint, 0, defendLoc);
  61.         aiPlanSetInitialPosition(defendPlanID, defendLoc);
  62.         aiPlanSetVariableFloat(defendPlanID, cDefendPlanGatherDistance, 0, 20.0);
  63.       aiPlanSetVariableFloat(defendPlanID, cDefendPlanEngageRange, 0, 5);
  64.         aiPlanSetUnitStance(defendPlanID, cUnitStanceDefensive);
  65.         aiPlanSetAllowUnderAttackResponse(defendPlanID, false);
  66.       aiPlanSetActive(defendPlanID);
  67.     }
  68. }
  69.  
  70. //==============================================================================
  71. // MAIN
  72. //==============================================================================
  73. void main(void)
  74. {
  75.    //Startup.
  76.    miscStartup();
  77. }
  78.