SHARE
TWEET

AoEHDFertileCrescent

a guest Jan 17th, 2016 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // East India Trading Company - Deccan
  2. // August 06 - PJJ
  3. // Started with Amazonia script
  4.  
  5. include "mercenaries.xs";
  6. include "ypAsianInclude.xs";
  7. include "ypKOTHInclude.xs";
  8.  
  9. // Main entry point for random map script
  10. void main(void)
  11. {
  12.  
  13.   // Text
  14.   // These status text lines are used to manually animate the map generation progress bar
  15.   rmSetStatusText("",0.01);
  16.  
  17.   // determines map orientation - 1 is E/W, 2 is N/S
  18.   int whichVersion = 2;
  19.  
  20.   // version switcher for testing
  21.   // whichVersion = 2;
  22.  
  23.   //Bhakti/Udasi appear on this map
  24.   int subCiv0=-1;
  25.   int subCiv1=-1;
  26.   int subCiv2=-1;
  27.  
  28.   if (rmAllocateSubCivs(3) == true) {
  29.         subCiv0=rmGetCivID("Udasi");
  30.         rmEchoInfo("subCiv0 is Udasi "+subCiv0);
  31.         if (subCiv0 >= 0)
  32.             rmSetSubCiv(0, "Udasi");
  33.  
  34.         subCiv1=rmGetCivID("Bhakti");
  35.         rmEchoInfo("subCiv1 is Bhakti "+subCiv1);
  36.         if (subCiv1 >= 0)
  37.             rmSetSubCiv(1, "Bhakti");
  38.    
  39.     subCiv2=rmGetCivID("Sufi");
  40.         rmEchoInfo("subCiv1 is Sufi "+subCiv2);
  41.         if (subCiv2 >= 0)
  42.             rmSetSubCiv(2, "Sufi");
  43.     }
  44.  
  45.    // Picks the map size
  46.     int playerTiles = 20000;
  47.     if (cNumberNonGaiaPlayers >4)
  48.         playerTiles = 18000;
  49.     if (cNumberNonGaiaPlayers >6)
  50.         playerTiles = 16000;           
  51.  
  52.   int size=2.0*sqrt(cNumberNonGaiaPlayers*playerTiles);
  53.   rmEchoInfo("Map size="+size+"m x "+size+"m");
  54.   rmSetMapSize(size, size);
  55.  
  56.     rmSetWindMagnitude(2);
  57.  
  58.   // Picks a default water height
  59.   rmSetSeaLevel(-3.0);
  60.  
  61.    // Picks default terrain and water
  62.     //  rmSetMapElevationParameters(long type, float minFrequency, long numberOctaves, float persistence, float heightVariation)
  63.     rmSetMapElevationParameters(cElevTurbulence, 0.06, 1, 0.4, 3.0);
  64.   rmSetMapElevationHeightBlend(0.6);
  65.     rmSetMapType("deccan");
  66.     rmSetMapType("grass");
  67.     rmSetMapType("land");
  68.     rmSetWorldCircleConstraint(true);
  69.   rmSetLightingSet("deccan");
  70.  
  71. //day and night cycle
  72.  
  73. rmSetLightingSet("deccan");
  74.  
  75. rmCreateTrigger("night");
  76. rmCreateTrigger("day");
  77.  
  78. rmSwitchToTrigger(rmTriggerID("night"));
  79. rmAddTriggerCondition("Timer");
  80. rmSetTriggerConditionParamFloat("Param1",500);
  81. rmAddTriggerEffect("Set Lighting");
  82. rmSetTriggerEffectParam("SetName","st_petersburg_night");
  83. rmSetTriggerEffectParamFloat("FadeTime",340);
  84. rmAddTriggerEffect("Fire Event");
  85. rmSetTriggerEffectParamInt("EventID",rmTriggerID("day"));
  86. rmSetTriggerPriority(4);
  87. rmSetTriggerActive(true);
  88. rmSetTriggerRunImmediately(false);
  89. rmSetTriggerLoop(false);
  90.  
  91. rmSwitchToTrigger(rmTriggerID("day"));
  92. rmAddTriggerCondition("Timer");
  93. rmSetTriggerConditionParamFloat("Param1",500);
  94. rmAddTriggerEffect("Set Lighting");
  95. rmSetTriggerEffectParam("SetName","deccan");
  96. rmSetTriggerEffectParamFloat("FadeTime",340);
  97. rmAddTriggerEffect("Fire Event");
  98. rmSetTriggerEffectParamInt("EventID",rmTriggerID("night"));
  99. rmSetTriggerPriority(4);
  100. rmSetTriggerActive(false);
  101. rmSetTriggerRunImmediately(false);
  102. rmSetTriggerLoop(false);
  103.  
  104.   // Init map.
  105.   rmSetBaseTerrainMix("deccan_grass_a");
  106.   rmTerrainInitialize("Deccan\ground_grass4_deccan", -2);
  107.  
  108.     chooseMercs();
  109.  
  110.     // Make it rain
  111.   rmSetGlobalRain( 0.3 );
  112.  
  113.   // Define some classes. These are used later for constraints.
  114.   int classPlayer=rmDefineClass("player");
  115.   rmDefineClass("classForest");
  116.   rmDefineClass("importantItem");
  117.   rmDefineClass("socketClass");
  118.   int foodClass = rmDefineClass("FoodClass");
  119.  
  120.   // -------------Define constraints
  121.   // These are used to have objects and areas avoid each other
  122.    
  123.   // Map edge constraints
  124.   int playerEdgeConstraint=rmCreatePieConstraint("player edge of map", 0.5, 0.5, rmXFractionToMeters(0.0), rmXFractionToMeters(0.45), rmDegreesToRadians(0), rmDegreesToRadians(360));
  125.   int resourceEdgeConstraint=rmCreatePieConstraint("resource edge of map", 0.5, 0.5, rmXFractionToMeters(0.0), rmXFractionToMeters(0.48), rmDegreesToRadians(0), rmDegreesToRadians(360));
  126.   int forestMidConstraint=rmCreatePieConstraint("dense middle forests", 0.5, 0.5, rmXFractionToMeters(0.0), rmXFractionToMeters(0.16), rmDegreesToRadians(0), rmDegreesToRadians(360));
  127.   int edgeForestConstraint=rmCreatePieConstraint("Ring for sparse forests near edge of map", 0.5, 0.5, rmXFractionToMeters(0.0), rmXFractionToMeters(0.48), rmDegreesToRadians(0), rmDegreesToRadians(360));
  128.  
  129.   // Player constraints
  130.   int playerConstraint=rmCreateClassDistanceConstraint("avoid players", classPlayer, 10.0);
  131.   int playerConstraintMid=rmCreateClassDistanceConstraint("resources avoid players", classPlayer, 15.0);
  132.   int playerConstraintFar=rmCreateClassDistanceConstraint("resources avoid players far", classPlayer, 35.0);
  133.   int playerConstraintNative=rmCreateClassDistanceConstraint("natives avoid players far", classPlayer, 35.0);
  134.   int playerConstraintNugget=rmCreateClassDistanceConstraint("nuggets avoid players far", classPlayer, 65.0);
  135.   int avoidTC = rmCreateTypeDistanceConstraint("avoid TCs", "TownCenter", 20.0);
  136.  
  137.   // Nature avoidance
  138.   int forestObjConstraint=rmCreateTypeDistanceConstraint("forest obj", "all", 6.0);
  139.   int forestConstraint=rmCreateClassDistanceConstraint("forest vs. forest", rmClassID("classForest"), 25.0);
  140.   int forestConstraintSmall=rmCreateClassDistanceConstraint("forest vs. forest less", rmClassID("classForest"), 15.0);
  141.   int avoidResource=rmCreateTypeDistanceConstraint("resource avoid resource", "resource", 10.0);
  142.   int avoidCoin=rmCreateTypeDistanceConstraint("avoid coin", "mine", 70.0);
  143.   int avoidGold=rmCreateTypeDistanceConstraint("avoid gold", "minegold", 60.0);
  144.   int avoidNugget=rmCreateTypeDistanceConstraint("nugget avoid nugget", "AbstractNugget", 50.0);
  145.   int avoidFood = rmCreateClassDistanceConstraint("avoid foods", foodClass, 12.0);
  146.   int avoidFoodMid = rmCreateClassDistanceConstraint("avoid foods mid", foodClass, 25.0);
  147.   int avoidFoodFar = rmCreateClassDistanceConstraint("avoid foods far", foodClass, 45.0);
  148.   int avoidElephants = rmCreateTypeDistanceConstraint("avoid elephants far", "ypWildElephant", 60.0);
  149.   int avoidHerdables=rmCreateTypeDistanceConstraint("avoids cattle", "ypWaterBuffalo", 65.0);
  150.   int avoidImportantItem=rmCreateClassDistanceConstraint("important stuff avoids each other", rmClassID("importantItem"), 5.0);
  151.   int avoidImportantItemFar=rmCreateClassDistanceConstraint("important stuff avoids each other far", rmClassID("importantItem"), 15.0);
  152.   int avoidBerries = rmCreateTypeDistanceConstraint("avoid berries", "berrybush", 65.0);
  153.  
  154.   // Avoid impassable land
  155.   int avoidImpassableLandShort=rmCreateTerrainDistanceConstraint("avoid impassable land short", "Land", false, 4.0);
  156.   int avoidImpassableLand=rmCreateTerrainDistanceConstraint("avoid impassable land", "Land", false, 8.0);
  157.   int avoidImpassableLandFar=rmCreateTerrainDistanceConstraint("avoid impassable land far", "Land", false, 12.5);
  158.  
  159.   // Constraint to avoid water.
  160.   int avoidWater4 = rmCreateTerrainDistanceConstraint("avoid water", "Land", false, 4.0);
  161.   int avoidWater10 = rmCreateTerrainDistanceConstraint("avoid water medium", "Land", false, 10.0);
  162.  
  163.   // Constraint for grassy area to seek water
  164.   int riverGrass = rmCreateTerrainMaxDistanceConstraint("stay near the water", "land", false, 5.0);
  165.  
  166.   // Unit avoidance
  167.   int avoidTownCenter=rmCreateTypeDistanceConstraint("avoid Town Center", "townCenter", 10.0);
  168.  
  169.   // general avoidance
  170.   int avoidAll=rmCreateTypeDistanceConstraint("avoid all", "all", 4.0);
  171.  
  172.   // Trade route avoidance.
  173.   int avoidTradeRoute = rmCreateTradeRouteDistanceConstraint("trade route", 5.0);
  174.   int avoidTradeRouteFar = rmCreateTradeRouteDistanceConstraint("trade route far", 35.0);
  175.   int avoidTradeRouteSocketsFar=rmCreateTypeDistanceConstraint("avoid trade route sockets far", "socketTradeRoute", 25.0);
  176.   int avoidTradeRouteSockets=rmCreateTypeDistanceConstraint("avoid trade route sockets", "socketTradeRoute", 5.0);
  177.  
  178.   // Player placing  
  179.  
  180.   int teamZeroCount = rmGetNumberPlayersOnTeam(0);
  181.     int teamOneCount = rmGetNumberPlayersOnTeam(1);
  182.  
  183.   // determine where the river is going to be now so we can push the player on the dry side out a bit
  184.   int randomRiver = rmRandInt(1,2);
  185.   //~ whichVersion = 2;
  186.   randomRiver = 1;
  187.  
  188.   if (cNumberTeams == 2)    {
  189.    
  190.     if(whichVersion == 1) {
  191.       rmSetPlacementTeam(0);
  192.      
  193.       if(randomRiver == 1)
  194.         rmSetPlacementSection(0.78, 0.95);
  195.      
  196.       else
  197.         rmSetPlacementSection(0.81, 0.98);
  198.      
  199.       if(teamZeroCount == 1)
  200.         rmSetPlacementSection(.87, .88);
  201.       rmPlacePlayersCircular(.36, .36, 0);
  202.  
  203.       rmSetPlacementTeam(1);
  204.      
  205.       if(randomRiver == 1)
  206.         rmSetPlacementSection(.30, .47);
  207.      
  208.       else
  209.         rmSetPlacementSection(.27, .44);  
  210.      
  211.       if(teamOneCount == 1)
  212.         rmSetPlacementSection(.37, .38);
  213.       rmPlacePlayersCircular(.36, .36, 0);
  214.     }
  215.    
  216.     else {
  217.        
  218.       rmSetPlacementTeam(0);
  219.      
  220.      
  221.        rmSetPlacementSection(0.92, 0.01);
  222.      
  223.        
  224.     rmPlacePlayersCircular(0.39, 0.39, 0.0);
  225.            
  226.  
  227.       rmSetPlacementTeam(1);
  228.      
  229.      
  230.         rmSetPlacementSection(.43, .53);
  231.      
  232.      
  233.       rmPlacePlayersCircular(0.39, 0.39, 0.0);
  234.     }
  235.     }
  236.  
  237.   // FFA
  238.   else {
  239.     rmPlacePlayersCircular(0.225, 0.225, 0.0);
  240.   }
  241.  
  242.   // Text
  243.   rmSetStatusText("",0.10);
  244.  
  245.   float playerFraction=rmAreaTilesToFraction(100);
  246.   for(i=1; <cNumberPlayers) {
  247.     // Create the area.
  248.     int id=rmCreateArea("Player"+i);
  249.     // Assign to the player.
  250.     rmSetPlayerArea(i, id);
  251.     // Set the size.
  252.     rmSetAreaSize(id, playerFraction, playerFraction);
  253.     rmAddAreaToClass(id, classPlayer);
  254.     rmAddAreaConstraint(id, playerConstraint);
  255.     rmAddAreaConstraint(id, playerEdgeConstraint);
  256.     rmAddAreaConstraint(id, avoidImpassableLand);
  257.     rmAddAreaConstraint(id, avoidTradeRoute);
  258.     rmAddAreaConstraint(id, avoidWater10);
  259.     rmSetAreaCoherence(id, 1.0);
  260.     //rmSetAreaLocPlayer(id, i);
  261.     rmSetAreaWarnFailure(id, false);
  262.   }
  263.  
  264.   rmBuildAllAreas();
  265.  
  266.   // Text
  267.   rmSetStatusText("",0.25);
  268.  
  269.   // Placement order
  270.   // Rivers & Cliffs -> Trade route -> Resources -> Nuggets
  271.  
  272.   // Rivers and cliffs
  273.   // Half the time there will be a river to the north, half to the south (same with v2 of the map)
  274.  
  275.   int northRiver = rmRiverCreate(-1, "Deccan Plateau River", 5, 30, 6, 8);
  276.   int southRiver = rmRiverCreate(-1, "Deccan Plateau River", 5, 30, 7, 8);
  277.   /*
  278.   int northRiver = rmRiverCreate(-1, "Deccan Plateau River", 5, 5, 5, 5);
  279.   int southRiver = rmRiverCreate(-1, "Deccan Plateau River", 5, 5, 5, 5);
  280.   */
  281.   float riverXLoc = 0;
  282.   float riverYLoc = 0;
  283.  
  284.   // north/west river
  285.   if (randomRiver == 1) {
  286.     if(whichVersion == 1) {
  287.        
  288.       rmRiverAddWaypoint(northRiver, 0.80, 0.4);
  289.       rmRiverAddWaypoint(northRiver, .33, .33);
  290.       riverXLoc = .33;
  291.       riverYLoc = .43;
  292.       rmRiverAddWaypoint(northRiver, 0.4, 0.20);
  293.       /*
  294.       rmRiverAddWaypoint(northRiver, 0.40, 1.0);
  295.       rmRiverAddWaypoint(northRiver, .73, .73);
  296.       riverXLoc = .73;
  297.       riverYLoc = .73;
  298.       rmRiverAddWaypoint(northRiver, 1.0, 0.40);
  299.       */
  300.     }
  301.     //North river refers to the southern river, south river to the northern river.
  302.     else {
  303.       //rmRiverAddWaypoint(northRiver, 0.64, 1.0);
  304.       rmRiverAddWaypoint(northRiver, 0.1, 1.0);
  305.       //riverXLoc = .9;
  306.       //riverYLoc = .1;
  307.       rmRiverAddWaypoint(northRiver, 0.3, 0.3);
  308.       rmRiverAddWaypoint(northRiver, 0.0, 0.0);
  309.      
  310.      
  311.       rmRiverAddWaypoint(southRiver, 0.7, 1.0);
  312.       //rmRiverAddWaypoint(southRiver, .89, .19);
  313.       //riverXLoc = 0.5;
  314.       //riverYLoc = 0.5;
  315.       rmRiverAddWaypoint(southRiver, 0.8, 0.5);
  316.       rmRiverAddWaypoint(southRiver, 1.0, 0.0);
  317.     }
  318.     int rivershallowsize = 9;
  319.     if (cNumberNonGaiaPlayers > 2){
  320.         rivershallowsize = 12;
  321.     }
  322.     if (cNumberNonGaiaPlayers > 4){
  323.         rivershallowsize = 14;
  324.     }
  325.     if (cNumberNonGaiaPlayers > 6){
  326.         rivershallowsize = 16;
  327.     }
  328.     rmRiverSetShallowRadius(northRiver, rivershallowsize);
  329.     rmRiverAddShallow(northRiver, rmRandFloat(0.05, 0.15));
  330.     rmRiverAddShallow(northRiver, rmRandFloat(0.15, 0.25));
  331.     rmRiverAddShallow(northRiver, rmRandFloat(0.30, 0.35));
  332.     rmRiverAddShallow(northRiver, rmRandFloat(0.40, 0.50));
  333.     rmRiverAddShallow(northRiver, rmRandFloat(0.55, 0.60));
  334.     rmRiverAddShallow(northRiver, rmRandFloat(0.65, 0.70));
  335.     rmRiverAddShallow(northRiver, rmRandFloat(0.75, 0.80));
  336.     rmRiverAddShallow(northRiver, rmRandFloat(0.80, 0.90));
  337.    
  338.     rmRiverSetShallowRadius(southRiver, rivershallowsize);
  339.     rmRiverAddShallow(southRiver, rmRandFloat(0.05, 0.15));
  340.     rmRiverAddShallow(southRiver, rmRandFloat(0.15, 0.25));
  341.     rmRiverAddShallow(southRiver, rmRandFloat(0.30, 0.35));
  342.     rmRiverAddShallow(southRiver, rmRandFloat(0.40, 0.50));
  343.     rmRiverAddShallow(southRiver, rmRandFloat(0.55, 0.60));
  344.     rmRiverAddShallow(southRiver, rmRandFloat(0.65, 0.70));
  345.     rmRiverAddShallow(southRiver, rmRandFloat(0.75, 0.80));
  346.     rmRiverAddShallow(southRiver, rmRandFloat(0.80, 0.90));
  347.     rmRiverSetBankNoiseParams(northRiver, 0.07, 2, 15.0, 15.0, 0.667, 1.8);
  348.     rmRiverSetBankNoiseParams(southRiver, 0.07, 2, 15.0, 15.0, 0.667, 1.8);
  349.     rmRiverBuild(northRiver);
  350.    
  351.     //AoEHD
  352.     rmRiverBuild(southRiver);
  353.   }
  354.  
  355.   // south/east river  
  356.   else {
  357.     if(whichVersion == 1) {
  358.       rmRiverAddWaypoint(southRiver, 0.4, 0.25);
  359.       rmRiverAddWaypoint(southRiver, .89, .19);
  360.       riverXLoc = .59;
  361.       riverYLoc = .79;
  362.       rmRiverAddWaypoint(southRiver, 0.45, 0.7);
  363.       /*
  364.        rmRiverAddWaypoint(southRiver, 0.0, 0.65);
  365.       rmRiverAddWaypoint(southRiver, .29, .29);
  366.       riverXLoc = .29;
  367.       riverYLoc = .29;
  368.       rmRiverAddWaypoint(southRiver, 0.65, 0.0);
  369.       */
  370.     }
  371.    
  372.     else {
  373.       rmRiverAddWaypoint(southRiver, 1.0, 0.64);
  374.       rmRiverAddWaypoint(southRiver, .7, .3);
  375.       riverXLoc = .7;
  376.       riverYLoc = .3;
  377.       rmRiverAddWaypoint(southRiver, 0.375, 0.0);
  378.     }
  379.    
  380.     rmRiverSetShallowRadius(southRiver, 5);
  381.     rmRiverAddShallow(southRiver, rmRandFloat(0.15, 0.25));
  382.     rmRiverAddShallow(southRiver, rmRandFloat(0.45, 0.55));
  383.     rmRiverAddShallow(southRiver, rmRandFloat(0.75, 0.85));
  384.     rmRiverSetBankNoiseParams(southRiver, 0.07, 2, 15.0, 15.0, 0.667, 1.8);
  385.     rmRiverBuild(southRiver);
  386.   }
  387.  
  388.   // Paint some grass near the river
  389.   int grassPatch=rmCreateArea("grassy area near river");
  390.   rmSetAreaSize(grassPatch, .5, .5);
  391.   rmSetAreaLocation(grassPatch, riverXLoc, riverYLoc);
  392.   rmSetAreaWarnFailure(grassPatch, false);
  393.   rmSetAreaSmoothDistance(grassPatch, 10);
  394.   rmSetAreaCoherence(grassPatch, .6);
  395.   rmSetAreaMix(grassPatch, "deccan_grass_b");
  396.   rmAddAreaConstraint(grassPatch, riverGrass);
  397.   rmBuildArea(grassPatch);
  398.   //AoEHD: Create area under bottom river.
  399.   /*
  400.   int underbottomriver=rmCreateArea("BottomRiver");
  401.   rmSetAreaSize(underbottomriver, 0.1, 0.1);
  402.   rmSetAreaLocation(underbottomriver, .3, .0);
  403.   rmSetAreaWarnFailure(underbottomriver, false);
  404.   rmSetAreaSmoothDistance(grassPatch, 10);
  405.   rmSetAreaCoherence(grassPatch, .6);
  406.   rmSetAreaMix(grassPatch, "deccan_grass_b");
  407.   rmAddAreaConstraint(grassPatch, riverGrass);
  408.   rmSetAreaTerrainType(underbottomriver, "yukon\ground1_yuk");
  409.   rmBuildArea(underbottomriver);*/
  410.   // Cliff only present in non-FFA games
  411.   int startingCliff1=rmCreateArea("Plateau");
  412.   rmSetAreaSize(startingCliff1, .125, .125);
  413.   rmSetAreaLocation(startingCliff1, .5, .5);
  414.   rmSetAreaWarnFailure(startingCliff1, false);
  415.   rmSetAreaSmoothDistance(startingCliff1, 10);
  416.   rmSetAreaCoherence(startingCliff1, .6);
  417.   rmSetAreaCliffType(startingCliff1, "Deccan Plateau");
  418.   rmSetAreaCliffEdge(startingCliff1, 6, .14, 0, 1.0, 0);
  419.   if(cNumberTeams == 2)
  420.     rmSetAreaCliffHeight(startingCliff1, 0.0, 0.0, 0.5);
  421.  
  422.   else
  423.     rmSetAreaCliffHeight(startingCliff1, 0.0, 0.0, 0.5);
  424.    
  425.   rmSetAreaTerrainType(startingCliff1, "Deccan\ground_grass4_deccan");
  426.   rmSetAreaMix(startingCliff1, "deccan_grass_a");
  427.   //rmSetAreaCliffPainting(startingCliff1, true, true, true, 0, true);
  428.   rmAddAreaConstraint(startingCliff1, avoidWater10);
  429.   rmBuildArea(startingCliff1);
  430.  
  431.  
  432.  
  433.   // south/east trade route
  434.   /*
  435.   int tradeRouteID = rmCreateTradeRoute();
  436.   int socketID=rmCreateObjectDef("south trade route");
  437.   rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
  438.  
  439.   rmAddObjectDefItem(socketID, "SocketTradeRoute", 1, 0.0);
  440.     rmSetObjectDefAllowOverlap(socketID, true);
  441.   rmAddObjectDefToClass(socketID, rmClassID("socketClass"));
  442.   rmSetObjectDefMinDistance(socketID, 6.0);
  443.   rmSetObjectDefMaxDistance(socketID, 8.0);
  444.  
  445.   // When S/E river present, don't push trade routes towards middle
  446.   if (randomRiver == 2) {
  447.     // south
  448.     if(whichVersion == 1) {
  449.       rmAddTradeRouteWaypoint(tradeRouteID, 0.0, 0.4);
  450.       rmAddTradeRouteWaypoint(tradeRouteID, 0.1, 0.3);
  451.       rmAddTradeRouteWaypoint(tradeRouteID, 0.3, 0.1);
  452.       rmAddTradeRouteWaypoint(tradeRouteID, 0.4, 0.0);
  453.     }
  454.    
  455.     // east
  456.     else {
  457.       rmAddTradeRouteWaypoint(tradeRouteID, 1.0, 0.4);
  458.       rmAddTradeRouteWaypoint(tradeRouteID, .6, 0.0);
  459.     }
  460.   }
  461.  
  462.   // When N/W river present, push trade routes towards center
  463.   else {
  464.     // South
  465.     if(whichVersion == 1) {
  466.       rmAddTradeRouteWaypoint(tradeRouteID, 0.0, 0.55);
  467.       rmAddTradeRouteWaypoint(tradeRouteID, 0.275, 0.275);
  468.       rmAddTradeRouteWaypoint(tradeRouteID, 0.55, 0.0);
  469.     }
  470.    
  471.     // east
  472.     else {
  473.       rmAddTradeRouteWaypoint(tradeRouteID, 1.0, 0.55);
  474.       rmAddTradeRouteWaypoint(tradeRouteID, 0.675, 0.275);
  475.       rmAddTradeRouteWaypoint(tradeRouteID, 0.45, 0.0);
  476.     }
  477.   }
  478.  
  479.   bool placedTradeRoute = rmBuildTradeRoute(tradeRouteID, "water");
  480.   if(placedTradeRoute == false)
  481.     rmEchoError("Failed to place trade route");
  482.  
  483.   if(randomRiver == 1)
  484.     vector socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.2);
  485.  
  486.   else
  487.     socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.25);
  488.   rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  489.  
  490.   // Extra socket for more players or on long route side
  491.   if(cNumberNonGaiaPlayers > 3 || randomRiver == 1) {
  492.     if(cNumberTeams > 2 && cNumberNonGaiaPlayers == 3) {
  493.       // No center TP for this setup
  494.     }
  495.    
  496.     else {
  497.       socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.5);
  498.       rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  499.     }
  500.   }
  501.  
  502.   if(randomRiver == 1)
  503.     socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.8);
  504.  
  505.   else
  506.     socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.75);
  507.   rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  508.  
  509.   // north/west trade route
  510.   int tradeRoute2ID = rmCreateTradeRoute();
  511.   socketID=rmCreateObjectDef("north trade route");
  512.   rmSetObjectDefTradeRouteID(socketID, tradeRoute2ID);
  513.  
  514.   rmAddObjectDefItem(socketID, "SocketTradeRoute", 1, 0.0);
  515.     rmSetObjectDefAllowOverlap(socketID, true);
  516.   rmSetObjectDefMinDistance(socketID, 6.0);
  517.   rmSetObjectDefMaxDistance(socketID, 8.0);
  518.   rmAddObjectDefToClass(socketID, rmClassID("socketClass"));
  519.  
  520.   // When N/W river present, don't push trade routes
  521.   if(randomRiver == 1) {
  522.     // north
  523.     if(whichVersion == 1) {
  524.       rmAddTradeRouteWaypoint(tradeRoute2ID, 1.0, 0.6);
  525.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.7, 0.9);
  526.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.9, 0.7);
  527.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.6, 1.0);
  528.     }
  529.    
  530.     // west
  531.     else {
  532.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.0, 0.6);
  533.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.4, 1.0);
  534.     }
  535.   }
  536.  
  537.   // When S/E river present, push routes to center a bit
  538.   else {
  539.     // north
  540.     if(whichVersion == 1) {
  541.       rmAddTradeRouteWaypoint(tradeRoute2ID, 1.0, 0.45);
  542.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.725, 0.725);
  543.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.45, 1.0);
  544.     }
  545.    
  546.     // west
  547.     else {
  548.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.0, 0.45);
  549.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.275, 0.725);
  550.       rmAddTradeRouteWaypoint(tradeRoute2ID, 0.55, 1.0);
  551.     }    
  552.   }
  553.  
  554.   placedTradeRoute = rmBuildTradeRoute(tradeRoute2ID, "water");
  555.   if(placedTradeRoute == false)
  556.       rmEchoError("Failed to place trade route");
  557.  
  558.     // add the sockets along the trade route.
  559.   if(randomRiver == 2)
  560.     socketLoc = rmGetTradeRouteWayPoint(tradeRoute2ID, 0.2);
  561.  
  562.   else
  563.     socketLoc = rmGetTradeRouteWayPoint(tradeRoute2ID, 0.25);
  564.   rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  565.  
  566.   // Extra socket for more players or on long route side
  567.   if(cNumberNonGaiaPlayers > 3 || randomRiver == 2) {
  568.     if(cNumberTeams > 2 && cNumberNonGaiaPlayers == 3) {
  569.       // No center TP for this setup
  570.     }
  571.    
  572.     else {
  573.       socketLoc = rmGetTradeRouteWayPoint(tradeRoute2ID, 0.5);
  574.       rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  575.     }
  576.   }
  577.    
  578.   if(randomRiver == 2)
  579.     socketLoc = rmGetTradeRouteWayPoint(tradeRoute2ID, 0.8);
  580.  
  581.   else
  582.     socketLoc = rmGetTradeRouteWayPoint(tradeRoute2ID, 0.75);
  583.   rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
  584.  */
  585.   // Natives
  586.   /*
  587.   int randomNative1 = rmRandInt(1,3);
  588.   int randomNative2 = rmRandInt(1,3);
  589.  
  590.   string nativeString1 = "native udasi village ";
  591.   string nativeString2 = "native bhakti village ";
  592.   string nativeString3 = "native sufi mosque deccan ";
  593.  
  594.   string stringNative1 = "";
  595.   string stringNative2 = "";
  596.  
  597.   if(randomNative1 == 1)
  598.     stringNative1 = nativeString1;
  599.  
  600.   else if (randomNative1 == 2)
  601.     stringNative1 = nativeString2;
  602.  
  603.   else
  604.     stringNative1 = nativeString3;
  605.    
  606.   if(randomNative2 == 1)
  607.     stringNative2 = nativeString1;
  608.  
  609.   else if (randomNative2 == 2)
  610.     stringNative2 = nativeString2;
  611.  
  612.   else
  613.     stringNative2 = nativeString3;
  614.  
  615.  
  616.   if (subCiv0 == rmGetCivID("Udasi")) {  
  617.     int udasiVillageAID = -1;
  618.     int udasiVillageType = rmRandInt(1,5);
  619.     udasiVillageAID = rmCreateGrouping("Udasi village A", stringNative1+udasiVillageType);
  620.     rmSetGroupingMinDistance(udasiVillageAID, 0.0);
  621.     rmSetGroupingMaxDistance(udasiVillageAID, 10.0);
  622.     rmAddGroupingConstraint(udasiVillageAID, avoidImpassableLandFar);
  623.     rmAddGroupingConstraint(udasiVillageAID, playerConstraint);
  624.     rmAddGroupingConstraint(udasiVillageAID, avoidImportantItemFar);
  625.     rmAddGroupingToClass(udasiVillageAID, rmClassID("importantItem"));
  626.    
  627.     if(cNumberTeams > 2) {
  628.       if(whichVersion == 1)
  629.         rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.2, 0.8);
  630.    
  631.       else
  632.         rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.8, 0.8);
  633.     }
  634.    
  635.     else {
  636.       //~ rmPlaceGroupingInArea(udasiVillageAID, 0, startingCliff1, 1);
  637.       rmPlaceGroupingAtLoc(udasiVillageAID, 0, 0.5, 0.6);
  638.     }
  639.   }
  640.    
  641.   if (subCiv1 == rmGetCivID("Bhakti")) {  
  642.       int bhaktiVillageAID = -1;
  643.       int bhaktiVillageType = rmRandInt(1,5);
  644.       bhaktiVillageAID = rmCreateGrouping("Bhakti village A", stringNative2+bhaktiVillageType);
  645.       rmSetGroupingMinDistance(bhaktiVillageAID, 0.0);
  646.       rmSetGroupingMaxDistance(bhaktiVillageAID, 10.0);
  647.       rmAddGroupingConstraint(bhaktiVillageAID, avoidImpassableLandFar);
  648.       rmAddGroupingToClass(bhaktiVillageAID, rmClassID("importantItem"));
  649.       rmAddGroupingConstraint(bhaktiVillageAID, playerConstraint);
  650.       rmAddGroupingConstraint(bhaktiVillageAID, avoidImportantItemFar);
  651.      
  652.     if(cNumberTeams > 2) {
  653.       if(whichVersion == 1)
  654.         rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.8, 0.2);  
  655.      
  656.       else
  657.         rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.2, 0.2);
  658.       }
  659.    
  660.     else {
  661.       //~ rmPlaceGroupingInArea(bhaktiVillageAID, 0, startingCliff1, 1);
  662.       rmPlaceGroupingAtLoc(bhaktiVillageAID, 0, 0.5, 0.4);
  663.     }
  664.   }
  665.   */
  666.    // Text
  667.    rmSetStatusText("",0.45);
  668.  
  669.     // PLAYER STARTING RESOURCES
  670.  
  671.    rmClearClosestPointConstraints();
  672.  
  673.     // Player placement
  674.     int startingUnits = rmCreateStartingUnitsObjectDef(5.0);
  675.  
  676.     int TCID = rmCreateObjectDef("player TC");
  677.     if (rmGetNomadStart()) {
  678.             rmAddObjectDefItem(TCID, "CoveredWagon", 1, 0.0);
  679.   }
  680.     else {
  681.         rmAddObjectDefItem(TCID, "TownCenter", 1, 0.0);
  682.   }
  683.  
  684.   rmSetObjectDefMinDistance(TCID, 0.0);
  685.     rmSetObjectDefMaxDistance(TCID, 5.0);
  686.  
  687.     rmAddObjectDefConstraint(TCID, avoidTownCenter);
  688.     rmAddObjectDefConstraint(TCID, playerEdgeConstraint);
  689.     rmAddObjectDefConstraint(TCID, avoidImpassableLand);
  690.     rmAddObjectDefConstraint(TCID, avoidWater4);
  691.  
  692.     int playerSilverID = rmCreateObjectDef("player mine");
  693.     rmAddObjectDefItem(playerSilverID, "MineCopper", 1, 0);
  694.     rmAddObjectDefConstraint(playerSilverID, avoidTradeRoute);
  695.     rmAddObjectDefConstraint(playerSilverID, avoidTownCenter);
  696.     rmSetObjectDefMinDistance(playerSilverID, 12.0);
  697.     rmSetObjectDefMaxDistance(playerSilverID, 16.0);
  698.   rmAddObjectDefConstraint(playerSilverID, avoidImpassableLand);
  699.  
  700.     int playerFoodID=rmCreateObjectDef("player nilgai");
  701.   rmAddObjectDefItem(playerFoodID, "ypNilgai", 8, 4.0);
  702.   rmAddObjectDefToClass(playerFoodID, foodClass);
  703.   rmSetObjectDefMinDistance(playerFoodID, 8);
  704.   rmSetObjectDefMaxDistance(playerFoodID, 14);
  705.     rmAddObjectDefConstraint(playerFoodID, avoidAll);
  706.   rmAddObjectDefConstraint(playerFoodID, avoidFood);
  707.   rmAddObjectDefConstraint(playerFoodID, avoidImpassableLand);
  708.   rmSetObjectDefCreateHerd(playerFoodID, false);
  709.  
  710.     int playerTreeID=rmCreateObjectDef("player trees");
  711.   rmAddObjectDefItem(playerTreeID, "ypTreeDeccan", 7, 13);
  712.   rmSetObjectDefMinDistance(playerTreeID, 8);
  713.   rmSetObjectDefMaxDistance(playerTreeID, 12);
  714.     rmAddObjectDefConstraint(playerTreeID, avoidAll);
  715.   rmAddObjectDefConstraint(playerTreeID, avoidImpassableLand);
  716.  
  717.   int playerNuggetID=rmCreateObjectDef("player nugget");
  718.   rmAddObjectDefItem(playerNuggetID, "nugget", 1, 0.0);
  719.   rmSetObjectDefMinDistance(playerNuggetID, 15.0);
  720.   rmSetObjectDefMaxDistance(playerNuggetID, 20.0);
  721.   rmAddObjectDefConstraint(playerNuggetID, avoidAll);
  722.   rmAddObjectDefConstraint(playerNuggetID, avoidImpassableLand);
  723.   /*
  724.   int playerCrateID=rmCreateObjectDef("bonus starting crates");
  725.   rmAddObjectDefItem(playerCrateID, "crateOfFood", 3, 7.0);
  726.   rmAddObjectDefItem(playerCrateID, "crateOfWood", 2, 4.0);
  727.   rmAddObjectDefItem(playerCrateID, "crateOfCoin", 2, 4.0);
  728.   rmSetObjectDefMinDistance(playerCrateID, 10);
  729.   rmSetObjectDefMaxDistance(playerCrateID, 12);
  730.     rmAddObjectDefConstraint(playerCrateID, avoidAll);
  731.   rmAddObjectDefConstraint(playerCrateID, avoidImpassableLand);
  732.   */
  733.   int playerBerryID=rmCreateObjectDef("player berries");
  734.   rmAddObjectDefItem(playerBerryID, "berryBush", 2, 4.0);
  735.   rmSetObjectDefMinDistance(playerBerryID, 10);
  736.   rmSetObjectDefMaxDistance(playerBerryID, 15);
  737.     rmAddObjectDefConstraint(playerBerryID, avoidAll);
  738.   rmAddObjectDefConstraint(playerBerryID, avoidImpassableLand);
  739.  
  740.     for(i=1; <cNumberPlayers) {
  741.       rmPlaceObjectDefAtLoc(TCID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
  742.       //rmPlaceObjectDefAtLoc(TCID, i, 0.5, 0.5);
  743.       vector TCLoc = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TCID, i));
  744.  
  745.       rmPlaceObjectDefAtLoc(startingUnits, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  746.       rmPlaceObjectDefAtLoc(playerSilverID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  747.       rmPlaceObjectDefAtLoc(playerFoodID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  748.     rmPlaceObjectDefAtLoc(playerTreeID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  749.     //rmPlaceObjectDefAtLoc(playerCrateID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  750.     rmPlaceObjectDefAtLoc(playerBerryID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  751.  
  752.     rmSetNuggetDifficulty(1, 1);
  753.     //rmPlaceObjectDefAtLoc(playerNuggetID, 0, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  754.    
  755.     // Japanese
  756.     if(ypIsAsian(i) && rmGetNomadStart() == false)
  757.       rmPlaceObjectDefAtLoc(ypMonasteryBuilder(i), i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
  758.   }
  759.  
  760.   rmClearClosestPointConstraints();
  761.  
  762.   // Text
  763.   rmSetStatusText("",0.55);
  764.  
  765.     int silverID = -1;
  766.     int silverCount = 3;
  767.  
  768.   if (cNumberNonGaiaPlayers < 5)
  769.     silverCount = 1;
  770.  
  771.     rmEchoInfo("silver count = "+silverCount);
  772.  
  773.   int rightSilverID = rmCreateObjectDef("silver "+i);
  774.   rmAddObjectDefItem(rightSilverID, "minecopper", 1, 0.0);
  775.   rmSetObjectDefMinDistance(rightSilverID, rmXFractionToMeters(0.1));
  776.   rmSetObjectDefMaxDistance(rightSilverID, rmXFractionToMeters(0.2));
  777.   rmAddObjectDefConstraint(rightSilverID, avoidAll);
  778.   rmAddObjectDefConstraint(rightSilverID, avoidCoin);    
  779.   rmAddObjectDefConstraint(rightSilverID, avoidGold);
  780.   rmAddObjectDefConstraint(rightSilverID, avoidTC);
  781.   rmAddObjectDefConstraint(rightSilverID, avoidTownCenter);
  782.   //rmAddObjectDefConstraint(rightSilverID, avoidImpassableLand);
  783.   //rmAddObjectDefConstraint(rightSilverID, avoidImportantItem);
  784.   //rmAddObjectDefConstraint(rightSilverID, avoidWater10);
  785.   rmAddObjectDefConstraint(rightSilverID, avoidTradeRoute);
  786.   rmAddObjectDefConstraint(rightSilverID, avoidTradeRouteSockets);
  787.   //rmAddObjectDefConstraint(rightSilverID, playerConstraintFar);
  788.   rmPlaceObjectDefPerPlayer(rightSilverID, false, silverCount);
  789.  
  790.  
  791.   int numTries=4*cNumberNonGaiaPlayers;
  792.   int failCount=0;
  793.  
  794.   // Text
  795.   rmSetStatusText("",0.60);
  796.  
  797.   // heavier forests in central area
  798. /*
  799.   for (i=0; <numTries) {  
  800.     int forest=rmCreateArea("foresta"+i, startingCliff1);
  801.     rmSetAreaWarnFailure(forest, false);
  802.     rmSetAreaSize(forest, rmAreaTilesToFraction(200), rmAreaTilesToFraction(200));
  803.     rmSetAreaForestType(forest, "Deccan Forest");
  804.     rmSetAreaForestDensity(forest, 0.6);
  805.     rmSetAreaForestClumpiness(forest, 0.4);
  806.     rmSetAreaForestUnderbrush(forest, 0.0);
  807.     rmSetAreaCoherence(forest, 0.7);
  808.     rmAddAreaToClass(forest, rmClassID("classForest"));
  809.     rmAddAreaConstraint(forest, forestConstraintSmall);
  810.     rmAddAreaConstraint(forest, forestObjConstraint);
  811.     rmAddAreaConstraint(forest, forestMidConstraint);
  812.     rmAddAreaConstraint(forest, avoidImportantItem);
  813.     rmAddAreaConstraint(forest, playerConstraintMid);
  814.     rmAddAreaConstraint(forest, avoidWater4);
  815.     rmAddAreaConstraint(forest, avoidTradeRoute);
  816.  
  817.      if(rmBuildArea(forest)==false)
  818.      {
  819.         // Stop trying once we fail 3 times in a row.
  820.         failCount++;
  821.         if(failCount==3)
  822.            break;
  823.      }
  824.      else
  825.         failCount=0;
  826.   }
  827.  */
  828.   // sparser forests around the outside where the gold is
  829.   numTries=14*cNumberNonGaiaPlayers;
  830.   failCount=0;
  831.  
  832.   for (i=0; <numTries) {  
  833.     int outerForest=rmCreateArea("forestb"+i);
  834.     rmSetAreaWarnFailure(outerForest, false);
  835.     rmSetAreaSize(outerForest, rmAreaTilesToFraction(100), rmAreaTilesToFraction(150));
  836.     rmSetAreaForestType(outerForest, "Deccan Forest");
  837.     rmSetAreaForestDensity(outerForest, 0.2);
  838.     rmSetAreaForestClumpiness(outerForest, 0.35);
  839.     rmSetAreaForestUnderbrush(outerForest, 0.0);
  840.     rmAddObjectDefConstraint(outerForest, avoidTC);
  841.     rmSetAreaCoherence(outerForest, 0.5);
  842.     rmAddAreaToClass(outerForest, rmClassID("classForest"));
  843.     rmAddAreaConstraint(outerForest, forestConstraint);
  844.     rmAddAreaConstraint(outerForest, forestObjConstraint);
  845.     rmAddAreaConstraint(outerForest, edgeForestConstraint);
  846.     rmAddAreaConstraint(outerForest, avoidImportantItem);
  847.     rmAddAreaConstraint(outerForest, avoidWater4);
  848.     rmAddAreaConstraint(outerForest, playerConstraintMid);
  849.     rmAddAreaConstraint(outerForest, avoidTradeRoute);
  850.     rmAddAreaConstraint(outerForest, avoidTradeRouteSockets);
  851.  
  852.     if(rmBuildArea(outerForest)==false)
  853.     {
  854.       // Stop trying once we fail 3 times in a row.
  855.       failCount++;
  856.       if(failCount==3)
  857.         break;
  858.     }
  859.     else
  860.       failCount=0;
  861.   }
  862.    
  863.   // Text
  864.   rmSetStatusText("",0.75);
  865.  
  866.   int foodCount = rmRandInt(6,8);
  867.  
  868.   int foodID=rmCreateObjectDef("nilgai");
  869.   rmAddObjectDefItem(foodID, "ypNilgai", foodCount, 6.0);
  870.   rmAddObjectDefToClass(foodID, foodClass);
  871.   rmSetObjectDefMinDistance(foodID, 0.0);
  872.   rmSetObjectDefMaxDistance(foodID, rmXFractionToMeters(0.15));
  873.   rmAddObjectDefConstraint(foodID, avoidImpassableLand);
  874.   rmAddObjectDefConstraint(foodID, playerConstraintMid);
  875.   rmAddObjectDefConstraint(foodID, avoidFoodMid);
  876.   rmAddObjectDefConstraint(foodID, avoidImportantItem);
  877.   rmSetObjectDefCreateHerd(foodID, true);
  878.   rmPlaceObjectDefAtLoc(foodID, 0, 0.5, 0.5, 3*cNumberNonGaiaPlayers);
  879.  
  880.   // smaller herds around the map edges
  881.   foodCount = rmRandInt(4,5);
  882.  
  883.   int food2ID=rmCreateObjectDef("more nilgai");
  884.   rmAddObjectDefItem(food2ID, "ypNilgai", foodCount, 4.0);
  885.   rmAddObjectDefToClass(food2ID, foodClass);
  886.   rmSetObjectDefMinDistance(food2ID, 0.0);
  887.   rmSetObjectDefMaxDistance(food2ID, rmXFractionToMeters(0.5));
  888.   rmAddObjectDefConstraint(food2ID, avoidImpassableLand);
  889.   rmAddObjectDefConstraint(food2ID, avoidFoodFar);
  890.   rmAddObjectDefConstraint(food2ID, playerConstraintMid);
  891.   rmAddObjectDefConstraint(food2ID, avoidWater4);
  892.   rmAddObjectDefConstraint(food2ID, avoidImportantItem);
  893.   rmAddObjectDefConstraint(food2ID, edgeForestConstraint);
  894.   rmSetObjectDefCreateHerd(food2ID, true);
  895.   rmPlaceObjectDefAtLoc(food2ID, 0, 0.5, 0.5, 5*cNumberNonGaiaPlayers);
  896.  
  897.   foodCount = rmRandInt(2,2);
  898.  
  899.   int food3ID=rmCreateObjectDef("ephelants!");
  900.   //rmAddObjectDefItem(food3ID, "ypWildElephant", foodCount, 3.0);
  901.   rmAddObjectDefToClass(food3ID, foodClass);
  902.   rmSetObjectDefMinDistance(food3ID, rmXFractionToMeters(0.25));
  903.   rmSetObjectDefMaxDistance(food3ID, rmXFractionToMeters(0.5));
  904.   rmAddObjectDefConstraint(food3ID, avoidImpassableLand);
  905.   rmAddObjectDefConstraint(food3ID, playerConstraintFar);
  906.   rmAddObjectDefConstraint(food3ID, avoidFoodMid);
  907.   rmAddObjectDefConstraint(food3ID, avoidTradeRoute);
  908.   rmAddObjectDefConstraint(food3ID, avoidElephants);
  909.   rmSetObjectDefCreateHerd(food3ID, true);
  910.   rmPlaceObjectDefAtLoc(food3ID, 0, 0.5, 0.5, 2*cNumberNonGaiaPlayers);
  911.  
  912.   int herdID=rmCreateObjectDef("water buffalo");
  913.   rmAddObjectDefItem(herdID, "cow", 2, 2.5);
  914.   rmSetObjectDefMinDistance(herdID, 0.0);
  915.   rmSetObjectDefMaxDistance(herdID, rmXFractionToMeters(0.225));
  916.   rmAddObjectDefConstraint(herdID, avoidHerdables);
  917.   rmAddObjectDefConstraint(herdID, avoidAll);
  918.   rmAddObjectDefConstraint(herdID, avoidTradeRoute);
  919.   rmAddObjectDefConstraint(herdID, avoidImpassableLandShort);
  920.   rmAddObjectDefConstraint(herdID, avoidTC);
  921.   rmPlaceObjectDefAtLoc(herdID, 0, 0.5, 0.5, cNumberNonGaiaPlayers*2);
  922.  
  923.   // Berries
  924.   int berriesID=rmCreateObjectDef("berries");
  925.     rmAddObjectDefItem(berriesID, "berrybush", 2, 3.0);
  926.     rmSetObjectDefMinDistance(berriesID, 0);
  927.     rmSetObjectDefMaxDistance(berriesID, rmXFractionToMeters(0.5));
  928.     rmAddObjectDefConstraint(berriesID, avoidTradeRoute);
  929.   rmAddObjectDefConstraint(berriesID, avoidTradeRouteSockets);
  930.     rmAddObjectDefConstraint(berriesID, avoidImpassableLand);
  931.     rmAddObjectDefConstraint(berriesID, playerConstraintFar);
  932.   rmAddObjectDefConstraint(berriesID, avoidBerries);
  933.   rmAddObjectDefConstraint(berriesID, avoidImportantItem);
  934.   rmAddObjectDefConstraint(berriesID, avoidResource);
  935.   rmPlaceObjectDefAtLoc(berriesID, 0, 0.5, 0.5, cNumberNonGaiaPlayers*4);  
  936.  
  937.   // Text
  938.   rmSetStatusText("",0.90);
  939.  
  940.   // check for KOTH game mode
  941.   if(rmGetIsKOTH()) {
  942.    
  943.     int randLoc = rmRandInt(1,2);
  944.     float xLoc = 0.5;
  945.     float yLoc = 0.5;
  946.     float walk = 0.075;
  947.    
  948.     ypKingsHillPlacer(xLoc, yLoc, walk, 0);
  949.     rmEchoInfo("XLOC = "+xLoc);
  950.     rmEchoInfo("XLOC = "+yLoc);
  951.   }
  952.  
  953.   // some crazy nuggets
  954.   /*
  955.     int crazyNugget= rmCreateObjectDef("nugget crazy");
  956.     rmAddObjectDefItem(crazyNugget, "Nugget", 1, 0.0);
  957.     rmSetNuggetDifficulty(4, 4);
  958.     rmSetObjectDefMinDistance(crazyNugget, 0.0);
  959.     rmSetObjectDefMaxDistance(crazyNugget, rmXFractionToMeters(0.25));
  960.     rmAddObjectDefConstraint(crazyNugget, avoidImpassableLand);
  961.   rmAddObjectDefConstraint(crazyNugget, avoidNugget);
  962.   rmAddObjectDefConstraint(crazyNugget, avoidTradeRouteFar);
  963.   rmAddObjectDefConstraint(crazyNugget, avoidWater4);
  964.   rmAddObjectDefConstraint(crazyNugget, avoidAll);
  965.   rmAddObjectDefConstraint(crazyNugget, playerConstraintNugget);
  966.   rmAddObjectDefConstraint(crazyNugget, resourceEdgeConstraint);
  967.   rmAddObjectDefConstraint(crazyNugget, avoidImportantItem);
  968.   rmAddObjectDefConstraint(crazyNugget, avoidTradeRouteSockets);
  969.   rmPlaceObjectDefAtLoc(crazyNugget, 0, 0.5, 0.5, cNumberNonGaiaPlayers);
  970.  
  971.   // some hard nuggets
  972.     int hardNugget= rmCreateObjectDef("nugget hard");
  973.     rmAddObjectDefItem(hardNugget, "Nugget", 1, 0.0);
  974.     rmSetNuggetDifficulty(3, 3);
  975.     rmSetObjectDefMinDistance(hardNugget, 0.0);
  976.     rmSetObjectDefMaxDistance(hardNugget, rmXFractionToMeters(0.25));
  977.     rmAddObjectDefConstraint(hardNugget, avoidImpassableLand);
  978.   rmAddObjectDefConstraint(hardNugget, avoidNugget);
  979.   rmAddObjectDefConstraint(hardNugget, avoidTradeRouteFar);
  980.   rmAddObjectDefConstraint(hardNugget, avoidWater4);
  981.   rmAddObjectDefConstraint(hardNugget, avoidAll);
  982.   rmAddObjectDefConstraint(hardNugget, playerConstraintNugget);
  983.   rmAddObjectDefConstraint(hardNugget, resourceEdgeConstraint);
  984.   rmAddObjectDefConstraint(hardNugget, avoidImportantItem);
  985.   rmAddObjectDefConstraint(hardNugget, avoidTradeRouteSockets);
  986.   rmPlaceObjectDefAtLoc(hardNugget, 0, 0.5, 0.5, cNumberNonGaiaPlayers);
  987.  
  988.   // medium nuggets
  989.   int mediumNugget= rmCreateObjectDef("nugget medium");
  990.     rmAddObjectDefItem(mediumNugget, "Nugget", 1, 0.0);
  991.     rmSetNuggetDifficulty(2, 2);
  992.   rmSetObjectDefMinDistance(mediumNugget, rmXFractionToMeters(0.15));
  993.     rmSetObjectDefMaxDistance(mediumNugget, rmXFractionToMeters(0.45));
  994.     rmAddObjectDefConstraint(mediumNugget, avoidImpassableLand);
  995.   rmAddObjectDefConstraint(mediumNugget, avoidNugget);
  996.   rmAddObjectDefConstraint(mediumNugget, avoidTradeRoute);
  997.     rmAddObjectDefConstraint(mediumNugget, avoidWater4);
  998.   rmAddObjectDefConstraint(mediumNugget, avoidAll);
  999.   rmAddObjectDefConstraint(mediumNugget, playerConstraintNugget);
  1000.     rmAddObjectDefConstraint(mediumNugget, resourceEdgeConstraint);
  1001.   rmAddObjectDefConstraint(mediumNugget, avoidImportantItem);
  1002.   rmAddObjectDefConstraint(mediumNugget, avoidTradeRouteSockets);
  1003.   rmPlaceObjectDefAtLoc(mediumNugget, 0, 0.5, 0.5, cNumberNonGaiaPlayers*2);
  1004.  
  1005.   // easy nuggets
  1006.   int easyNugget= rmCreateObjectDef("easy nuggets");
  1007.     rmAddObjectDefItem(easyNugget, "Nugget", 1, 0.0);
  1008.     rmSetNuggetDifficulty(1, 1);
  1009.   rmSetObjectDefMinDistance(easyNugget, rmXFractionToMeters(0.25));
  1010.     rmSetObjectDefMaxDistance(easyNugget, rmXFractionToMeters(0.45));
  1011.     rmAddObjectDefConstraint(easyNugget, avoidImpassableLand);
  1012.   rmAddObjectDefConstraint(easyNugget, avoidNugget);
  1013.   rmAddObjectDefConstraint(easyNugget, avoidTradeRoute);
  1014.     rmAddObjectDefConstraint(easyNugget, avoidWater4);
  1015.   rmAddObjectDefConstraint(easyNugget, avoidAll);
  1016.   rmAddObjectDefConstraint(easyNugget, playerConstraintFar);
  1017.     rmAddObjectDefConstraint(easyNugget, resourceEdgeConstraint);
  1018.   rmAddObjectDefConstraint(easyNugget, avoidImportantItem);
  1019.   rmAddObjectDefConstraint(easyNugget, avoidTradeRouteSockets);
  1020.   rmPlaceObjectDefAtLoc(easyNugget, 0, 0.5, 0.5, cNumberNonGaiaPlayers*3);
  1021.  
  1022.   // Team nuggets
  1023.   if(cNumberTeams == 2 && cNumberNonGaiaPlayers > 2){
  1024.     rmSetNuggetDifficulty(12, 12);
  1025.       rmPlaceObjectDefAtLoc(easyNugget, 0, 0.5, 0.5, cNumberNonGaiaPlayers);
  1026.   }
  1027.   */
  1028.   // Text
  1029.   rmSetStatusText("",1.0);
  1030.      
  1031. }
RAW Paste Data
Top