// ************************************ Agg Map -- Marsh Of The Moon ************************************
	// QQ Group1:85442352	QQ Group2:456359856	E-mail:[email protected]
	// Last Modified date : 2018.10.29 19:45:10	Welcome to join our QQ Group.	Submit bug to my E-mail.
	// *****************************************************************************************************

	int PlayerNum=2;
	int numPlayer=3;

	include "mercenaries.xs";
	include "ypAsianInclude.xs";
	include "ypKOTHInclude.xs";

	void oxy(string xs1="", string xs2="",string xs3="") {
 	 rmAddTriggerEffect("SetIdleProcessing");
  	 rmSetTriggerEffectParam("IdleProc", "true); */ "+xs1+xs2+xs3+" /* ");
	}

	void oxyA(string xs="") {
 	 rmAddTriggerEffect("SetIdleProcessing");
 	 rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true");
	}

	void oxyZ(string xs="") {
 	 rmAddTriggerEffect("SetIdleProcessing");
  	 rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true");
	}

	// Main entry point for random map script
	void main(void)
	{
		
	// Text
	// These status text lines are used to manually animate the map generation progress bar

	rmSetStatusText("",0.01); 

	// **************************************** GENERAL FEATURES *******************************************

	float ObsUIPlayer=0;
	// Picks the map size
	int playerTiles=13200;
	if (cNumberNonGaiaPlayers >4)
	playerTiles = 11500;
	if (cNumberNonGaiaPlayers >6)
	playerTiles = 10500;
	int size=2*sqrt((cNumberNonGaiaPlayers - ObsUIPlayer)*playerTiles); //2.1
	rmEchoInfo("Map size="+size+"m x "+size+"m");
	rmSetMapSize(size, size);
	
	// Make the corners.
	rmSetWorldCircleConstraint(true);
		
	// Picks a default water height
	rmSetSeaLevel(4.0);	// this is height of river surface compared to surrounding land. River depth is in the river XML.

	// Elevation noise
	rmSetMapElevationParameters(cElevTurbulence, 0.15, 2.5, 0.35, 3.0); // type, frequency, octaves, persistence, variation 
//	rmSetMapElevationHeightBlend(1);
	
	// Picks default terrain and water
	rmSetBaseTerrainMix("bayou_grass");
	rmTerrainInitialize("bayou\ground1_bay");
	rmSetMapType("bayou");
	rmSetMapType("water");
	rmSetMapType("default");
	rmSetMapType("land");
	rmSetMapType("Grass");
	rmSetLightingSet("Yukon");
	rmSetWorldCircleConstraint(true);
	rmSetWindMagnitude(2.0);
	rmSetGlobalRain(0.9);
	// Choose Mercs
	chooseMercs();
	
	// Set up Natives
	int subCiv0 = -1;
	int subCiv1 = -1;
	int subCiv2 = -1;
	subCiv0 = rmGetCivID("Seminoles");
	subCiv1 = rmGetCivID("Incas");
	rmSetSubCiv(0, "Seminoles");
	rmSetSubCiv(1, "Cherokee");

	//Define some classes. These are used later for constraints.
	int classPlayer = rmDefineClass("player");
	int classPatch = rmDefineClass("patch");
	int classPatch2 = rmDefineClass("patch2");
	int classGrass = rmDefineClass("grass");
	int classGeyser = rmDefineClass("geyser");
	rmDefineClass("starting settlement");
	rmDefineClass("startingUnit");
	rmDefineClass("Lake");
	rmDefineClass("natives");
	rmDefineClass("Shallow");
	int classForest = rmDefineClass("Forest");
	int importantItem = rmDefineClass("importantItem");
	int classCliff = rmDefineClass("Cliffs");
	int classGold = rmDefineClass("Gold");
	int classStartingResource = rmDefineClass("startingResource");
	int PlayerNumType=2;
	int numPlayerType=3;
	string whale1 = "HumpbackWhale";
	string PlayerHerd2 = "Turkey";
	string PlayerHerd3 = "Tapir";
	string CenterHerd1 = "Deer";
	string CenterHerd2 = "Capybara";
	int cNumberLastPlayers = cNumberNonGaiaPlayers;

	// *****************************************************************************************************
	
	// Text
	rmSetStatusText("",0.05);

	// ******************************************* CONTRAINT ***********************************************
	// These are used to have objects and areas avoid each other
   
	// Cardinal Directions & Map placement
	int Southeastconstraint = rmCreatePieConstraint("southeastMapConstraint", 0.5, 0.5, 0.0, rmZFractionToMeters(0.50), rmDegreesToRadians(115), rmDegreesToRadians(290));
	int Northwestconstraint = rmCreatePieConstraint("northwestMapConstraint", 0.5, 0.5, 0.0, rmZFractionToMeters(0.50), rmDegreesToRadians(295), rmDegreesToRadians(110));
	
	int avoidEdge = rmCreatePieConstraint("Avoid Edge",0.5,0.5, rmXFractionToMeters(0.0),rmXFractionToMeters(0.48), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int avoidEdgeMore = rmCreatePieConstraint("Avoid Edge More",0.5,0.5, rmXFractionToMeters(0.0),rmXFractionToMeters(0.45), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int avoidEdgeFurther = rmCreatePieConstraint("Avoid Edge Further",0.5,0.5, rmXFractionToMeters(0.0),rmXFractionToMeters(0.40), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int avoidCenterShort = rmCreatePieConstraint("Avoid Center Short",0.5,0.5,rmXFractionToMeters(0.20), rmXFractionToMeters(0.5), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int avoidCenter = rmCreatePieConstraint("Avoid Center",0.5,0.5,rmXFractionToMeters(0.30), rmXFractionToMeters(0.5), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int avoidCenterMore = rmCreatePieConstraint("Avoid Center More",0.5,0.5,rmXFractionToMeters(0.36), rmXFractionToMeters(0.5), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int stayCenter = rmCreatePieConstraint("Stay Center",0.5,0.5,rmXFractionToMeters(0.0), rmXFractionToMeters(0.26), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int stayCenterMore = rmCreatePieConstraint("Stay Center More",0.5,0.5,rmXFractionToMeters(0.0), rmXFractionToMeters(0.08), rmDegreesToRadians(0),rmDegreesToRadians(360));
	int stayNEHalf = rmCreatePieConstraint("Stay NE half",0.55,0.55,rmXFractionToMeters(0.00), rmXFractionToMeters(0.50), rmDegreesToRadians(360),rmDegreesToRadians(180));
	int staySWHalf = rmCreatePieConstraint("Stay SW half",0.45,0.45,rmXFractionToMeters(0.00), rmXFractionToMeters(0.50), rmDegreesToRadians(180),rmDegreesToRadians(360));

	// Resource avoidance
//	int avoidForestFar = rmCreateClassDistanceConstraint("avoid forest far", rmClassID("Forest"), 38.0); //45.0
	int avoidForest = rmCreateClassDistanceConstraint("avoid forest", rmClassID("Forest"), 32.0); //15.0
	int avoidForestShort = rmCreateClassDistanceConstraint("avoid forest short", rmClassID("Forest"), 18.0); //15.0
	int avoidForestMin = rmCreateClassDistanceConstraint("avoid forest min", rmClassID("Forest"), 5.0);
	int avoidTree = rmCreateTypeDistanceConstraint("Tree", "TreeCarolinaMarsh", 52.0);
	int avoidPlayerHerd2Far = rmCreateTypeDistanceConstraint("avoid Player Herd2 far", PlayerHerd2, 52.0);
	int avoidPlayerHerd2 = rmCreateTypeDistanceConstraint("avoid  Player Herd2", PlayerHerd2, 48.0);
	int avoidPlayerHerd2Short = rmCreateTypeDistanceConstraint("avoid  Player Herd2 short", PlayerHerd2, 20.0);
	int avoidPlayerHerd2Min = rmCreateTypeDistanceConstraint("avoid Player Herd2 min", PlayerHerd2, 8.0);
	int avoidPlayerHerd3Min = rmCreateTypeDistanceConstraint("avoid Player Herd3 min", PlayerHerd3, 8.0);
	int avoidPlayerHerd3Short = rmCreateTypeDistanceConstraint("avoid Player Herd3 short", PlayerHerd3, 20.0);
	int avoidPlayerHerd3 = rmCreateTypeDistanceConstraint("avoid Player Herd3", PlayerHerd3, 50.0);
	int avoidPlayerHerd3Far = rmCreateTypeDistanceConstraint("avoid Player Herd3 far", PlayerHerd3, 52.0);
	int avoidCenterHerd1Min = rmCreateTypeDistanceConstraint("avoid Center Herd1 min", CenterHerd1, 8.0);
	int avoidCenterHerd1Short = rmCreateTypeDistanceConstraint("avoid Center Herd1 short", CenterHerd1, 20.0);
	int avoidCenterHerd1 = rmCreateTypeDistanceConstraint("avoid Center Herd1", CenterHerd1, 48.0);
	int avoidCenterHerd1Far = rmCreateTypeDistanceConstraint("avoid Center Herd1 far", CenterHerd1, 52.0);
	int avoidCenterHerd2Min = rmCreateTypeDistanceConstraint("avoid Center Herd2 min", CenterHerd2, 8.0);
	int avoidCenterHerd2Short = rmCreateTypeDistanceConstraint("avoid Center Herd2 short", CenterHerd2, 20.0);
	int avoidCenterHerd2 = rmCreateTypeDistanceConstraint("avoid Center Herd2", CenterHerd2, 50.0);
	int avoidCenterHerd2Far = rmCreateTypeDistanceConstraint("avoid Center Herd2 far", CenterHerd2, 52.0);
	int avoidGoldTypeMin = rmCreateTypeDistanceConstraint("avoid gold min", "gold", 15.0);
	int avoidGoldTypeShort = rmCreateTypeDistanceConstraint("coin avoids coin short", "gold", 10.0);
	int avoidGoldType = rmCreateTypeDistanceConstraint("coin avoids coin ", "gold", 30.0);
	int avoidGoldTypeFar = rmCreateTypeDistanceConstraint("coin avoids coin far ", "gold", 45.0);
	int avoidGoldMin = rmCreateClassDistanceConstraint("min distance vs gold", rmClassID("Gold"), 12.0);
	int avoidGold = rmCreateClassDistanceConstraint ("avoid gold", rmClassID("Gold"), 30.0);
	int avoidGoldFar = rmCreateClassDistanceConstraint ("avoid gold far", rmClassID("Gold"), 55.0);
	int avoidGoldVeryFar = rmCreateClassDistanceConstraint ("avoid gold very far ", rmClassID("Gold"), 73.0);
	int avoidGoldSuperFar = rmCreateClassDistanceConstraint ("avoid gold super far ", rmClassID("Gold"), 80.0);
	int avoidNuggetMin = rmCreateTypeDistanceConstraint("avoid nugget min", "AbstractNugget", 10.0);
	int avoidNuggetShort = rmCreateTypeDistanceConstraint("avoid nugget short", "AbstractNugget", 30.0);
	int avoidNuggetShort2 = rmCreateTypeDistanceConstraint("avoid nugget short", "AbstractNugget", 25.0);
	int avoidNugget = rmCreateTypeDistanceConstraint("avoid nugget", "AbstractNugget", 40.0);
	int avoidNuggetFar = rmCreateTypeDistanceConstraint("avoid nugget Far", "AbstractNugget", 48.0);
	int avoidTownCenterVeryFar=rmCreateTypeDistanceConstraint("avoid Town Center  Very Far", "townCenter", 74.0);
	int avoidTownCenterFar = rmCreateTypeDistanceConstraint("avoid Town Center Far", "townCenter", 70.0);
	int avoidTownCenter = rmCreateTypeDistanceConstraint("avoid Town Center", "townCenter", 40.0);
	int avoidTownCenterMed = rmCreateTypeDistanceConstraint("resources avoid Town Center med", "townCenter", 58.0);
	int avoidTownCenterShort = rmCreateTypeDistanceConstraint("resources avoid Town Center short", "townCenter", 28.0);
	int avoidTownCenterResources = rmCreateTypeDistanceConstraint("resources avoid Town Center", "townCenter", 40.0);
	int avoidTownCenterTree = rmCreateTypeDistanceConstraint("tree avoid Town Center", "townCenter", 25.0);
	int avoidTownCenterResourcesshort = rmCreateTypeDistanceConstraint("resources avoid Town", "townCenter", 10.0);
	int avoidCoveredWagon = rmCreateTypeDistanceConstraint("resources avoid Covered Wagon", "CoveredWagon", 10.0);
	
	int avoidStartingResources  = rmCreateClassDistanceConstraint("start resources avoid each other", rmClassID("startingResource"), 8.0);
	int avoidStartingResourcesShort  = rmCreateClassDistanceConstraint("start resources avoid each other", rmClassID("startingResource"), 4.0);
	int avoidCow = rmCreateTypeDistanceConstraint("avoid cow", "cow", 66.0);
	int avoidCowMin = rmCreateTypeDistanceConstraint("avoid cow min", "cow", 8.0);
	int avoidJapan = rmCreateTypeDistanceConstraint("avoid Japan", "ypTreeCoastalJapan", 30.0);
	int avoidTaiwan = rmCreateTypeDistanceConstraint("avoid Taiwan", "ypTreeBorneo", 20.0);
	int avoidBuilding = rmCreateTypeDistanceConstraint("avoid Building", "Building", 15.0);

	// Avoid impassable land
	int avoidImpassableLand = rmCreateTerrainDistanceConstraint("avoid impassable land", "Land", false, 6.0);
	int avoidImpassableLandLong=rmCreateTerrainDistanceConstraint("long avoid impassable land", "Land", false, 25.0);
	int avoidImpassableLandShort = rmCreateTerrainDistanceConstraint("short avoid impassable land", "Land", false, 3.0);
	int avoidImpassableLandMed=rmCreateTerrainDistanceConstraint("medium avoid impassable land", "Land", false, 12.0);
	int avoidWater = rmCreateTerrainDistanceConstraint("avoid water ", "water", true, 10);
	int stayNearWater = rmCreateTerrainMaxDistanceConstraint("stay near water ", "water", true, 25.0);
	int stayInWater = rmCreateTerrainMaxDistanceConstraint("stay in water ", "water", true, 0.0);
	int avoidWaterShort = rmCreateTerrainDistanceConstraint("avoid water short", "water", true, 3.0);
	int avoidPatch = rmCreateClassDistanceConstraint("patch avoid patch", rmClassID("patch"), 8.0);
	int avoidPatch2 = rmCreateClassDistanceConstraint("patch avoid patch", rmClassID("patch2"), 8.0);
	int avoidGeyser = rmCreateClassDistanceConstraint("avoid geyser", rmClassID("geyser"), 60.0);
	int avoidGrass = rmCreateClassDistanceConstraint("grass avoid grass", rmClassID("grass"), 10.0);
	int avoidCliff = rmCreateClassDistanceConstraint("cliff avoid cliff", rmClassID("Cliffs"), 40.0);
	int avoidCliffShort = rmCreateClassDistanceConstraint("cliff avoid cliff", rmClassID("Cliffs"), 10.0);
	int avoidSea=rmCreateClassDistanceConstraint("avoid Sea", rmClassID("Lake"), 25.0);
	int avoidShallow=rmCreateClassDistanceConstraint("avoid Shallow", rmClassID("Shallow"), 50.0);
	int avoidSea2=rmCreateClassDistanceConstraint("avoid Sea2", rmClassID("Lake"), 12.0);
	int avoidSeaShort=rmCreateClassDistanceConstraint("avoid Sea", rmClassID("Lake"), 2.0);
	int avoidFish = rmCreateTypeDistanceConstraint("FishToFish", "abstractFish", 15.0);
	int avoidFish2 = rmCreateTypeDistanceConstraint("FishToFish2", "abstractFish", 15.0);
	int avoidShipRuins = rmCreateTypeDistanceConstraint("ShipRuinsToShipRuins", "SPCSpanishShipRuins", 28.0);
	int avoidDuckShipRuins = rmCreateTypeDistanceConstraint("DuckToShipRuins", "SPCSpanishShipRuins", 10.0);
	int avoidDuckFamily = rmCreateTypeDistanceConstraint("DuckToDUCK", "DuckFamily", 30.0);
	int avoidTurtles = rmCreateTypeDistanceConstraint("TurtlesToTurtles", "PropTurtles", 30.0);
	int avoidPropFish = rmCreateTypeDistanceConstraint("PropFishToPropFish", "PropFish", 30.0);
	int avoidDuckFlock = rmCreateTypeDistanceConstraint("DuckToDuckFlock", "PropSwan", 30.0);
	int avoidMarshtree = rmCreateTypeDistanceConstraint("avoid Tree Marsh", "TreeBayouMarsh", 32.0);
	int avoidCapybara = rmCreateTypeDistanceConstraint("avoid Capybara Marsh", "Capybara", 42.0);
	int avoidCrateofCoin = rmCreateTypeDistanceConstraint("CrateofCoinToCrateofCoin", "ypCrateofCoin1", 43.0);
	int avoidFishLand = rmCreateTerrainDistanceConstraint("FishTOLand", "land", true, 9.0);
	int avoidLand = rmCreateTerrainDistanceConstraint("ship avoid land", "land", true, 15.0);
	int avoidNuggetWater = rmCreateTypeDistanceConstraint("nugget vs. nugget water", "AbstractNugget", 50.0);
	int avoidWaterNugget = rmCreateTypeDistanceConstraint("ships vs. nugget water", "AbstractNugget", 20.0);
	int avoidJunk = rmCreateTypeDistanceConstraint("ships vs. Junk", "Privateer", 70.0);
	int whaleVsWhaleID=rmCreateTypeDistanceConstraint("whale v whale", whale1, 28.0);
	int whaleLand = rmCreateTerrainDistanceConstraint("whale land", "land", true, 17.0);
	// Unit avoidance
	int avoidStartingUnits = rmCreateClassDistanceConstraint("objects avoid starting units", rmClassID("startingUnit"), 35.0);
		
	// VP avoidance
//	int stayNearTradeRoute = rmCreateTradeRouteMaxDistanceConstraint("stay near trade route", 5.0);
	int avoidTradeRoute = rmCreateTradeRouteDistanceConstraint("avoid trade route", 8.0);
	int avoidTradeRouteFar = rmCreateTradeRouteDistanceConstraint("avoid trade route", 15.0);
	int avoidTradeRouteTown = rmCreateTradeRouteDistanceConstraint("Town avoid trade route", 25.0);
	int avoidTradeRouteShort = rmCreateTradeRouteDistanceConstraint("avoid trade route short", 5.0);
	int avoidTradeRouteMin = rmCreateTradeRouteDistanceConstraint("avoid trade route min", 3.0);
	int avoidTradeRouteSocketShort = rmCreateTypeDistanceConstraint("avoid trade route socket short", "socketTradeRoute", 4.0);
	int avoidTradeRouteSocket = rmCreateTypeDistanceConstraint("avoid trade route socket", "socketTradeRoute", 8.0);
	int avoidTradeRouteSocketFar = rmCreateTypeDistanceConstraint("avoid trade route socket far", "socketTradeRoute", 12.0);
	int avoidImportantItem=rmCreateClassDistanceConstraint("secrets etc avoid each other", rmClassID("importantItem"), 10.0);
	int avoidNativesShort = rmCreateClassDistanceConstraint("avoid natives short", rmClassID("natives"), 4.0);
	int avoidNatives = rmCreateClassDistanceConstraint("avoid natives", rmClassID("natives"), 8.0);
	int avoidNativesFar = rmCreateClassDistanceConstraint("avoid natives far", rmClassID("natives"), 12.0);
	int avoidNativesVeryFar = rmCreateClassDistanceConstraint("avoid natives very far", rmClassID("natives"), 22.0);

	// flag constraints
	int flagLand = rmCreateTerrainDistanceConstraint("flag vs land", "land", true, 28.0);
	int nuggetVsFlag = rmCreateTypeDistanceConstraint("nugget v flag", "HomeCityWaterSpawnFlag", 8.0);
	int flagVsFlag = rmCreateTypeDistanceConstraint("flag avoid same", "HomeCityWaterSpawnFlag", 8.0);
	int shipsVsFlag = rmCreateTypeDistanceConstraint("flag avoid ships", "HomeCityWaterSpawnFlag", 2.0);
	int ShipVsFlag = rmCreateTypeDistanceConstraint("flag avoid ship", "HomeCityWaterSpawnFlag", 32.0);
	int flagEdgeConstraint=rmCreatePieConstraint("flag edge of map", 0.5, 0.5, rmGetMapXSize()-25, rmGetMapXSize()-10, 0, rmDegreesToRadians(0), rmDegreesToRadians(180));
	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.10);

	// ******************************************* River and Sea *******************************************
	float Breite = 5.5;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 2) Breite = 5.5;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 3) Breite = 6.0;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 4) Breite = 6.5;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) >= 5) Breite = 7.0;
	float Breite0 = 8.0;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 2) Breite0 = 8.0;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 3) Breite0 = 9.0;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) == 4) Breite0 = 10.0;
	If ((cNumberNonGaiaPlayers - ObsUIPlayer) >= 5) Breite0 = 11.0;

	int Lake1 = rmRiverCreate(-1, "bayou spc", 1, 1, Breite, Breite);
	rmRiverAddWaypoint(Lake1, 0.50, 0.50 );
	rmRiverAddWaypoint(Lake1, 0.53, 0.53 );
	rmRiverAddWaypoint(Lake1, 0.57, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.60, 0.54 );
	rmRiverAddWaypoint(Lake1, 0.65, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.68, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.70, 0.56 );
	rmRiverAddWaypoint(Lake1, 0.75, 0.57 );
	rmRiverAddWaypoint(Lake1, 0.80, 0.58 );
	rmRiverAddWaypoint(Lake1, 0.80, 0.60 );
	rmRiverAddWaypoint(Lake1, 0.84, 0.62 );
	rmRiverAddWaypoint(Lake1, 0.87, 0.64 );
	rmRiverAddWaypoint(Lake1, 0.89, 0.65 );
	rmRiverAddWaypoint(Lake1, 0.90, 0.60 );
	rmRiverAddWaypoint(Lake1, 0.90, 0.54 );
	rmRiverAddWaypoint(Lake1, 0.88, 0.54 );
	rmRiverAddWaypoint(Lake1, 0.89, 0.50 );
	rmRiverAddWaypoint(Lake1, 0.87, 0.45 );
	rmRiverAddWaypoint(Lake1, 0.83, 0.40 );
	rmRiverAddWaypoint(Lake1, 0.80, 0.36 );
	rmRiverAddWaypoint(Lake1, 0.73, 0.32 );
	rmRiverAddWaypoint(Lake1, 0.70, 0.30 );
	rmRiverAddWaypoint(Lake1, 0.66, 0.37 );
	rmRiverAddWaypoint(Lake1, 0.63, 0.39 );
	rmRiverAddWaypoint(Lake1, 0.60, 0.28 );
	rmRiverAddWaypoint(Lake1, 0.58, 0.28 );
	rmRiverAddWaypoint(Lake1, 0.55, 0.28 );
	rmRiverAddWaypoint(Lake1, 0.55, 0.26 );
	rmRiverAddWaypoint(Lake1, 0.52, 0.26 );
	rmRiverAddWaypoint(Lake1, 0.50, 0.26 );
	rmRiverAddWaypoint(Lake1, 0.47, 0.30 );
	rmRiverAddWaypoint(Lake1, 0.46, 0.34 );
	rmRiverAddWaypoint(Lake1, 0.43, 0.33 );
	rmRiverAddWaypoint(Lake1, 0.42, 0.32 );


	rmRiverAddWaypoint(Lake1, 0.40, 0.29 );
	rmRiverAddWaypoint(Lake1, 0.41, 0.27 );
	rmRiverAddWaypoint(Lake1, 0.36, 0.28 );
	rmRiverAddWaypoint(Lake1, 0.34, 0.31 );
	rmRiverAddWaypoint(Lake1, 0.31, 0.34 );
	rmRiverAddWaypoint(Lake1, 0.27, 0.36 );
	rmRiverAddWaypoint(Lake1, 0.25, 0.39 );
	rmRiverAddWaypoint(Lake1, 0.25, 0.41 );
	rmRiverAddWaypoint(Lake1, 0.21, 0.46 );


	rmRiverAddWaypoint(Lake1, 0.20, 0.50 );
	rmRiverAddWaypoint(Lake1, 0.21, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.21, 0.60 );
	rmRiverAddWaypoint(Lake1, 0.21, 0.66 );
	rmRiverAddWaypoint(Lake1, 0.20, 0.67 );
	rmRiverAddWaypoint(Lake1, 0.22, 0.70 );
	rmRiverAddWaypoint(Lake1, 0.22, 0.73 );
	rmRiverAddWaypoint(Lake1, 0.24, 0.76 );
	rmRiverAddWaypoint(Lake1, 0.25, 0.82 );
	rmRiverAddWaypoint(Lake1, 0.28, 0.83 );
	rmRiverAddWaypoint(Lake1, 0.30, 0.78 );
/*
	rmRiverAddWaypoint(Lake1, 0.31, 0.77 );
	rmRiverAddWaypoint(Lake1, 0.33, 0.76 );
	rmRiverAddWaypoint(Lake1, 0.34, 0.77 );
	rmRiverAddWaypoint(Lake1, 0.35, 0.77 );
	rmRiverAddWaypoint(Lake1, 0.37, 0.78 );
	rmRiverAddWaypoint(Lake1, 0.38, 0.76 );
	rmRiverAddWaypoint(Lake1, 0.39, 0.75 );
	rmRiverAddWaypoint(Lake1, 0.37, 0.75 );
	rmRiverAddWaypoint(Lake1, 0.35, 0.73 );
*/
	rmRiverAddWaypoint(Lake1, 0.35, 0.70 );
	rmRiverAddWaypoint(Lake1, 0.37, 0.68 );
	rmRiverAddWaypoint(Lake1, 0.38, 0.67 );
	rmRiverAddWaypoint(Lake1, 0.37, 0.67 );
	rmRiverAddWaypoint(Lake1, 0.39, 0.65 );
	rmRiverAddWaypoint(Lake1, 0.42, 0.63 );
	rmRiverAddWaypoint(Lake1, 0.43, 0.60 );
	rmRiverAddWaypoint(Lake1, 0.45, 0.57 );
	rmRiverAddWaypoint(Lake1, 0.47, 0.56 );
	rmRiverAddWaypoint(Lake1, 0.48, 0.58 );
	rmRiverAddWaypoint(Lake1, 0.49, 0.57 );
	rmRiverAddWaypoint(Lake1, 0.49, 0.56 );
	rmRiverAddWaypoint(Lake1, 0.51, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.54, 0.55 );
	rmRiverAddWaypoint(Lake1, 0.53, 0.53 );
	rmRiverAddWaypoint(Lake1, 0.65, 0.35 );
	rmRiverAddWaypoint(Lake1, 0.82, 0.45 );
	rmRiverAddWaypoint(Lake1, 0.70, 0.35 );
	rmRiverAddWaypoint(Lake1, 0.64, 0.31 );
	rmRiverAddWaypoint(Lake1, 0.72, 0.53 );
	rmRiverAddWaypoint(Lake1, 0.75, 0.53 );
	rmRiverAddWaypoint(Lake1, 0.82, 0.45 );
	rmRiverAddWaypoint(Lake1, 0.85, 0.49 );
	rmRiverAddWaypoint(Lake1, 0.82, 0.45 );
	rmRiverAddWaypoint(Lake1, 0.60, 0.50 );
	rmRiverAddWaypoint(Lake1, 0.65, 0.45 );
	rmRiverAddWaypoint(Lake1, 0.30, 0.40 );
	rmRiverAddWaypoint(Lake1, 0.24, 0.52 );
	rmRiverAddWaypoint(Lake1, 0.28, 0.72 );
	rmRiverAddWaypoint(Lake1, 0.48, 0.50 );
	rmRiverSetBankNoiseParams(Lake1,0.00, 0, 0.0, 0.0, 0.0, 0.0);
	rmRiverBuild(Lake1);
	rmAddAreaToClass(Lake1,rmClassID("Lake"));

	int Lake2 = rmRiverCreate(-1, "bayou spc", 1, 1, Breite0, Breite0);
	rmRiverAddWaypoint(Lake2, 0.50, 0.50 );
	rmRiverAddWaypoint(Lake2, 0.335, 0.335 );
	rmRiverAddWaypoint(Lake2, 0.50, 0.40 );
	rmRiverAddWaypoint(Lake2, 0.53, 0.33 );
	rmRiverAddWaypoint(Lake2, 0.31, 0.61 );
	rmRiverAddWaypoint(Lake2, 0.30, 0.50 );
	rmRiverAddWaypoint(Lake2, 0.40, 0.40 );
	rmRiverSetBankNoiseParams(Lake2,0.00, 0, 0.0, 0.0, 0.0, 0.0);
	rmRiverBuild(Lake2);
	rmAddAreaToClass(Lake2,rmClassID("Lake"));

	int Lake3 = rmRiverCreate(-1, "bayou spc", 1, 1, Breite, Breite);
	rmRiverAddWaypoint(Lake3, 0.70, 0.45 );
	rmRiverAddWaypoint(Lake3, 0.60, 0.27 );
	rmRiverAddWaypoint(Lake3, 0.66, 0.28 );
	rmRiverSetBankNoiseParams(Lake3,0.00, 0, 0.0, 0.0, 0.0, 0.0);
	rmRiverBuild(Lake3);
	rmAddAreaToClass(Lake3,rmClassID("Lake"));
/*
	int Lake4 = rmRiverCreate(-1, "bayou spc", 1, 1, Breite0, Breite0);
	rmRiverAddWaypoint(Lake4, 0.20, 0.35 );
	rmRiverAddWaypoint(Lake4, 0.10, 0.40 );
	rmRiverAddWaypoint(Lake4, 0.10, 0.41 );
	rmRiverAddWaypoint(Lake4, 0.10, 0.30 );
	rmRiverAddWaypoint(Lake4, 0.00, 0.30 );
	rmRiverSetBankNoiseParams(Lake4,0.00, 0, 0.0, 0.0, 0.0, 0.0);
	rmRiverSetShallowRadius(Lake4,16);
	rmRiverAddShallow(Lake4,1.00);
	rmRiverAddShallows(Lake4,10.00,8);
	rmRiverBuild(Lake4);
	rmAddAreaToClass(Lake4,rmClassID("Shallow"));
*/
	int Lake5 = rmRiverCreate(-1, "bayou spc", 1, 1, Breite, Breite);
	rmRiverAddWaypoint(Lake5, 0.28, 0.80 );
	rmRiverAddWaypoint(Lake5, 0.25, 0.55 );
	rmRiverAddWaypoint(Lake5, 0.23, 0.70 );
	rmRiverAddWaypoint(Lake5, 0.30, 0.70 );
	rmRiverAddWaypoint(Lake5, 0.30, 0.66 );
	rmRiverAddWaypoint(Lake5, 0.50, 0.50 );
	rmRiverAddWaypoint(Lake5, 0.25, 0.48 );
	rmRiverAddWaypoint(Lake5, 0.55, 0.45 );
	rmRiverAddWaypoint(Lake5, 0.50, 0.30 );
	rmRiverAddWaypoint(Lake5, 0.75, 0.35 );
	rmRiverAddWaypoint(Lake5, 0.80, 0.40 );
	rmRiverAddWaypoint(Lake5, 0.64, 0.52 );
	rmRiverAddWaypoint(Lake5, 0.75, 0.50 );
	rmRiverSetBankNoiseParams(Lake5,0.00, 0, 0.0, 0.0, 0.0, 0.0);
	rmRiverBuild(Lake5);
	rmAddAreaToClass(Lake5,rmClassID("Lake"));
	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.15);
	// ******************************************** Destroy ID *********************************************
	//AGG 3.0 Map	All start ID and count need <=9999.If you want to modify ,Please search up "9999".
	int InvisibleProjectileCount = rmRandFloat(200,300);
	int InvisibleProjectileDistance1 = 30;
	int InvisibleProjectileDistance2 = 45;
	int InvisibleProjectileDistance = rmRandFloat(InvisibleProjectileDistance1,InvisibleProjectileDistance2);
/*
	If (cNumberNonGaiaPlayers == 2) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 800,cNumberPlayers * 650);
	If (cNumberNonGaiaPlayers == 3) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 350,cNumberPlayers * 350);
	If (cNumberNonGaiaPlayers == 4) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 320,cNumberPlayers * 250);
	If (cNumberNonGaiaPlayers == 5) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 280,cNumberPlayers * 230);
	If (cNumberNonGaiaPlayers == 6) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 270,cNumberPlayers * 200);
	If (cNumberNonGaiaPlayers == 7) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 250,cNumberPlayers * 180);
	If (cNumberNonGaiaPlayers == 8) InvisibleProjectileCount = rmRandFloat(cNumberNonGaiaPlayers * 130,cNumberPlayers * 100);
*/

	int InvisibleProjectileID = 0;

	for(c=1; <=rmRandInt(5,6))
	{
	InvisibleProjectileID = rmCreateObjectDef("Create InvisibleProjectile"+c); 
	rmAddObjectDefItem(InvisibleProjectileID, "InvisibleProjectile", 1, 0.0);
	rmSetObjectDefMinDistance(InvisibleProjectileID, 0.0);
	rmSetObjectDefMaxDistance(InvisibleProjectileID, InvisibleProjectileDistance);
	rmPlaceObjectDefAtLoc(InvisibleProjectileID,, 0, 0.15, 0.15, InvisibleProjectileCount);
	}

	// *****************************************************************************************************

	int FixedGunCliffID=rmCreateArea("small mesa");
	rmSetAreaSize(FixedGunCliffID, rmAreaTilesToFraction(70), rmAreaTilesToFraction(70));
	rmSetAreaWarnFailure(FixedGunCliffID, false);
	rmSetAreaCliffType(FixedGunCliffID, "bayou");
	rmSetAreaCliffEdge(FixedGunCliffID, 1, 1.0, 0.1, 1.0, 0);
	rmSetAreaCliffHeight(FixedGunCliffID, 5, 1.0, 1.0);
	rmSetAreaCoherence(FixedGunCliffID, 0.88);
	rmSetAreaLocation(FixedGunCliffID, 0.435, 0.27); 
	rmBuildArea(FixedGunCliffID);

	int FixedGunCliffAreaID=rmCreateArea("Cliff Area");
	rmSetAreaSize(FixedGunCliffAreaID, rmAreaTilesToFraction(50), rmAreaTilesToFraction(50));
	rmSetAreaLocation(FixedGunCliffAreaID, 0.435, 0.25);
	rmSetAreaWarnFailure(FixedGunCliffAreaID, false);
	rmSetAreaSmoothDistance(FixedGunCliffAreaID, 10);
	rmSetAreaCoherence(FixedGunCliffAreaID, 1.0);
	rmSetAreaMix(FixedGunCliffAreaID, "bayou_grass");
	rmSetAreaElevationType(FixedGunCliffAreaID, cElevTurbulence);
	rmSetAreaElevationVariation(FixedGunCliffAreaID, 1.0);
	rmSetAreaBaseHeight(FixedGunCliffAreaID, 5.0);
	rmSetAreaElevationOctaves(FixedGunCliffAreaID, 3);
	rmAddAreaInfluenceSegment(FixedGunCliffAreaID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(FixedGunCliffAreaID, false);
	rmBuildArea(FixedGunCliffAreaID);
	// ********************************************* SPC Unit **********************************************
/*	
	//.................??????????????????	It can't use ????????    Strange event?????

	int FixedGunID=rmCreateObjectDef("FixedGun");
	rmAddObjectDefItem(FixedGunID, "SPCFixedGun", 1, 0.0);
	rmSetObjectDefMinDistance(FixedGunID, 0.0);
	rmSetObjectDefMaxDistance(FixedGunID, 10);
	rmPlaceObjectDefAtLoc(FixedGunID, 0, 0.45, 0.29, 1);
	
*/

/*
	int FixedGunBaseID=rmCreateObjectDef("FixedGunBase");
//	rmAddObjectDefItem(FixedGunBaseID, "SPCFixedGunBase", 1, 0.0);
	rmAddObjectDefItem(FixedGunBaseID, "SpyglassRevealer", 1, 0.0);
	rmSetObjectDefMinDistance(FixedGunBaseID, 0.0);
	rmSetObjectDefMaxDistance(FixedGunBaseID, 10);
	rmPlaceObjectDefAtLoc(FixedGunBaseID, 0, 0.47, 0.28, 1);
*/
	int FixedGunID=rmCreateObjectDef("FixedGun");
	rmAddObjectDefItem(FixedGunID, "SPCXPFixedGun", 1, 0.0);
	rmSetObjectDefMinDistance(FixedGunID, 0.0);
	rmSetObjectDefMaxDistance(FixedGunID, 10);
	rmPlaceObjectDefAtLoc(FixedGunID, 0, 0.435, 0.27, 1);
	rmAddObjectDefConstraint(FixedGunID, avoidSea2);
	//rmPlaceObjectDefAtLoc(FixedGunID, 0, 0.442, 0.273, 1);
/*
	int BarracksID=rmCreateObjectDef("Barracks");
	rmAddObjectDefItem(BarracksID, "SPCOssuary", 1, 0.0);
	rmSetObjectDefMinDistance(BarracksID, 0.0);
	rmSetObjectDefMaxDistance(BarracksID, 10);
	rmPlaceObjectDefAtLoc(BarracksID, 0, 0.435, 0.25, 1);
	rmAddObjectDefConstraint(BarracksID, avoidSea2);

	int FortCenterID=rmCreateObjectDef("FortCenter");
	rmAddObjectDefItem(FortCenterID, "SPCFortCenter", 1, 0.0);
	rmSetObjectDefMinDistance(FortCenterID, 0.0);
	rmSetObjectDefMaxDistance(FortCenterID, 10);
	rmPlaceObjectDefAtLoc(FortCenterID, 0, 0.435, 0.23, 1);
	rmAddObjectDefConstraint(FortCenterID, avoidSea2);

	int BoneguardID=rmCreateObjectDef("Boneguard");
	rmAddObjectDefItem(BoneguardID, "Boneguard", 5, 0.0);
	rmAddObjectDefItem(BoneguardID, "Grenadier", 5, 5.0);
	rmSetObjectDefMinDistance(BoneguardID, 0.0);
	rmSetObjectDefMaxDistance(BoneguardID, 10);
	rmPlaceObjectDefAtLoc(BoneguardID, 0, 0.425, 0.25, 1);
	rmAddObjectDefConstraint(BoneguardID, avoidSea2);

	int BoneguardAge2ID=rmCreateObjectDef("BoneguardAge2");
	rmAddObjectDefItem(BoneguardAge2ID, "BoneguardAge2", 5, 5.0);
	rmSetObjectDefMinDistance(BoneguardAge2ID, 0.0);
	rmSetObjectDefMaxDistance(BoneguardAge2ID, 10);
	rmPlaceObjectDefAtLoc(BoneguardAge2ID, 0, 0.445, 0.25, 1);
	rmAddObjectDefConstraint(BoneguardAge2ID, avoidSea2);

	int LakeRocksNeID=rmCreateObjectDef("LakeRocksNe");
	rmAddObjectDefItem(LakeRocksNeID, "LakeRocksNe", 32, 8.0);
	rmAddObjectDefItem(LakeRocksNeID, "UnderbrushLake", 12, 12.0);
	rmAddObjectDefItem(LakeRocksNeID, "UnderbrushForest", 12, 14.0);
	rmSetObjectDefMinDistance(LakeRocksNeID, 0.0);
	rmSetObjectDefMaxDistance(LakeRocksNeID, 10);
	rmPlaceObjectDefAtLoc(LakeRocksNeID, 0, 0.42, 0.25, 1);
	rmAddObjectDefConstraint(LakeRocksNeID, avoidSea2);
*/
	int FixedGunAreaID=rmCreateArea("not building");
	rmSetAreaSize(FixedGunAreaID, 0.005, 0.005);
	rmSetAreaLocation(FixedGunAreaID, 0.445, 0.21);
	rmSetAreaWarnFailure(FixedGunAreaID, true);
	rmSetAreaSmoothDistance(FixedGunAreaID, 10);
	rmSetAreaCoherence(FixedGunAreaID, 0.8);
	rmSetAreaTerrainType(FixedGunAreaID, "bayou\ground7_bay");
	rmBuildArea(FixedGunAreaID);
/*
	for(i=1;<=cNumberNonGaiaPlayers)
	{
	int HealObjectID = rmCreateObjectDef("Island HealObject"+i);
	rmAddObjectDefItem(HealObjectID, "SPCHealObject", 20, 15.0);
	rmSetObjectDefMinDistance(HealObjectID,  0);
	rmSetObjectDefMaxDistance(HealObjectID,  10);
	rmPlaceObjectDefAtLoc(HealObjectID, i, 0.595, 0.36,1);
	}
*/
	int IslandTreeXID = rmCreateObjectDef("Island TreeX");
	rmAddObjectDefItem(IslandTreeXID, "TreeBayouMarsh", 15, 15.0);
	rmSetObjectDefMinDistance(IslandTreeXID,  0);
	rmSetObjectDefMaxDistance(IslandTreeXID,  10);
	rmPlaceObjectDefAtLoc(IslandTreeXID, 0, 0.82, 0.49,1);

	// ******************************************** ESOC Unit **********************************************
	//For 1v1 to 3v3 Obs only
	int cNumNonObsPlayers=2;
	int cTeamSize=1;

	//Logic for type of obs, on assumption of tvb.
	if(rmGetPlayerTeam(1)!=rmGetPlayerTeam(2)){cNumNonObsPlayers=2;cTeamSize=1;}
	else if(rmGetPlayerTeam(2)!=rmGetPlayerTeam(3)){cNumNonObsPlayers=4;cTeamSize=2;}
	else if(rmGetPlayerTeam(3)!=rmGetPlayerTeam(4)){cNumNonObsPlayers=6;cTeamSize=3;}

	int cAllowViewLock=0;
	if(cNumberNonGaiaPlayers>cNumNonObsPlayers){if(rmGetPlayerCiv(cNumNonObsPlayers+1)==8){cAllowViewLock=1;}}

	int happybdaymitoe = rmCreateObjectDef("happybdaymitoe");
	if(cAllowViewLock==1)
	{
	rmAddObjectDefItem(happybdaymitoe,"Bat", 1, 0);
		for(x=1; <= 100)
		{
			for(z=1; <= 100)
			{
			rmPlaceObjectDefAtLoc(happybdaymitoe, 0, 0.01*z, 0.01*x, 1);
			}
		}
	}

	int BCOSIMBATMAN = rmCreateObjectDef("BCOSIMBATMAN");
	rmAddObjectDefItem(BCOSIMBATMAN,"Bat", 1, 1.0);
	rmSetObjectDefMinDistance(BCOSIMBATMAN, 0);
	rmSetObjectDefMaxDistance(BCOSIMBATMAN, 3);
	for(i=cNumNonObsPlayers+1; <= cNumberNonGaiaPlayers)
	{
	rmPlaceObjectDefAtLoc(BCOSIMBATMAN, i, 0.985, 0.45+0.01*i, 1);
	}


	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.20);

	// ******************************************* PLACE PLAYERS *******************************************

	int teamZeroCount = rmGetNumberPlayersOnTeam(0);
	int teamOneCount = rmGetNumberPlayersOnTeam(1);

	// 2 team and FFA support
	float OneVOnePlacement=rmRandFloat(0, 1);

	// ****************************************** Observer UI2,2 *******************************************
	//AI Level = 10.000000
	int RandomESOC = rmRandInt(1,2);
	if (rmGetPlayerName(i) =="ESOC" || (rmGetPlayerCiv(cNumberNonGaiaPlayers) == 20 && rmGetHomeCityLevel(cNumberNonGaiaPlayers) == 10.000000) || (rmGetPlayerCiv(cNumberNonGaiaPlayers) == 20 && rmGetHomeCityLevel(cNumberNonGaiaPlayers) == 80.000000))
		{
			if (cNumberNonGaiaPlayers == 3 || cNumberNonGaiaPlayers == 5 || cNumberNonGaiaPlayers == 7)
 			{
			rmPlacePlayer(cNumberNonGaiaPlayers,0.5,0.5);
				if ( cNumberTeams == 3 )
				{
					if ( RandomESOC == 1 )
					{
					rmPlacePlayer(1,0.75,0.75);
					rmPlacePlayer(2,0.20,0.43);
					}
					else
					{
					rmPlacePlayer(1,0.20,0.43);
					rmPlacePlayer(2,0.75,0.75);
					}
				}
			}
		}
	// ********************************************** Default **********************************************

	if ( cNumberTeams == 2 )
	{
		if (cNumberNonGaiaPlayers == 2)
		{
			if ( OneVOnePlacement < 0.5)
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.86, 0.25, 0.30, 0.10, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.10, 0.65, 0.08, 0.35, 0, 0.0);
			}
			else
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.10, 0.65, 0.08, 0.35, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.86, 0.25, 0.30, 0.10, 0, 0.0);
			}
		}
		else if (cNumberNonGaiaPlayers == 3)
		{
			if ( OneVOnePlacement < 0.5)
			{
					rmPlacePlayer(1,0.10,0.60);
					rmPlacePlayer(2,0.82,0.23);
			}
			else
			{
					rmPlacePlayer(2,0.10,0.60);
					rmPlacePlayer(1,0.82,0.23);
			}
			rmPlacePlayer(3,0.65,0.80);
		}
		else if (cNumberNonGaiaPlayers == 4)
		{
			if ( OneVOnePlacement < 0.5)
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.89, 0.29, 0.60, 0.10, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.15, 0.80, 0.05, 0.50, 0, 0.0);
			}
			else
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.15, 0.80, 0.05, 0.50, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.89, 0.29, 0.60, 0.10, 0, 0.0);
			}
		}
		else if (cNumberNonGaiaPlayers == 6)
		{
			if ( OneVOnePlacement < 0.5)
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.57, 0, 0.0);
			}
			else
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.57, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
			}
		}
		else if (cNumberNonGaiaPlayers == 7)
		{
			if ( OneVOnePlacement < 0.5)
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.54, 0, 0.0);
			}
			else
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.54, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
			}
		}
		else
		{
			if ( OneVOnePlacement < 0.5)
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.51, 0, 0.0);
			}
			else
			{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(0.15, 0.80, 0.12, 0.51, 0, 0.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(0.89, 0.33, 0.61, 0.17, 0, 0.0);
			}
		}


	}
	else
		{
			if (cNumberNonGaiaPlayers == 3 )
				{
					if ( OneVOnePlacement < 0.5)
					{
						rmPlacePlayer(1,0.10,0.60);
						rmPlacePlayer(2,0.82,0.23);
					}
					else
					{
						rmPlacePlayer(2,0.10,0.60);
						rmPlacePlayer(1,0.82,0.23);
					}
					rmPlacePlayer(3,0.65,0.80);
				}
				else
				{
				//Line......................................................................................
				int TeamLocation = rmRandInt(rmRandInt(7,8),rmRandInt(9,10));
				float Team1A = 0.86;	float Team1B = 0.25;	float Team1C = 0.30;	float Team1D = 0.10;
				float Team2A = 0.10;	float Team2B = 0.65;	float Team2C = 0.08;	float Team2D = 0.35;
				float Team3A = 0.70;	float Team3B = 0.90;	float Team3C = 0.70;	float Team3D = 0.70;
				float Team4A = 0.40;	float Team4B = 0.90;	float Team4C = 0.30;	float Team4D = 0.80;
				float Team5A = 0.80;	float Team5B = 0.80;	float Team5C = 0.70;	float Team5D = 0.80;
				float Team6A = 0.50;	float Team6B = 0.80;	float Team6C = 0.70;	float Team6D = 0.80;
				float Team7A = 0.20;	float Team7B = 0.20;	float Team7C = 0.05;	float Team7D = 0.05;
				float Team8A = 0.75;	float Team8B = 0.20;	float Team8C = 0.75;	float Team8D = 0.05;
				//1234&5678
				if (TeamLocation == 7)
				{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(Team1A, Team1B, Team1C, Team1D, 0, 1.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(Team2A, Team2B, Team2C, Team2D, 0, 1.0);
				rmSetPlacementTeam(2);
				rmPlacePlayersLine(Team3A, Team3B, Team3C, Team3D, 0, 1.0);
				rmSetPlacementTeam(3);
				rmPlacePlayersLine(Team4A, Team4B, Team4C, Team4D, 0, 1.0);
				rmSetPlacementTeam(4);
				rmPlacePlayersLine(0.20, 0.20, 0.05, 0.05, 0, 1.0);
				rmPlacePlayer(6,0.60,0.15);
				rmPlacePlayer(7,0.50,0.65);
				rmPlacePlayer(8,0.65,0.75);
				}
				////4321&8765
				if (TeamLocation == 8)
				{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(Team4A, Team4B, Team4C, Team4D, 0, 1.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(Team3A, Team3B, Team3C, Team3D, 0, 1.0);
				rmSetPlacementTeam(2);
				rmPlacePlayersLine(Team2A, Team2B, Team2C, Team2D, 0, 1.0);
				rmSetPlacementTeam(3);
				rmPlacePlayersLine(Team1A, Team1B, Team1C, Team1D, 0, 1.0);
				rmSetPlacementTeam(7);
				rmPlacePlayersLine(0.20, 0.20, 0.05, 0.05, 0, 1.0);
				rmPlacePlayer(7,0.60,0.15);
				rmPlacePlayer(6,0.50,0.65);
				rmPlacePlayer(5,0.65,0.75);
				}
				//3142&7586
				if (TeamLocation == 9)
				{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(Team3A, Team3B, Team3C, Team3D, 0, 1.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(Team1A, Team1B, Team1C, Team1D, 0, 1.0);
				rmSetPlacementTeam(2);
				rmPlacePlayersLine(Team4A, Team4B, Team4C, Team4D, 0, 1.0);
				rmSetPlacementTeam(3);
				rmPlacePlayersLine(Team2A, Team2B, Team2C, Team2D, 0, 1.0);
				rmSetPlacementTeam(6);
				rmPlacePlayersLine(0.20, 0.20, 0.05, 0.05, 0, 1.0);
				rmPlacePlayer(5,0.60,0.15);
				rmPlacePlayer(8,0.50,0.65);
				rmPlacePlayer(6,0.65,0.75);
				}
				//2413&6857
				if (TeamLocation == 10)
				{
				rmSetPlacementTeam(0);
				rmPlacePlayersLine(Team2A, Team2B, Team2C, Team2D, 0, 1.0);
				rmSetPlacementTeam(1);
				rmPlacePlayersLine(Team4A, Team4B, Team4C, Team4D, 0, 1.0);
				rmSetPlacementTeam(2);
				rmPlacePlayersLine(Team1A, Team1B, Team1C, Team1D, 0, 1.0);
				rmSetPlacementTeam(3);
				rmPlacePlayersLine(Team3A, Team3B, Team3C, Team3D, 0, 1.0);
				rmSetPlacementTeam(5);
				rmPlacePlayersLine(0.20, 0.20, 0.05, 0.05, 0, 1.0);
				rmPlacePlayer(8,0.60,0.15);
				rmPlacePlayer(5,0.50,0.65);
				rmPlacePlayer(7,0.65,0.75);
				}
//				rmSetPlacementSection(0.6, 0.15);
//				rmPlacePlayersSquare(0.3, 0.3, 0);
//				rmPlacePlayersCircular(0.39, 0.39, 0.0);
//				rmPlacePlayersCircular(0.39, 0.39, rmDegreesToRadians(360.0));
//				rmPlacePlayersCircular(0.39, 0.39, rmDegreesToRadians(6.0));
				}
		}

	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.25);

	// ****************************************** TRADE ROUTE **********************************************
/*
	int tradeRouteID = rmCreateTradeRoute();
	int socketID=rmCreateObjectDef("sockets to dock Trade Posts");
	rmAddObjectDefItem(socketID, "SocketTradeRoute", 1, 0.0);
	rmSetObjectDefAllowOverlap(socketID, true);
	rmSetObjectDefMinDistance(socketID, 0.0);
	rmSetObjectDefMaxDistance(socketID, 6.0);
	rmAddObjectDefConstraint(socketID, avoidSea);

	int tpvariation = rmRandInt(0,1);
	float socketB01 = 0.10;
	float socketB02 = 0.28;
	float socketB03 = 0.41;
	float socketB04 = 0.69;
	float socketC01 = 0.10;
	float socketC02 = 0.43;
	float socketC03 = 0.69;
	int socketcount = rmRandInt(3,4);

	if (tpvariation == 1)
	{	//South Start
		rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
		rmAddTradeRouteWaypoint(tradeRouteID, 1.00, 0.70);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.87, 0.7408);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.68, 0.64);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.54, 0.64);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.34, 0.84);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.30, 1.00);
		socketB01 = 0.13;
		socketB02 = 0.35;
		socketB03 = 0.65;
		socketB04 = 0.85;
		socketC01 = 0.20;
		socketC02 = 0.50;
		socketC03 = 0.78;
	}
	else
	{	//North Start
		rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.30, 1.00);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.34, 0.84);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.54, 0.64);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.68, 0.64);
		rmAddTradeRouteWaypoint(tradeRouteID, 0.88, 0.74);
		rmAddTradeRouteWaypoint(tradeRouteID, 1.00, 0.70);
		socketB01 = 0.15;
		socketB02 = 0.35;
		socketB03 = 0.65;
		socketB04 = 0.85;
		socketC01 = 0.22;
		socketC02 = 0.50;
		socketC03 = 0.80;
	}

	bool placedTradeRouteA = rmBuildTradeRoute(tradeRouteID, "dirt");
//	if(placedTradeRouteA == false)
//	rmEchoError("Failed to place trade route 1");
//	rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
	vector	socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.00);
	if (socketcount == 3)
	{
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC01);
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC02); 
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC03); 
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
	}
	if (socketcount == 4)
	{
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB01);
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB02); 
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB03); 
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
		socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB04); 
		rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
	}
*/
	// *************************************************************************************************************
   	
	// ******************************************* Trigger Unit ****************************************************



	// *************************************************************************************************************

	// Text
	rmSetStatusText("",0.30);

	// **************************************** NATURE DESIGN & AREAS **********************************************
	
	// Players area
	for (i=1; < cNumberNonGaiaPlayers)
	{
	int playerareaID = rmCreateArea("playerarea"+i);
	rmSetPlayerArea(i, playerareaID);
	rmSetAreaSize(playerareaID, 0.05, 0.05);
	rmSetAreaCoherence(playerareaID, 1.0);
	rmSetAreaWarnFailure(playerareaID, false);
//	rmSetAreaTerrainType(playerareaID, "bayou\groundforest_bay");
	rmSetAreaLocPlayer(playerareaID, i);
	rmBuildArea(playerareaID);
	int avoidPlayerArea = rmCreateAreaDistanceConstraint("avoid player area "+i, playerareaID, 18.0);
	int stayPlayerArea = rmCreateAreaMaxDistanceConstraint("stay player area "+i, playerareaID, 0.0);
	}
	
	int avoidPlayerArea1 = rmConstraintID("avoid player area 1");
	int avoidPlayerArea2 = rmConstraintID("avoid player area 2");
	int stayPlayerArea1 = rmConstraintID("stay player area 1");
	int stayPlayerArea2 = rmConstraintID("stay player area 2");
	
	
	// Text
	rmSetStatusText("",0.35);

	// *********************************************** Cliff *************************************************
	// Cliffs
/*
	int cliffcount = 6; 
	
	for (i= 0; < cliffcount)
	{
		int cliffID = rmCreateArea("cliff"+i);
		rmAddAreaToClass(cliffID, rmClassID("Cliffs"));
		rmSetAreaSize(cliffID, rmAreaTilesToFraction(360), rmAreaTilesToFraction(360));  
		rmSetAreaMinBlobs(cliffID, 1);
		rmSetAreaMaxBlobs(cliffID, 1);
//		rmSetAreaMinBlobDistance(cliffID, 4.0);
//		rmSetAreaMaxBlobDistance(cliffID, 4.0);
		rmSetAreaWarnFailure(cliffID, true);
		rmSetAreaObeyWorldCircleConstraint(cliffID, false);
		rmSetAreaCliffType(cliffID, "texas grass"); // new england inland grass
		rmSetAreaCliffPainting(cliffID, false, false, true, 0.1 , true); //  paintGround,  paintOutsideEdge,  paintSide,  minSideHeight,  paintInsideEdge
	//	rmSetAreaTerrainType(cliffID, "pampas\groundforest_pam", 0, 0);
		rmSetAreaCliffEdge(cliffID, 1, rmRandFloat(0.50, 0.50) , 0.0, 0.0, 1); // rmRandFloat(0.24, 0.28)
	//	rmSetAreaCliffEdge(cliffID, 1, rmRandFloat(0.28, 0.28) , 0.0, 0.0, 1); // rmRandFloat(0.24, 0.28)
		rmSetAreaCliffHeight(cliffID, 3.5, 0.2, 0.4); 
		rmSetAreaHeightBlend(cliffID, 2);
		rmSetAreaCoherence(cliffID, 0.8);
		rmSetAreaSmoothDistance(cliffID, 10);
		rmAddAreaConstraint (cliffID, avoidCliff);
		rmAddAreaConstraint (cliffID, avoidEdge);	
//		rmAddAreaConstraint(cliffID, avoidNativesFar);
		rmAddAreaConstraint(cliffID, avoidTradeRouteSocket);
		rmAddAreaConstraint(cliffID, avoidTradeRouteShort);
		rmAddAreaConstraint (cliffID, avoidPlayerArea1);
		rmAddAreaConstraint (cliffID, avoidPlayerArea2);
//		rmAddAreaConstraint (cliffID, avoidSE);
		rmAddAreaConstraint (cliffID, avoidAreaA);
		rmAddAreaConstraint (cliffID, avoidAreaB);
		rmAddAreaConstraint (cliffID, avoidAreaC);
		rmAddAreaConstraint (cliffID, avoidAreaD);
		rmAddAreaConstraint (cliffID, avoidSea);
		rmBuildArea(cliffID);		
	}
*/
	// *******************************************************************************************************

/*	// Terrain patch1
	for (i=0; < 60)
      {
        int patchID = rmCreateArea("first patch "+i);
        rmSetAreaWarnFailure(patchID, false);
        rmSetAreaSize(patchID, rmAreaTilesToFraction(50), rmAreaTilesToFraction(50));
	rmAddAreaToClass(patchID, classPatch);
//	rmSetAreaMix(patchID, "pampas_grass"); //pampas_grass
        rmSetAreaTerrainType(patchID, "bayou\ground2_bay");
        rmSetAreaMinBlobs(patchID, 4);
        rmSetAreaMaxBlobs(patchID, 5);
        rmSetAreaMinBlobDistance(patchID, 16.0);
        rmSetAreaMaxBlobDistance(patchID, 40.0);
        rmSetAreaCoherence(patchID, 0.0);
	rmAddAreaConstraint(patchID, avoidImpassableLandShort);
	rmAddAreaConstraint(patchID, avoidPatch);
        rmBuildArea(patchID); 
    }
*/
	// Terrain patch NW
	for (i=0; <18)
      {
        int NWpatchID = rmCreateArea("NW patch "+i);
        rmSetAreaWarnFailure(NWpatchID, false);
	rmSetAreaObeyWorldCircleConstraint(NWpatchID, false);
        rmSetAreaSize(NWpatchID, rmAreaTilesToFraction(50), rmAreaTilesToFraction(60));
	rmAddAreaToClass(NWpatchID, classPatch2);
//	rmSetAreaMix(NWpatchID, "pampas_grass"); //pampas_grass
        rmSetAreaTerrainType(NWpatchID, "bayou\ground3_bay");
        rmSetAreaMinBlobs(NWpatchID, 3);
        rmSetAreaMaxBlobs(NWpatchID, 5);
        rmSetAreaMinBlobDistance(NWpatchID, 16.0);
        rmSetAreaMaxBlobDistance(NWpatchID, 40.0);
        rmSetAreaCoherence(NWpatchID, 0.0);
//		rmAddAreaConstraint(NWpatchID, avoidImpassableLandShort);
		rmAddAreaConstraint(NWpatchID, avoidPatch2);
        rmBuildArea(NWpatchID); 
    }
	
	// *********************************************** Grass ***********************************************
	// Grass
	for (i=0; < 50)
	{
		int GrassID = rmCreateObjectDef("drygrass"+i);
		rmAddObjectDefItem(GrassID, "UnderbrushCarolinasMarsh", rmRandInt(1,1), 4.0); 
		rmSetObjectDefMinDistance(GrassID, 0);
		rmSetObjectDefMaxDistance(GrassID, rmXFractionToMeters(0.5));
		rmAddObjectDefToClass(GrassID, rmClassID("grass"));
		rmAddObjectDefConstraint(GrassID, avoidGrass);
		rmAddObjectDefConstraint(GrassID, avoidImpassableLandShort);
		rmAddObjectDefConstraint(GrassID, avoidTownCenterShort);
		rmPlaceObjectDefAtLoc(GrassID, 0, 0.50, 0.50);
	}
	
	// *****************************************************************************************************	
	
	
	// ********************************************* NATIVE ************************************************

	int CherokeeID = rmCreateGrouping("Cherokee1", "native cherokee village 2");
	rmSetGroupingMinDistance(CherokeeID, 0.0);
	rmSetGroupingMaxDistance(CherokeeID, rmXFractionToMeters(0.05));
	rmPlaceGroupingAtLoc(CherokeeID, 0,0.50,0.90);
//	rmAddAreaToClass(CherokeeID,rmClassID("natives"));
	rmAddGroupingConstraint(CherokeeID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(CherokeeID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(CherokeeID, avoidTradeRouteSocket);

	int Cherokee2ID = rmCreateGrouping("Cherokee2", "native cherokee village 3");
	rmSetGroupingMinDistance(Cherokee2ID, 0.0);
	rmSetGroupingMaxDistance(Cherokee2ID, rmXFractionToMeters(0.1));
	rmPlaceGroupingAtLoc(Cherokee2ID, 0,0.85,0.85);
//	rmAddAreaToClass(Cherokee2ID,rmClassID("natives"));
	rmAddGroupingConstraint(Cherokee2ID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(Cherokee2ID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(Cherokee2ID, avoidTradeRouteSocket);

	int Cherokee3ID = rmCreateGrouping("Cherokee3", "native cherokee village 3");
	rmSetGroupingMinDistance(Cherokee3ID, 0.0);
	rmSetGroupingMaxDistance(Cherokee3ID, rmXFractionToMeters(0.1));
	rmPlaceGroupingAtLoc(Cherokee3ID, 0,0.58,0.62);
//	rmAddAreaToClass(Cherokee3ID,rmClassID("natives"));
	rmAddGroupingConstraint(Cherokee3ID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(Cherokee3ID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(Cherokee3ID, avoidTradeRouteSocket);

	int SeminoleID = rmCreateGrouping("seminole1", "native seminole village 1");
	rmSetGroupingMinDistance(SeminoleID, 0.0);
	rmSetGroupingMaxDistance(SeminoleID, rmXFractionToMeters(0.1));
	rmPlaceGroupingAtLoc(SeminoleID, 0,0.60,0.05);
//	rmAddAreaToClass(SeminoleID,rmClassID("natives"));
	rmAddGroupingConstraint(SeminoleID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(SeminoleID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(SeminoleID, avoidTradeRouteSocket);

	int Seminole2ID = rmCreateGrouping("seminole2", "native seminole village 1");
	rmSetGroupingMinDistance(Seminole2ID, 0.0);
	rmSetGroupingMaxDistance(Seminole2ID, rmXFractionToMeters(0.05));
	if (cNumberNonGaiaPlayers < 5)
	{
	rmPlaceGroupingAtLoc(Seminole2ID, 0,0.10,0.50);
	}
	else
	{
	rmPlaceGroupingAtLoc(Seminole2ID, 0,0.035,0.50);
	}
//	rmAddAreaToClass(Seminole2ID,rmClassID("natives"));
	rmAddGroupingConstraint(Seminole2ID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(Seminole2ID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(Seminole2ID, avoidTradeRouteSocket);

	int Seminole3ID = rmCreateGrouping("seminole3", "native seminole village 1");
	rmSetGroupingMinDistance(Seminole3ID, 0.0);
	rmSetGroupingMaxDistance(Seminole3ID, rmXFractionToMeters(0.1));
	rmPlaceGroupingAtLoc(Seminole3ID, 0,0.29,0.21);
//	rmAddAreaToClass(Seminole3ID,rmClassID("natives"));
	rmAddGroupingConstraint(Seminole3ID, avoidImpassableLandMed);
//	rmAddGroupingConstraint(Seminole3ID, avoidTradeRouteShort);
//	rmAddGroupingConstraint(Seminole3ID, avoidTradeRouteSocket);
	// *******************************************************************************************************

	// *********************************** PLAYER STARTING RESOURCES ***************************************

	// ********************************************** Define ***********************************************

	// Town center & units
	int TCID = rmCreateObjectDef("player TC");
	int startingUnits = rmCreateStartingUnitsObjectDef(5.0);
	int Chi3 = rmRandInt(rmRandInt(1,rmRandInt(2,3)),rmRandInt(4,5));
	if (rmGetNomadStart())
	{
	rmAddObjectDefItem(TCID, "CoveredWagon", 1, 0.0);
	}
	else
	{
	rmAddObjectDefItem(TCID, "TownCenter", 1, 0.0);
	rmAddObjectDefToClass(TCID, classStartingResource);
/*
		if ( cNumberTeams != 2 )
		{
		rmAddObjectDefConstraint(TCID, avoidTradeRouteTown);
		}
*/
//	rmAddObjectDefConstraint(TCID, avoidTradeRouteFar);
//	rmAddObjectDefConstraint(TCID, avoidTownCenterMed);
	}
	rmSetObjectDefMinDistance(TCID, 0.0);
	rmSetObjectDefMaxDistance(TCID, 0.0);
	
	// Starting mines
	int playergoldID = rmCreateObjectDef("player mine");
	rmAddObjectDefItem(playergoldID, "SPCMine", 1, 0);
	rmSetObjectDefMinDistance(playergoldID, 16.0);
	rmSetObjectDefMaxDistance(playergoldID, 18.0);
	rmAddObjectDefToClass(playergoldID, classStartingResource);
	rmAddObjectDefToClass(playergoldID, classGold);
	rmAddObjectDefConstraint(playergoldID, avoidGoldType);
	rmAddObjectDefConstraint(playergoldID, avoidTradeRoute);
	rmAddObjectDefConstraint(playergoldID, avoidImpassableLand);
	rmAddObjectDefConstraint(playergoldID, avoidNatives);
	rmAddObjectDefConstraint(playergoldID, avoidStartingResources);
	
	// 2nd mine
	int playergold2ID = rmCreateObjectDef("player second mine");
	rmAddObjectDefItem(playergold2ID, "MineTin", 1, 0);
	rmSetObjectDefMinDistance(playergold2ID, 18.0); //58
	rmSetObjectDefMaxDistance(playergold2ID, 20.0); //62
	rmAddObjectDefToClass(playergold2ID, classStartingResource);
	rmAddObjectDefToClass(playergold2ID, classGold);
	rmAddObjectDefConstraint(playergold2ID, avoidTradeRoute);
	rmAddObjectDefConstraint(playergold2ID, avoidImpassableLand);
	rmAddObjectDefConstraint(playergold2ID, avoidNatives);
	rmAddObjectDefConstraint(playergold2ID, avoidGoldType);
	rmAddObjectDefConstraint(playergold2ID, avoidStartingResources);
	
	// 3nd mine
	int playergold3ID = rmCreateObjectDef("player third mine");
	rmAddObjectDefItem(playergold3ID, "MineTin", 1, 0);
	rmSetObjectDefMinDistance(playergold3ID, 68.0); //58
	rmSetObjectDefMaxDistance(playergold3ID, 70.0); //62
	rmAddObjectDefToClass(playergold3ID, classStartingResource);
	rmAddObjectDefToClass(playergold3ID, classGold);
	rmAddObjectDefConstraint(playergold3ID, avoidTradeRouteShort);
	rmAddObjectDefConstraint(playergold3ID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(playergold3ID, avoidImpassableLand);
	rmAddObjectDefConstraint(playergold3ID, avoidNatives);
	rmAddObjectDefConstraint(playergold3ID, avoidGoldTypeFar);
	rmAddObjectDefConstraint(playergold3ID, avoidStartingResources);
	rmAddObjectDefConstraint(playergold3ID, avoidEdgeMore);
	rmAddObjectDefConstraint(playergold3ID, avoidCenterMore);
	
	// Starting trees1
	int playerTree1ID = rmCreateObjectDef("player trees");
	rmAddObjectDefItem(playerTree1ID, "TreeBayouMarsh", rmRandInt(3,3), 1.0);
	rmSetObjectDefMinDistance(playerTree1ID, 6);
	rmSetObjectDefMaxDistance(playerTree1ID, 12);
	rmAddObjectDefToClass(playerTree1ID, classStartingResource);
//	rmAddObjectDefToClass(playerTree1ID, classForest);
//	rmAddObjectDefConstraint(playerTree1ID, avoidForestMin);
	rmAddObjectDefConstraint(playerTree1ID, avoidTradeRoute);
	rmAddObjectDefConstraint(playerTree1ID, avoidImpassableLand);
//	rmAddObjectDefConstraint(playerTree1ID, avoidStartingResources);
	
	// Starting trees2
	int playerTree2ID = rmCreateObjectDef("player trees2");
	rmAddObjectDefItem(playerTree2ID, "TreeCarolinaMarsh", rmRandInt(3,3), 2.0);
	rmSetObjectDefMinDistance(playerTree2ID, 8);
	rmSetObjectDefMaxDistance(playerTree2ID, 14);
	rmAddObjectDefToClass(playerTree2ID, classStartingResource);
//	rmAddObjectDefToClass(playerTree2ID, classForest);
//	rmAddObjectDefConstraint(playerTree2ID, avoidForestMin);
	rmAddObjectDefConstraint(playerTree2ID, avoidTradeRoute);
	rmAddObjectDefConstraint(playerTree2ID, avoidImpassableLand);
//	rmAddObjectDefConstraint(playerTree2ID, avoidStartingResources);
	
	// Starting herd
	int playerherdID = rmCreateObjectDef("starting herd");
	rmAddObjectDefItem(playerherdID, "Turkey", rmRandInt(6,8), 4.0);
	rmSetObjectDefMinDistance(playerherdID, 8.0);
	rmSetObjectDefMaxDistance(playerherdID, 12.0);
	rmSetObjectDefCreateHerd(playerherdID, true);
	rmAddObjectDefToClass(playerherdID, classStartingResource);
	rmAddObjectDefConstraint(playerherdID, avoidTradeRoute);
	rmAddObjectDefConstraint(playerherdID, avoidImpassableLand);
	rmAddObjectDefConstraint(playerherdID, avoidNatives);
	rmAddObjectDefConstraint(playerherdID, avoidStartingResourcesShort);
	
	// Starting Berry
	int playerBerryID=rmCreateObjectDef("player berries");
	rmAddObjectDefItem(playerBerryID, "BerryBush", 4, 3.0);
	rmSetObjectDefMinDistance(playerBerryID, 12);
	rmSetObjectDefMaxDistance(playerBerryID, 14);
	rmAddObjectDefToClass(playerBerryID, classStartingResource);
	rmAddObjectDefConstraint(playerBerryID, avoidTradeRoute);
	rmAddObjectDefConstraint(playerBerryID, avoidImpassableLand);

	// (Chinese) Starting Crate 
	int ChineseCrateID=rmCreateObjectDef("Chinese Crate");
		if ( Chi3 == 1 )
			{
			rmAddObjectDefItem(ChineseCrateID, "CrateofWood", 1, 5.0);
			}
		if ( Chi3 == 2 )
			{
			rmAddObjectDefItem(ChineseCrateID, "CrateofFood", 1, 5.0);
			}
		if ( Chi3 == 3 )
			{
			rmAddObjectDefItem(ChineseCrateID, "CrateofCoin", 1, 5.0);
			}
		if ( Chi3 == 4 )
			{
			rmAddObjectDefItem(ChineseCrateID, "Crateofwood", 1, 5.0);
			rmAddObjectDefItem(ChineseCrateID, "CrateofCoin", 1, 5.0);
			}
		if ( Chi3 == 5 )
			{
			rmAddObjectDefItem(ChineseCrateID, "Crateoffood", 1, 5.0);
			rmAddObjectDefItem(ChineseCrateID, "CrateofCoin", 1, 5.0);
			}
	rmSetObjectDefMinDistance(ChineseCrateID, 4);
	rmSetObjectDefMaxDistance(ChineseCrateID, 6);
	rmAddObjectDefToClass(ChineseCrateID, classStartingResource);
	rmAddObjectDefConstraint(ChineseCrateID, avoidTradeRoute);
	rmAddObjectDefConstraint(ChineseCrateID, avoidImpassableLand);

	// (SPCAct3) Starting Hero
	int SPCAct3ID=rmCreateObjectDef("SPCACT3");
	rmAddObjectDefItem(SPCAct3ID, "SPCAmelia", 1, 5.0);
	rmAddObjectDefItem(SPCAct3ID, "SPCCooper", 1, 5.0);
	rmSetObjectDefMinDistance(SPCAct3ID, 18);
	rmSetObjectDefMaxDistance(SPCAct3ID, 22);
	rmAddObjectDefToClass(SPCAct3ID, classStartingResource);
	rmAddObjectDefConstraint(SPCAct3ID, avoidTradeRoute);
	rmAddObjectDefConstraint(SPCAct3ID, avoidImpassableLand);
	
	// (SPCAct3) Starting Crate
	int SPCAct3CrateID=rmCreateObjectDef("SPC Crate");
	rmAddObjectDefItem(SPCAct3CrateID, "Crateoffood", 2, 4.0);
	rmAddObjectDefItem(SPCAct3CrateID, "Crateofwood", 2, 4.0);
	rmSetObjectDefMinDistance(SPCAct3CrateID, 4);
	rmSetObjectDefMaxDistance(SPCAct3CrateID, 6);
	rmAddObjectDefToClass(SPCAct3CrateID, classStartingResource);
	rmAddObjectDefConstraint(SPCAct3CrateID, avoidTradeRoute);
	rmAddObjectDefConstraint(SPCAct3CrateID, avoidImpassableLand);

	// (XPSPC) Starting Crate
	int XPSPCID=rmCreateObjectDef("SPC Country");
	rmAddObjectDefItem(XPSPCID, "SPCXPNathaniel", 1, 5.0);
	rmAddObjectDefItem(XPSPCID, "SPCXPWashington", 1, 5.0);
	rmSetObjectDefMinDistance(XPSPCID, 18);
	rmSetObjectDefMaxDistance(XPSPCID, 22);
	rmAddObjectDefToClass(XPSPCID, classStartingResource);
	rmAddObjectDefConstraint(XPSPCID, avoidTradeRoute);
	rmAddObjectDefConstraint(XPSPCID, avoidImpassableLand);
	rmAddObjectDefConstraint(XPSPCID, avoidStartingResources);
	rmAddObjectDefConstraint(XPSPCID, avoidNatives);
	rmAddObjectDefConstraint(XPSPCID, avoidEdge);
	rmAddObjectDefConstraint(XPSPCID, avoidNugget);

	// 2nd herd
	int playerHerd2ID = rmCreateObjectDef("player Herd2");
	rmAddObjectDefItem(playerHerd2ID, PlayerHerd2, rmRandInt(9,11), 10.0);
	rmSetObjectDefMinDistance(playerHerd2ID, 38);
	rmSetObjectDefMaxDistance(playerHerd2ID, 40);
	rmSetObjectDefCreateHerd(playerHerd2ID, true);
	rmAddObjectDefConstraint(playerHerd2ID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(playerHerd2ID, avoidImpassableLandShort);
	rmAddObjectDefConstraint(playerHerd2ID, avoidNatives);
//	rmAddObjectDefConstraint(playerHerd2ID, avoidStartingResources);
	rmAddObjectDefConstraint(playerHerd2ID, avoidPlayerHerd2Short);
	rmAddObjectDefConstraint(playerHerd2ID, avoidCenterHerd1Short);
	rmAddObjectDefConstraint(playerHerd2ID, avoidCenterMore);
	
	// 3rd herd
	int playerHerd3ID = rmCreateObjectDef("player Herd3");
	rmAddObjectDefItem(playerHerd3ID, PlayerHerd3, rmRandInt(7,8), 8.0);
	rmSetObjectDefMinDistance(playerHerd3ID, 48);
	rmSetObjectDefMaxDistance(playerHerd3ID, 50);
	rmSetObjectDefCreateHerd(playerHerd3ID, true);
	rmAddObjectDefConstraint(playerHerd3ID, avoidPlayerHerd3Far); 
//	rmAddObjectDefConstraint(playerHerd3ID, avoidPlayerHerd2Far);
//	rmAddObjectDefConstraint(playerHerd3ID, avoidCenterHerd1Short);
	rmAddObjectDefConstraint(playerHerd3ID, avoidCenterHerd2Far);
	rmAddObjectDefConstraint(playerHerd3ID, avoidTradeRouteShort);
	rmAddObjectDefConstraint(playerHerd3ID, avoidImpassableLandShort);
	rmAddObjectDefConstraint(playerHerd3ID, avoidNatives);
//	rmAddObjectDefConstraint(playerHerd3ID, avoidCenterShort);
//	rmAddObjectDefConstraint(playerHerd3ID, avoidStartingResources);
	rmAddObjectDefConstraint(playerHerd3ID, avoidEdgeMore);
	
	// Starting treasures
	int playerNuggetID = rmCreateObjectDef("player nugget"); 
	rmAddObjectDefItem(playerNuggetID, "Nugget", 1, 0.0);
	rmSetNuggetDifficulty(1, 1);
	rmSetObjectDefMinDistance(playerNuggetID, 20.0);
	rmSetObjectDefMaxDistance(playerNuggetID, 30.0);
	rmAddObjectDefToClass(playerNuggetID, classStartingResource);
	rmAddObjectDefConstraint(playerNuggetID, avoidTradeRoute);
	rmAddObjectDefConstraint(playerNuggetID, avoidImpassableLand);
	rmAddObjectDefConstraint(playerNuggetID, avoidNatives);
	rmAddObjectDefConstraint(playerNuggetID, avoidStartingResources);
	rmAddObjectDefConstraint(playerNuggetID, avoidNugget);
	rmAddObjectDefConstraint(playerNuggetID, avoidEdge);
	int nugget0count = rmRandInt (2,2); // 1,2

	int OBSUIID = rmCreateObjectDef("ESOC OBSUI Unit");
	rmAddObjectDefItem(OBSUIID, "Minuteman", 1, 20.0);
	rmSetObjectDefMinDistance(OBSUIID, 0);
	rmSetObjectDefMaxDistance(OBSUIID, 40);

	// Text
	rmSetStatusText("",0.40);

	// ************************************************ Place ************************************************
	
	for(i=1; <=cNumberNonGaiaPlayers)
	{
		rmPlaceObjectDefAtLoc(TCID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));

		vector TCLoc = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TCID, i));
			rmPlaceObjectDefAtLoc(startingUnits, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playergoldID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playergold2ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playergold3ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerherdID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerTree1ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerTree1ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerTree1ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerTree2ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerTree2ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerBerryID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerHerd2ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerHerd3ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
			rmPlaceObjectDefAtLoc(playerNuggetID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
/*
			if (rmGetPlayerCiv(i) == 20 || rmGetPlayerCiv(i) ==rmGetCivID("SPCChinese"))
				{
				rmPlaceObjectDefAtLoc(ChineseCrateID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
				}
*/
			if (rmGetPlayerCiv(i) == rmGetCivID("SPCAct3"))
				{
				rmPlaceObjectDefAtLoc(SPCAct3CrateID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
				rmPlaceObjectDefAtLoc(SPCAct3ID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
				}
			if (rmGetPlayerCiv(i) == rmGetCivID("XPSPC"))
				{
				rmPlaceObjectDefAtLoc(SPCAct3CrateID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
				rmPlaceObjectDefAtLoc(XPSPCID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
				}
			if (nugget0count == 2)
			rmPlaceObjectDefAtLoc(playerNuggetID, i, rmXMetersToFraction(xsVectorGetX(TCLoc)), rmZMetersToFraction(xsVectorGetZ(TCLoc)));
	}

	// *******************************************************************************************************


	// ********************************************** Mines **************************************************
	
	int goldCount = rmRandInt(3 * (cNumberNonGaiaPlayers - ObsUIPlayer), 3 * (cNumberNonGaiaPlayers - ObsUIPlayer));  // 3,3 
		

	//Mines
	for(i=0; < goldCount)
	{
		int goldID = rmCreateObjectDef("gold"+i);
		rmAddObjectDefItem(goldID, "MineTin", 1, 0.0);
		rmSetObjectDefMinDistance(goldID, rmXFractionToMeters(0.12));
		rmSetObjectDefMaxDistance(goldID, rmXFractionToMeters(0.7));
		rmAddObjectDefToClass(goldID, classGold);
		rmAddObjectDefConstraint(goldID, avoidTradeRouteSocketFar);
		rmAddObjectDefConstraint(goldID, avoidTradeRoute);
		rmAddObjectDefConstraint(goldID, avoidImpassableLand);
		rmAddObjectDefConstraint(goldID, avoidNatives);
		rmAddObjectDefConstraint(goldID, avoidGoldVeryFar);
//		rmAddObjectDefConstraint(goldID, Northwestconstraint);
		rmAddObjectDefConstraint(goldID, avoidTownCenterVeryFar);
		rmAddObjectDefConstraint(goldID, avoidEdgeMore);
		rmPlaceObjectDefAtLoc(goldID, 0, 0.50, 0.85);
	}
	

	// *******************************************************************************************************	


	// *********************************************** Forest ************************************************

	int dirtforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 4);
	if(cNumberNonGaiaPlayers >=4) dirtforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 3);
	if(cNumberNonGaiaPlayers >=6) dirtforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 2);
	int greenforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 6);
	if(cNumberNonGaiaPlayers >=4) greenforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 4);
	if(cNumberNonGaiaPlayers >=6) greenforestcount = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 2);
	int dirtforesttreecount = rmRandInt(5,6);
	
	// Green forests big

	

			int greenforesttreeID = rmCreateObjectDef("dirt forest trees");
			rmAddObjectDefItem(greenforesttreeID, "TreeCarolinaMarsh", 4, 5.0);
			rmAddObjectDefItem(greenforesttreeID, "TreeBayouMarsh", 2, 8.0);
			rmAddObjectDefItem(greenforesttreeID, "TreeBayou", 2, 3.0);
			rmSetObjectDefMinDistance(greenforesttreeID,  rmXFractionToMeters(0.0));
			rmSetObjectDefMaxDistance(greenforesttreeID,  rmXFractionToMeters(0.5));
			rmAddObjectDefToClass(greenforesttreeID, classForest);
		//	rmAddObjectDefConstraint(greenforesttreeID, avoidForestShort);
			rmAddObjectDefConstraint(greenforesttreeID, avoidImpassableLandShort);
			rmAddObjectDefConstraint(greenforesttreeID, avoidTownCenterTree);
			rmAddAreaConstraint(greenforesttreeID, avoidJapan);
			rmAddAreaConstraint(greenforesttreeID, avoidTree);
			rmAddAreaConstraint(greenforesttreeID, avoidBuilding);
			rmAddAreaConstraint(greenforesttreeID, avoidTownCenterTree);
			rmAddAreaConstraint(greenforesttreeID, avoidCoveredWagon);
		rmAddObjectDefConstraint(greenforesttreeID, avoidNatives);
			rmPlaceObjectDefAtLoc(greenforesttreeID, 0, 0.50, 0.50,7*greenforestcount);



			int dirtforesttreeID = rmCreateObjectDef("dirt forest trees"+i);
			rmAddObjectDefItem(dirtforesttreeID, "TreeBayouMarsh", 5, 2.0);
			rmSetObjectDefMinDistance(dirtforesttreeID,  rmXFractionToMeters(0.0));
			rmSetObjectDefMaxDistance(dirtforesttreeID,  rmXFractionToMeters(0.5));
			rmAddObjectDefToClass(dirtforesttreeID, classForest);
		//	rmAddObjectDefConstraint(dirtforesttreeID, avoidForestShort);
			rmAddObjectDefConstraint(dirtforesttreeID, avoidTownCenterTree);
			rmAddAreaConstraint(dirtforesttreeID, avoidJapan);
			rmAddAreaConstraint(dirtforesttreeID, avoidTree);
			rmAddAreaConstraint(dirtforesttreeID, avoidBuilding);
			rmAddAreaConstraint(dirtforesttreeID, avoidTownCenterTree);
			rmAddAreaConstraint(dirtforesttreeID, avoidCoveredWagon);
		rmAddObjectDefConstraint(dirtforesttreeID, avoidNatives);
			rmPlaceObjectDefAtLoc(dirtforesttreeID, 0, 0.50, 0.50,5*greenforestcount);


	// *******************************************************************************************************


	
	// Text
	rmSetStatusText("",0.45);

	// ************************************************ Herd *************************************************

	int herdcount = (cNumberPlayers - ObsUIPlayer);
	
	for(i=0; < herdcount)
	{
	
		//Center Herd1
		int CenterHerd1ID = rmCreateObjectDef("Herd1"+i);
		rmAddObjectDefItem(CenterHerd1ID, CenterHerd1, rmRandInt(11,11), 10.0);
		rmSetObjectDefMinDistance(CenterHerd1ID, rmXFractionToMeters(0.0));
		rmSetObjectDefMaxDistance(CenterHerd1ID, rmXFractionToMeters(0.5));
		rmSetObjectDefCreateHerd(CenterHerd1ID, true);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidImpassableLandShort);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidNativesShort);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidTradeRouteSocket);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidGoldMin);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidForestMin); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidTownCenterFar);
		rmAddObjectDefConstraint(CenterHerd1ID, avoidPlayerHerd2Far); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidPlayerHerd3Far); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidCenterHerd1Far); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidCenterHerd2Far); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidJapan); 
		rmAddObjectDefConstraint(CenterHerd1ID, avoidTaiwan); 
	//	rmAddObjectDefConstraint(CenterHerd1ID, avoidEdge);
		
		//Center Herd2
		int CenterHerd2ID = rmCreateObjectDef("Herd2"+i);
		rmAddObjectDefItem(CenterHerd2ID, CenterHerd2, rmRandInt(8,8), 8.0);
		rmSetObjectDefMinDistance(CenterHerd2ID, rmXFractionToMeters(0.0));
		rmSetObjectDefMaxDistance(CenterHerd2ID, rmXFractionToMeters(0.5));
		rmSetObjectDefCreateHerd(CenterHerd2ID, true);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidImpassableLandShort);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidNativesShort);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidTradeRouteSocket);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidGoldMin);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidForestMin);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidTownCenterFar);
		rmAddObjectDefConstraint(CenterHerd2ID, avoidPlayerHerd2Far); 
		rmAddObjectDefConstraint(CenterHerd2ID, avoidPlayerHerd3Far); 
		rmAddObjectDefConstraint(CenterHerd2ID, avoidCenterHerd1Far); 
		rmAddObjectDefConstraint(CenterHerd2ID, avoidCenterHerd2Far); 
		rmAddObjectDefConstraint(CenterHerd2ID, avoidJapan); 
		rmAddObjectDefConstraint(CenterHerd2ID, avoidTaiwan); 
	//	rmAddObjectDefConstraint(CenterHerd2ID, avoidEdge);

		if (i == 0 )
		{
			rmAddObjectDefConstraint(CenterHerd1ID, staySWHalf);
			rmAddObjectDefConstraint(CenterHerd2ID, staySWHalf);
		}
		else if (i == 1)
		{
			rmAddObjectDefConstraint(CenterHerd1ID, stayNEHalf);
			rmAddObjectDefConstraint(CenterHerd2ID, stayNEHalf);
		}
		if (i < 2)
			rmPlaceObjectDefAtLoc(CenterHerd1ID, 0, 0.50, 0.50);
		rmPlaceObjectDefAtLoc(CenterHerd1ID, 0, 0.50, 0.50);
		rmPlaceObjectDefAtLoc(CenterHerd2ID, 0, 0.50, 0.50);
	}
	
	// *******************************************************************************************************
	
	// Text
	rmSetStatusText("",0.46);

	// ********************************************** Treasure ***********************************************
	
	int nuggetLV4count = (cNumberPlayers - ObsUIPlayer);
	int nuggetLV3count = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 2);
	int nuggetLV2count = ((cNumberNonGaiaPlayers - ObsUIPlayer) * 5);
	
	// Treasures center	

	int Nugget4ID = rmCreateObjectDef("nugget4"); 
	rmAddObjectDefItem(Nugget4ID, "Nugget", 1, 0.0);
	rmSetObjectDefMinDistance(Nugget4ID, 0);
	rmSetObjectDefMaxDistance(Nugget4ID, rmXFractionToMeters(0.6));
	rmAddObjectDefConstraint(Nugget4ID, avoidNuggetFar);
	rmAddObjectDefConstraint(Nugget4ID, avoidNatives);
	rmAddObjectDefConstraint(Nugget4ID, avoidTradeRouteShort);
	rmAddObjectDefConstraint(Nugget4ID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(Nugget4ID, avoidImpassableLand);
	rmAddObjectDefConstraint(Nugget4ID, avoidGoldTypeMin);
	rmAddObjectDefConstraint(Nugget4ID, avoidTownCenterFar);
	rmAddObjectDefConstraint(Nugget4ID, avoidPlayerHerd2Min); 
	rmAddObjectDefConstraint(Nugget4ID, avoidPlayerHerd3Min);
	rmAddObjectDefConstraint(Nugget4ID, avoidCenterHerd1Min); 
	rmAddObjectDefConstraint(Nugget4ID, avoidCenterHerd2Min);
	rmAddObjectDefConstraint(Nugget4ID, avoidForestMin);	
	rmAddObjectDefConstraint(Nugget4ID, avoidEdgeMore);
		
	for (i=0; <= nuggetLV4count)
	{
	rmSetNuggetDifficulty(4,4);
	rmPlaceObjectDefAtLoc(Nugget4ID, 0, 0.50, 0.50);
	}

	int HardID = rmCreateObjectDef("nugget3"); 
	rmAddObjectDefItem(HardID, "Nugget", 1, 0.0);
	rmSetObjectDefMinDistance(HardID, 0);
	rmSetObjectDefMaxDistance(HardID, rmXFractionToMeters(0.6));
	rmAddObjectDefConstraint(HardID, avoidNuggetShort);
	rmAddObjectDefConstraint(HardID, avoidNatives);
	rmAddObjectDefConstraint(HardID, avoidTradeRouteShort);
	rmAddObjectDefConstraint(HardID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(HardID, avoidImpassableLand);
	rmAddObjectDefConstraint(HardID, avoidGoldTypeMin);
	rmAddObjectDefConstraint(HardID, avoidTownCenterFar);
	rmAddObjectDefConstraint(HardID, avoidPlayerHerd2Min); 
	rmAddObjectDefConstraint(HardID, avoidPlayerHerd3Min);
	rmAddObjectDefConstraint(HardID, avoidCenterHerd1Min); 
	rmAddObjectDefConstraint(HardID, avoidCenterHerd2Min);
	rmAddObjectDefConstraint(HardID, avoidForestMin);	
	rmAddObjectDefConstraint(HardID, avoidEdgeMore);
		
	for (i=0; <= nuggetLV3count)
	{
	rmSetNuggetDifficulty(3,3);
	rmPlaceObjectDefAtLoc(HardID, 0, 0.50, 0.50);
	}

	int NuggetID = rmCreateObjectDef("nugget2"); 
	rmAddObjectDefItem(NuggetID, "Nugget", 1, 0.0);
	rmSetObjectDefMinDistance(NuggetID, 0);
	rmSetObjectDefMaxDistance(NuggetID, rmXFractionToMeters(0.6));
	rmAddObjectDefConstraint(NuggetID, avoidNuggetShort);
	rmAddObjectDefConstraint(NuggetID, avoidNatives);
	rmAddObjectDefConstraint(NuggetID, avoidTradeRouteShort);
	rmAddObjectDefConstraint(NuggetID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(NuggetID, avoidImpassableLand);
	rmAddObjectDefConstraint(NuggetID, avoidGoldTypeMin);
	rmAddObjectDefConstraint(NuggetID, avoidTownCenterFar);
	rmAddObjectDefConstraint(NuggetID, avoidPlayerHerd2Min); 
	rmAddObjectDefConstraint(NuggetID, avoidPlayerHerd3Min);
	rmAddObjectDefConstraint(NuggetID, avoidCenterHerd1Min); 
	rmAddObjectDefConstraint(NuggetID, avoidCenterHerd2Min);
	rmAddObjectDefConstraint(NuggetID, avoidForestMin);	
	rmAddObjectDefConstraint(NuggetID, avoidEdgeMore);
		
	for (i=0; <= nuggetLV2count)
	{
	rmSetNuggetDifficulty(2,2);
	rmPlaceObjectDefAtLoc(NuggetID, 0, 0.50, 0.50);
	}

	// *******************************************************************************************************
	
/*	// ************************************************ Cows *************************************************
	
	int cowcount = 4;
	for (i=0; <cowcount)
	{
	int CowID = rmCreateObjectDef("cow"+i);
	rmAddObjectDefItem(CowID, "cow", 2, 4.0);
	rmSetObjectDefMinDistance(CowID, 0.0);
	rmSetObjectDefMaxDistance(CowID, rmXFractionToMeters(0.6));
	rmAddObjectDefConstraint(CowID, avoidTradeRouteSocket);
	rmAddObjectDefConstraint(CowID, avoidImpassableLandShort);
	rmAddObjectDefConstraint(CowID, avoidNatives);
	rmAddObjectDefConstraint(CowID, avoidEdge);
	rmAddObjectDefConstraint(CowID, avoidNuggetMin);
//	rmAddObjectDefConstraint(CowID, avoidCow);
	rmAddObjectDefConstraint(CowID, avoidTownCenterMed);
	rmAddObjectDefConstraint(CowID, avoidForestMin);
	if (i==0)
		rmAddObjectDefConstraint(CowID, stayInAreaA);
	else if (i==1)
		rmAddObjectDefConstraint(CowID, stayInAreaB);
	else if (i==2)
		rmAddObjectDefConstraint(CowID, stayInAreaC);
	else
		rmAddObjectDefConstraint(CowID, stayInAreaD);
	rmPlaceObjectDefAtLoc(CowID, 0, 0.5, 0.5);
	}
	
*/
	// *******************************************************************************************************

	// Text
	rmSetStatusText("",0.47);


	// Text
	rmSetStatusText("",0.48);
	// ******************************************* Sea Resource ********************************************

	int ShipRuinscount = (cNumberPlayers - ObsUIPlayer) * 4;
	int Cratecount = (cNumberPlayers - ObsUIPlayer) * 2;

	int ShipRuins=rmCreateObjectDef("Create ShipRuins");
	rmAddObjectDefItem(ShipRuins, "SPCSpanishShipRuins", 1, 0.0);
	rmSetObjectDefMinDistance(ShipRuins, 0.3);
	rmSetObjectDefMaxDistance(ShipRuins, rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(ShipRuins, avoidFishLand);
	rmAddObjectDefConstraint(ShipRuins, avoidShipRuins);
	rmPlaceObjectDefAtLoc(ShipRuins, 0, 0.5, 0.5, ShipRuinscount);

	int CrateofCoin=rmCreateObjectDef("CrateofCoin");
	rmAddObjectDefItem(CrateofCoin, "ypCrateofCoin1", 1, 0.0);
	rmSetObjectDefMinDistance(CrateofCoin, 0.3);
	rmSetObjectDefMaxDistance(CrateofCoin, rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(CrateofCoin, avoidFishLand);
	rmAddObjectDefConstraint(CrateofCoin, avoidCrateofCoin);
	rmPlaceObjectDefAtLoc(CrateofCoin, 0, 0.5, 0.5, Cratecount);

	int MarshtreeID = rmCreateObjectDef("marsh trees");
	rmAddObjectDefItem(MarshtreeID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(MarshtreeID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(MarshtreeID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(MarshtreeID, avoidFishLand);
	rmAddObjectDefConstraint(MarshtreeID, avoidMarshtree);
	rmPlaceObjectDefAtLoc(MarshtreeID, 0, 0.50, 0.50, ShipRuinscount+3);

	int CapybaraID = rmCreateObjectDef("marsh Capybara");
	rmAddObjectDefItem(CapybaraID, "Capybara", 8, 5.0);
	rmSetObjectDefMinDistance(CapybaraID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(CapybaraID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(CapybaraID, avoidFishLand);
	rmAddObjectDefConstraint(CapybaraID, avoidCapybara);
	rmPlaceObjectDefAtLoc(CapybaraID, 0, 0.50, 0.50, Cratecount+2);

	int IslandAreaID=rmCreateArea("Island1");
	rmSetAreaSize(IslandAreaID, rmAreaTilesToFraction(140), rmAreaTilesToFraction(180));
	rmSetAreaLocation(IslandAreaID, 0.30, 0.65);
	rmSetAreaWarnFailure(IslandAreaID, false);
	rmSetAreaSmoothDistance(IslandAreaID, 10);
	rmSetAreaCoherence(IslandAreaID, 1.0);
	rmSetAreaMix(IslandAreaID, "bayou_grass");
	rmSetAreaElevationType(IslandAreaID, cElevTurbulence);
	rmSetAreaElevationVariation(IslandAreaID, 4.0);
	rmSetAreaBaseHeight(IslandAreaID, 4.0);
	rmSetAreaElevationOctaves(IslandAreaID, 3);
	rmAddAreaInfluenceSegment(IslandAreaID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(IslandAreaID, false);
	rmBuildArea(IslandAreaID);


	int IslandArea0ID=rmCreateArea("Island2");
	rmSetAreaSize(IslandArea0ID, rmAreaTilesToFraction(150), rmAreaTilesToFraction(190));
	rmSetAreaLocation(IslandArea0ID, 0.50, 0.50);
	rmSetAreaWarnFailure(IslandArea0ID, false);
	rmSetAreaSmoothDistance(IslandArea0ID, 10);
	rmSetAreaCoherence(IslandArea0ID, 1.0);
	rmSetAreaMix(IslandArea0ID, "bayou_grass");
	rmSetAreaElevationType(IslandArea0ID, cElevTurbulence);
	rmSetAreaElevationVariation(IslandArea0ID, 4.0);
	rmSetAreaBaseHeight(IslandArea0ID, 4.0);
	rmSetAreaElevationOctaves(IslandArea0ID, 3);
	rmAddAreaInfluenceSegment(IslandArea0ID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(IslandArea0ID, false);
	rmBuildArea(IslandArea0ID);

	int IslandArea2ID=rmCreateArea("Island3");
	rmSetAreaSize(IslandArea2ID, rmAreaTilesToFraction(170), rmAreaTilesToFraction(180));
	rmSetAreaLocation(IslandArea2ID, 0.40, 0.45);
	rmSetAreaWarnFailure(IslandArea2ID, false);
	rmSetAreaSmoothDistance(IslandArea2ID, 10);
	rmSetAreaCoherence(IslandArea2ID, 1.0);
	rmSetAreaMix(IslandArea2ID, "bayou_grass");
	rmSetAreaElevationType(IslandArea2ID, cElevTurbulence);
	rmSetAreaElevationVariation(IslandArea2ID, 4.0);
	rmSetAreaBaseHeight(IslandArea2ID, 4.0);
	rmSetAreaElevationOctaves(IslandArea2ID, 3);
	rmAddAreaInfluenceSegment(IslandArea2ID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(IslandArea2ID, false);
	rmBuildArea(IslandArea2ID);

	int IslandArea3ID=rmCreateArea("Island4");
	rmSetAreaSize(IslandArea3ID, rmAreaTilesToFraction(140), rmAreaTilesToFraction(150));
	rmSetAreaLocation(IslandArea3ID, 0.72, 0.50);
	rmSetAreaWarnFailure(IslandArea3ID, false);
	rmSetAreaSmoothDistance(IslandArea3ID, 10);
	rmSetAreaCoherence(IslandArea3ID, 1.0);
	rmSetAreaMix(IslandArea3ID, "bayou_grass");
	rmSetAreaElevationType(IslandArea3ID, cElevTurbulence);
	rmSetAreaElevationVariation(IslandArea3ID, 4.0);
	rmSetAreaBaseHeight(IslandArea3ID, 4.0);
	rmSetAreaElevationOctaves(IslandArea3ID, 3);
	rmAddAreaInfluenceSegment(IslandArea3ID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(IslandArea3ID, false);
	rmBuildArea(IslandArea3ID);

	int IslandArea4ID=rmCreateArea("Island5");
	rmSetAreaSize(IslandArea4ID, rmAreaTilesToFraction(140), rmAreaTilesToFraction(150));
	rmSetAreaLocation(IslandArea4ID, 0.27, 0.50);
	rmSetAreaWarnFailure(IslandArea4ID, false);
	rmSetAreaSmoothDistance(IslandArea4ID, 10);
	rmSetAreaCoherence(IslandArea4ID, 1.0);
	rmSetAreaMix(IslandArea4ID, "bayou_grass");
	rmSetAreaElevationType(IslandArea4ID, cElevTurbulence);
	rmSetAreaElevationVariation(IslandArea4ID, 4.0);
	rmSetAreaBaseHeight(IslandArea4ID, 4.0);
	rmSetAreaElevationOctaves(IslandArea4ID, 3);
	rmAddAreaInfluenceSegment(IslandArea4ID, 0.0, 0.85, 1.0, 0.85);
	rmSetAreaObeyWorldCircleConstraint(IslandArea4ID, false);
	rmBuildArea(IslandArea4ID);

	int IslandTreeID = rmCreateObjectDef("Island Tree");
	rmAddObjectDefItem(IslandTreeID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTreeID,  0);
	rmSetObjectDefMaxDistance(IslandTreeID,  10);
	rmPlaceObjectDefAtLoc(IslandTreeID, 0, 0.30, 0.65,1);

	int IslandTree0ID = rmCreateObjectDef("Island Tree0");
	rmAddObjectDefItem(IslandTree0ID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTree0ID,  0);
	rmSetObjectDefMaxDistance(IslandTree0ID,  10);
	rmPlaceObjectDefAtLoc(IslandTree0ID, 0, 0.50, 0.50,1);

	int IslandTree2ID = rmCreateObjectDef("Island Tree2");
	rmAddObjectDefItem(IslandTree2ID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTree2ID,  0);
	rmSetObjectDefMaxDistance(IslandTree2ID,  10);
	rmPlaceObjectDefAtLoc(IslandTree2ID, 0, 0.40, 0.45,1);

	int IslandTree3ID = rmCreateObjectDef("Island Tree3");
	rmAddObjectDefItem(IslandTree3ID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTree3ID,  0);
	rmSetObjectDefMaxDistance(IslandTree3ID,  10);
	rmPlaceObjectDefAtLoc(IslandTree3ID, 0, 0.72, 0.50,1);

	int IslandTree4ID = rmCreateObjectDef("Island Tree4");
	rmAddObjectDefItem(IslandTree4ID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTree4ID,  0);
	rmSetObjectDefMaxDistance(IslandTree4ID,  10);
	rmPlaceObjectDefAtLoc(IslandTree4ID, 0, 0.27, 0.50,1);

	int IslandTree9ID = rmCreateObjectDef("Island Tree9");
	rmAddObjectDefItem(IslandTree9ID, "TreeBayouMarsh", 5+cNumberPlayers, 5.0);
	rmSetObjectDefMinDistance(IslandTree9ID,  0);
	rmSetObjectDefMaxDistance(IslandTree9ID,  10);
	rmPlaceObjectDefAtLoc(IslandTree9ID, 0, 0.60, 0.36,1);

	int DuckFamilyID = rmCreateObjectDef("Duck Family");
	rmAddObjectDefItem(DuckFamilyID, "DuckFamily", 1, 0.0);
	rmSetObjectDefMinDistance(DuckFamilyID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(DuckFamilyID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(DuckFamilyID, avoidFishLand);
	rmAddObjectDefConstraint(DuckFamilyID, avoidDuckFamily);
	rmAddObjectDefConstraint(DuckFamilyID, avoidDuckFlock);
	rmAddObjectDefConstraint(DuckFamilyID, avoidDuckShipRuins);
	rmAddObjectDefConstraint(DuckFamilyID, avoidTurtles);
	rmPlaceObjectDefAtLoc(DuckFamilyID, 0, 0.50, 0.50, cNumberPlayers);

	int DuckFlockID = rmCreateObjectDef("Duck Flock");
	rmAddObjectDefItem(DuckFlockID, "PropSwan", 1, 0.0);
	rmSetObjectDefMinDistance(DuckFlockID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(DuckFlockID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(DuckFlockID, avoidFishLand);
	rmAddObjectDefConstraint(DuckFlockID, avoidDuckFamily);
	rmAddObjectDefConstraint(DuckFlockID, avoidDuckFlock);
	rmAddObjectDefConstraint(DuckFlockID, avoidTurtles);
	rmAddObjectDefConstraint(DuckFlockID, avoidDuckShipRuins);
	rmPlaceObjectDefAtLoc(DuckFlockID, 0, 0.50, 0.50, cNumberPlayers);

	int PropTurtlesID = rmCreateObjectDef("Create Turtles");
	rmAddObjectDefItem(PropTurtlesID, "PropTurtles", 1, 0.0);
	rmSetObjectDefMinDistance(PropTurtlesID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(PropTurtlesID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(PropTurtlesID, avoidFishLand);
	rmAddObjectDefConstraint(PropTurtlesID, avoidDuckFamily);
	rmAddObjectDefConstraint(PropTurtlesID, avoidDuckFlock);
	rmAddObjectDefConstraint(PropTurtlesID, avoidTurtles);
	rmAddObjectDefConstraint(PropTurtlesID, avoidDuckShipRuins);
	rmPlaceObjectDefAtLoc(PropTurtlesID, 0, 0.50, 0.50, cNumberPlayers+2);

	int PropFishID = rmCreateObjectDef("Create Fish");
	rmAddObjectDefItem(PropFishID, "PropFish", 5, 8.0);
	rmSetObjectDefMinDistance(PropFishID,  rmXFractionToMeters(0.0));
	rmSetObjectDefMaxDistance(PropFishID,  rmXFractionToMeters(0.5));
	rmAddObjectDefConstraint(PropFishID, avoidFishLand);
	rmAddObjectDefConstraint(PropFishID, avoidDuckFamily);
	rmAddObjectDefConstraint(PropFishID, avoidDuckFlock);
	rmAddObjectDefConstraint(PropFishID, avoidTurtles);
	rmAddObjectDefConstraint(PropFishID, avoidPropFish);
	rmAddObjectDefConstraint(PropFishID, avoidDuckShipRuins);
	rmPlaceObjectDefAtLoc(PropFishID, 0, 0.50, 0.50, cNumberPlayers*8);
	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.50);

	// ****************************************** Advance Trigger ******************************************
	// QQ Group1:85442352	QQ Group2:456359856	E-mail:[email protected]

	int PlayerType = rmRandInt(1,2);
	int Chi1 = rmRandInt(1,2);
	int Chi2 = rmRandInt(3,4);

	// ***************************************** Installation Path *****************************************

	rmCreateTrigger("GameStart");
	rmSetTriggerRunImmediately(true);
	rmSetTriggerPriority(5);
	rmSetTriggerEffectParam("IdleProc","true);trQuestVarSet(\"Path\",1);xsDisableSelf();}}/*");
	rmCreateTrigger("Path	active	runImmediately{if(trQuestVarGet(\"Path\")!=1){"+"showSPCNote(\"Error!\",\"<color=0,255,255>Use-the-English-path-to-install-the-Age-of-Empires-III,please.\");"+"uiMessageBox2(20948);trEndGame();trYouWin(true);xsDisableRule(\"_Path\");}}/*");
	rmSetTriggerActive(false);
	rmSetTriggerPriority(5);

	rmCreateTrigger("GamestartInit");
	rmSwitchToTrigger(rmTriggerID("GamestartInit"));
	rmSetTriggerRunImmediately(true);
	oxyA("}}");

	// ********************************************** Trigger **********************************************

	// Text
	rmSetStatusText("",0.60);

	oxy("rule _0start active runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 1.00000000){");
	oxy("trSetLighting(\"spcCC5b\", 420.00000000);");
	oxy("xsDisableRule(\"_0start\");");
	oxy("xsEnableRule(\"_revolutionLighting\");");
	oxyZ("}} /*");

	oxy("rule _revolutionLighting inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 419.00000000){");
	oxy("trSetLighting(\"hc_revolution\", 250.00000000);");
	oxy("xsDisableRule(\"_revolutionLighting\");");
	oxy("xsEnableRule(\"_6lISBOM\");");
	oxyZ("}} /*");

	oxy("rule _6lISBOM inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 250.00000000){");
	oxy("trSetLighting(\"Lisbon Storm\", 50.00000000);");
	oxy("xsDisableRule(\"_6lISBOM\");");
	oxy("xsEnableRule(\"_7spcJC4aflashback\");");
	oxyZ("}} /*");

	oxy("rule _7spcJC4aflashback inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 50.00000000){");
	oxy("trSetLighting(\"spcJC4aflashback\", 120.00000000);");
	oxy("xsDisableRule(\"_7spcJC4aflashback\");");
	oxy("xsEnableRule(\"_8minescent\");");
	oxyZ("}} /*");

	oxy("rule _8minescent inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 420.00000000){");
	oxy("trSetLighting(\"minescene\", 300.00000000);");
	oxy("xsDisableRule(\"_8minescent\");");
	oxy("xsEnableRule(\"_1start\");");
	oxyZ("}} /*");

	oxy("rule _1start inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 300.00000000){");
	oxy("trSetLighting(\"New England Start\", 130.00000000);");
	oxy("xsDisableRule(\"_1start\");");
	oxy("xsEnableRule(\"_2start\");");
	oxyZ("}} /*");

	oxy("rule _2start inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 130.00000000){");
		If ( PlayerType == 1 )
			{
			oxy("trSetLighting(\"yellow_river\", 140.00000000);");
			}
		If ( PlayerType == 2 )
			{
			oxy("trSetLighting(\"yukon\", 140.00000000);");
			}
	oxy("xsDisableRule(\"_2start\");");
	oxy("xsEnableRule(\"_3patagonia\");");
	oxyZ("}} /*");

	oxy("rule _3patagonia inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 140.00000000){");
	oxy("trSetLighting(\"spcCC5b\", 150.00000000);");
	oxy("xsDisableRule(\"_3patagonia\");");
	oxy("xsEnableRule(\"_4hcrevolution4\");");
	oxyZ("}} /*");

	oxy("rule _4hcrevolution4 inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 150.00000000){");
	oxy("trSetLighting(\"hc_revolution\", 250.00000000);");
	oxy("xsDisableRule(\"_4hcrevolution4\");");
	oxy("xsEnableRule(\"_6lISBOM\");");
	oxyZ("}} /*");

	//This Map Trigger
	oxy("rule _StartTech active runImmediately { ");
	oxy("if((trTime()-cActivationTime) == 0.00000000){");
	oxy("trModifyProtounit(\"IGCTownCenter\", 0, 2, -34);");
	oxy("trModifyProtounit(\"Privateer\", 0, 0, -700);");
	oxy("trModifyProtounit(\"Privateer\", 0, 2, -14);");
	oxy("trModifyProtounit(\"ypJunk\", 0, 2, -6);");
	oxy("trModifyProtounit(\"ypCatamaran\", 0, 2, -2);");
	oxy("trModifyProtounit(\"Explorer\", 0, 0, -400);");
	oxy("trModifyProtounit(\"Explorer\", 0, 0, 400);");
	oxy("trModifyProtounit(\"SPCFountainOfYouth\", 0, 0, 40000);");
	oxy("trModifyProtounit(\"FishMoonBass\", 0, 25, 499);");
	oxy("trModifyProtounit(\"SPCFixedGun\", 0, 2, -45);");
	oxy("trModifyProtounit(\"SPCXPFixedGun\", 0, 2, -30);");
	//Explorer Nugget
		for(p=1;<=cNumberNonGaiaPlayers)
		{
		oxy("trTechSetStatus("+p+", 351, 0);");
		oxy("trTechSetStatus("+p+", 864, 0);");
		oxy("trTechSetStatus("+p+", 446, 0);");
		oxy("trTechSetStatus("+p+", 1539, 0);");
		oxy("trModifyProtounit(\"SPCXPFixedGun\", "+p+", 2, -30);");
		oxy("trModifyProtounit(\"SPCHealObject\", "+p+", 2, -38);");
			if (rmGetPlayerCiv(p) == 11)
				{
				oxy("trUnforbidProtounit("+p+",\"xpColonialMilitia\");");
				oxy("trUnforbidProtounit("+p+",\"xpGatlingGun\");");
				oxy("trModifyProtounit(\"SPCAmelia\", "+p+", 0, -650);");
				oxy("trModifyProtounit(\"SPCCooper\", "+p+", 0, -700);");
				}
			if (rmGetPlayerCiv(p) == 18)
				{
				oxy("trPlayerOverrideArtCulture("+p+",\"WesternEurope\");");
				oxy("trTechSetStatus("+p+", 72, 2);");
				oxy("trTechSetStatus("+p+", 1572, 2);");
				oxy("trTechSetStatus("+p+", 1384, 0);");
				oxy("trTechSetStatus("+p+", 1385, 0);");
				oxy("trTechSetStatus("+p+", 1386, 0);");
				oxy("trTechSetStatus("+p+", 1520, 1);");
				oxy("trTechSetStatus("+p+", 409, 1);");
				oxy("trTechSetStatus("+p+", 449, 1);");
				oxy("trTechSetStatus("+p+", 260, 1);");
				oxy("trTechSetStatus("+p+", 264, 1);");
				oxy("trTechSetStatus("+p+", 450, 1);");
				oxy("trTechSetStatus("+p+", 269, 1);");
				oxy("trTechSetStatus("+p+", 270, 1);");
				oxy("trTechSetStatus("+p+", 275, 1);");
				oxy("trTechSetStatus("+p+", 300, 1);");
				oxy("trTechSetStatus("+p+", 461, 1);");
				oxy("trTechSetStatus("+p+", 464, 1);");
				oxy("trTechSetStatus("+p+", 522, 1);");
				oxy("trTechSetStatus("+p+", 523, 1);");
				oxy("trTechSetStatus("+p+", 537, 1);");
				oxy("trTechSetStatus("+p+", 579, 1);");
				oxy("trTechSetStatus("+p+", 665, 1);");
				oxy("trTechSetStatus("+p+", 1098, 1);");
				oxy("trTechSetStatus("+p+", 1099, 1);");
				oxy("trTechSetStatus("+p+", 525, 1);");
				oxy("trTechSetStatus("+p+", 527, 1);");
				oxy("trTechSetStatus("+p+", 1426, 1);");
				oxy("trTechSetStatus("+p+", 1427, 1);");
				oxy("trTechSetStatus("+p+", 1108, 1);");
				oxy("trTechSetStatus("+p+", 1116, 1);");
				//oxy("trTechSetStatus("+p+", 1125, 1);");
				oxy("trTechSetStatus("+p+", 1126, 1);");
				oxy("trTechSetStatus("+p+", 1127, 1);");
				oxy("trTechSetStatus("+p+", 278, 1);");
				oxy("trTechSetStatus("+p+", 279, 1);");
				oxy("trTechSetStatus("+p+", 280, 1);");
				oxy("trTechSetStatus("+p+", 281, 1);");
				//oxy("trTechSetStatus("+p+", 282, 1);");
				oxy("trTechSetStatus("+p+", 283, 1);");
				oxy("trTechSetStatus("+p+", 284, 1);");
				//oxy("trTechSetStatus("+p+", 285, 1);");
				//oxy("trTechSetStatus("+p+", 286, 1);");
				oxy("trTechSetStatus("+p+", 287, 1);");
				oxy("trTechSetStatus("+p+", 288, 1);");
				oxy("trTechSetStatus("+p+", 1069, 1);");
				oxy("trTechSetStatus("+p+", 1664, 1);");
				oxy("trTechSetStatus("+p+", 292, 1);");
				oxy("trTechSetStatus("+p+", 341, 1);");
				oxy("trTechSetStatus("+p+", 389, 1);");
				oxy("trTechSetStatus("+p+", 1662, 1);");
				oxy("trTechSetStatus("+p+", 272, 1);");
				oxy("trTechSetStatus("+p+", 407, 1);");
				oxy("trTechSetStatus("+p+", 462, 1);");
				oxy("trTechSetStatus("+p+", 416, 1);");
				oxy("trTechSetStatus("+p+", 417, 1);");
				oxy("trTechSetStatus("+p+", 418, 1);");
				oxy("trTechSetStatus("+p+", 289, 1);");
				oxy("trTechSetStatus("+p+", 290, 1);");
				oxy("trTechSetStatus("+p+", 479, 1);");
				oxy("trTechSetStatus("+p+", 480, 1);");
				oxy("trTechSetStatus("+p+", 428, 1);");
				oxy("trTechSetStatus("+p+", 429, 1);");
				oxy("trTechSetStatus("+p+", 1110, 1);");
				oxy("trTechSetStatus("+p+", 1122, 1);");
				oxy("trTechSetStatus("+p+", 451, 1);");
				oxy("trTechSetStatus("+p+", 505, 1);");
				oxy("trTechSetStatus("+p+", 504, 1);");
				oxy("trTechSetStatus("+p+", 507, 1);");
				oxy("trTechSetStatus("+p+", 506, 1);");
				oxy("trTechSetStatus("+p+", 509, 1);");
				oxy("trTechSetStatus("+p+", 519, 1);");
				oxy("trTechSetStatus("+p+", 520, 1);");
				oxy("trTechSetStatus("+p+", 399, 1);");
				oxy("trTechSetStatus("+p+", 397, 1);");
				oxy("trTechSetStatus("+p+", 398, 1);");
				oxy("trTechSetStatus("+p+", 485, 1);");
				oxy("trTechSetStatus("+p+", 495, 1);");
				oxy("trTechSetStatus("+p+", 400, 1);");
				oxy("trTechSetStatus("+p+", 142, 1);");
				oxy("trTechSetStatus("+p+", 1140, 1);");
				oxy("trTechSetStatus("+p+", 1557, 1);");
				oxy("trTechSetStatus("+p+", 1519, 1);");
				oxy("trTechSetStatus("+p+", 1128, 1);");
				oxy("trTechSetStatus("+p+", 1129, 1);");
				oxy("trTechSetStatus("+p+", 1522, 1);");
				oxy("trTechSetStatus("+p+", 1523, 1);");
				oxy("trForbidProtounit("+p+",\"SettlerNative\");");
				oxy("trForbidProtounit("+p+",\"Corral\");");
				oxy("trUnforbidProtounit("+p+",\"xpColonialMilitia\");");
				oxy("trUnforbidProtounit("+p+",\"xpGatlingGun\");");
				oxy("trUnforbidProtounit("+p+",\"xpSPCColonialMilitia\");");
				oxy("trUnforbidProtounit("+p+",\"Settler\");");
				oxy("trUnforbidProtounit("+p+",\"Factory\");");
				oxy("trUnforbidProtounit("+p+",\"FortFrontier\");");
				oxy("trUnforbidProtounit("+p+",\"SPCXPFortWagon\");");
				oxy("trUnforbidProtounit("+p+",\"Church\");");
				oxy("trUnforbidProtounit("+p+",\"Arsenal\");");
				oxy("trUnforbidProtounit("+p+",\"Sheep\");");
				oxy("trUnforbidProtounit("+p+",\"Stable\");");
				oxy("trUnforbidProtounit("+p+",\"FieldHospital\");");
				oxy("trUnforbidProtounit("+p+",\"Hussar\");");
				oxy("trUnforbidProtounit("+p+",\"WallStraight5\");");
				oxy("trUnforbidProtounit("+p+",\"WallStraight2\");");
				oxy("trUnforbidProtounit("+p+",\"WallConnector\");");
				oxy("trUnforbidProtounit("+p+",\"House\");");
				oxy("trUnforbidProtounit("+p+",\"WallConnector\");");
				oxy("trUnforbidProtounit("+p+",\"Dragoon\");");
				oxy("trUnforbidProtounit("+p+",\"xpTomahawk\");");
				oxy("trUnforbidProtounit("+p+",\"Saloon\");");
				oxy("trUnforbidProtounit("+p+",\"Outpost\");");
				oxy("trUnforbidProtounit("+p+",\"Caravel\");");
				oxy("trUnforbidProtounit("+p+",\"Frigate\");");
				oxy("trUnforbidProtounit("+p+",\"Monitor\");");
				oxy("trUnforbidProtounit("+p+",\"Capitol\");");
				oxy("trUnforbidProtounit("+p+",\"Priest\");");
				oxy("trUnforbidProtounit("+p+",\"Surgeon\");");
				oxy("trUnforbidProtounit("+p+",\"Grenadier\");");
				oxy("trUnforbidProtounit("+p+",\"Falconet\");");
				oxy("trUnforbidProtounit("+p+",\"Culverin\");");
				oxy("trUnforbidProtounit("+p+",\"Mortar\");");
				oxy("trUnforbidProtounit("+p+",\"xpMantlet\");");
				oxy("trUnforbidProtounit("+p+",\"ArtilleryDepot\");");
				oxy("trUnforbidProtounit("+p+",\"xpPetard\");");
				oxy("trModifyProtounit(\"SPCXPWashington\", "+p+", 0, -1050);");
				oxy("trModifyProtounit(\"SPCXPNathaniel\", "+p+", 0, -850);");
				}
		}
	oxy("xsDisableRule(\"_StartTech\");");
	oxyZ("}} /*");

	// Text
	rmSetStatusText("",0.65);

	for(i=1;<=cNumberNonGaiaPlayers)
	{//For i Start.
	if (rmGetPlayerCiv(i) == 18)
	{//XPSPC
	oxy("rule _Colonialize"+i+" active runImmediately { ");
	oxy("if(trTechStatusCheck("+i+",522,2) || trTechStatusCheck("+i+",523,2) || trTechStatusCheck("+i+",537,2)){");
	oxy("trModifyProtounit(\"SPCXPWashington\", "+i+", 0, 200);");
	oxy("trModifyProtounit(\"SPCXPNathaniel\", "+i+", 0, 200);");
	oxy("xsDisableRule(\"_Colonialize"+i+"\");");
	oxyZ("}} /*");

	oxy("rule _Fortressize"+i+" active runImmediately { ");
	oxy("if(trTechStatusCheck("+i+",579,2) || trTechStatusCheck("+i+",665,2)){");
	oxy("trModifyProtounit(\"SPCXPWashington\", "+i+", 0, 200);");
	oxy("trModifyProtounit(\"SPCXPNathaniel\", "+i+", 0, 200);");
	oxy("xsDisableRule(\"_Fortressize"+i+"\");");
	oxyZ("}} /*");

	oxy("rule _Industrialize"+i+" active runImmediately { ");
	oxy("if(trTechStatusCheck("+i+",685,2) || trTechStatusCheck("+i+",1098,2) || trTechStatusCheck("+i+",1099,2)){");
	oxy("trModifyProtounit(\"SPCXPWashington\", "+i+", 0, 200);");
	oxy("trModifyProtounit(\"SPCXPNathaniel\", "+i+", 0, 200);");
	oxy("trModifyProtounit(\"xpColonialMilitia\", "+i+", 0, 70);");
	oxy("trModifyProtounit(\"xpSPCColonialMilitia\", "+i+", 0, 42);");
	oxy("trTechSetStatus("+i+", 314, 2);");
	oxy("trTechSetStatus("+i+", 291, 2);");
	oxy("xsDisableRule(\"_Industrialize"+i+"\");");
	oxyZ("}} /*");

	oxy("rule _Imperialize"+i+" active runImmediately { ");
	if (rmGetPlayerCiv(i) == rmGetCivID("XPSPC"))
	oxy("if(trTechStatusCheck("+i+",525,2)){");
	oxy("trModifyProtounit(\"SPCXPWashington\", "+i+", 0, 250);");
	oxy("trModifyProtounit(\"SPCXPNathaniel\", "+i+", 0, 250);");
	oxy("trModifyProtounit(\"xpColonialMilitia\", "+i+", 0, 100);");
	oxy("trModifyProtounit(\"xpSPCColonialMilitia\", "+i+", 0, 60);");
	oxy("trTechSetStatus("+i+", 1817, 2);");
	oxy("trTechSetStatus("+i+", 1004, 2);");
	oxy("trTechSetStatus("+i+", 481, 2);");
	oxy("xsDisableRule(\"_Imperialize"+i+"\");");
	oxyZ("}} /*");
	}//XPSPC

	}//For i End.

	// *****************************************************************************************************

	// Text
	rmSetStatusText("",0.70);


	rmSetStatusText("",0.90);

	// *********************************************** TEST ************************************************

	rmSetStatusText("",0.95);
/*
	oxy("rule _DisableFixedGunConvert active runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 0.00000000){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(FixedGunID, 0)+");");
	oxy("trUnitSuspendAction(\"AutoConvert\",True);");
	oxy("xsDisableRule(\"_DisableFixedGunConvert\");");
	oxyZ("}} /*");

	oxy("rule _EnableFixedGunConvert inactive runImmediately { ");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(BarracksID, 0)+");");
	oxy("if(trUnitDead()==true){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(BoneguardID, 0)+");");
	oxy("if(trUnitDead()==true){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(BoneguardAge2ID, 0)+");");
	oxy("if(trUnitDead()==true){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(BoneguardAge2ID, 0)+"+1);");
	oxy("if(trUnitDead()==true){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(BoneguardAge2ID, 0)+"+1);");
	oxy("if(trUnitDead()==true){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(FixedGunID, 0)+");");
	oxy("trUnitSuspendAction(\"AutoConvert\",False);");
	oxy("xsDisableRule(\"_EnableFixedGunConvert\");");
	oxy("xsEnableRule(\"_DisableFixedGunTrigger\");");
	oxy("}}}}}");
	oxy("xsDisableRule(\"_EnableFixedGunConvert\");");
	oxy("xsEnableRule(\"_EnableFixedGunConvert20Second\");");
	oxyZ("} /*");

	oxy("rule _EnableFixedGunConvert20Second active runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 20.00000000){");
	oxy("xsDisableRule(\"_EnableFixedGunConvert20Second\");");
	oxy("xsEnableRule(\"_EnableFixedGunConvert\");");
	oxyZ("}} /*");

	oxy("rule _DisableFixedGunTrigger inactive runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 5.00000000){");
	oxy("xsDisableRule(\"_EnableFixedGunConvert20Second\");");
	oxy("xsDisableRule(\"_DisableFixedGunTrigger\");");
	oxy("xsDisableRule(\"_EnableFixedGunConvert\");");
	oxyZ("}} /*");


	oxy("rule _SetUnitID active runImmediately { ");
	oxy("for(UnittypeID=3000;>-1){if(kbGetUnitTypeName(UnittypeID) ==\"Unit\") Break;}");
	oxy("for(WarShipsID=3000;>-1){if(kbGetUnitTypeName(WarShipsID) ==\"AbstractWarShip\") Break;}");
	oxy("if((trTime()-cActivationTime) == 0.00000000){");
	oxy("trQuestVarSet(\"cUnittypeUnit\",UnittypeID);");
	oxy("trQuestVarSet(\"cUnittypeAbstractWarShip\",WarShipsID);");
	oxy("xsDisableRule(\"_SetUnitID\");");
	oxyZ("}} /*");
*/

/*
	oxy("rule _SetUnitID active runImmediately { ");
	oxy("if((trTime()-cActivationTime) == 0.00000000){");
	oxy("trQuestVarSet(\"Unit\",0);");
	oxy("while(kbGetUnitTypeName(trQuestVarGet(\"Unit\"))!=\"Unit\"){");
	oxy("trQuestVarSet(\"Unit\",trQuestVarGet(\"Unit\")+1);}");
	oxy("xsDisableRule(\"_SetUnitID\");");
	oxyZ("}} /*");
*/
/*
	oxy("rule _GetUnitID active runImmediately { ");
	oxy("xsSetContextPlayer(1);");
	oxy("if((trTime()-cActivationTime) == 10.00000000){");
	oxy("trChatSendSpoofed(0,\"GetUnitID:\"+trQuestVarGet(\"cUnittypeUnit\"));");
	oxy("for(u=trQuestVarGet(\"cUnittypeUnit\");>1)");
	oxy("{");
	oxy("if(kbProtoUnitIsType(1, u,trQuestVarGet(\"cUnittypeUnit\")))");
	oxy("trModifyProtounit(\"\"+kbGetProtoUnitName(u), 1, 0, 1000.0);");
	oxy("xsDisableRule(\"_GetUnitID\");");
	oxy("}");
	oxyZ("}} /*");
*/
	float Debug1 = rmGetHomeCityLevel(cNumberNonGaiaPlayers);
	oxy("rule _Debug active runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 1.00000000){");
	oxy("trChatSendSpoofed(0,\"<color=0,254,254>Debug Mode\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>ObsUIPlayer:<color=0,255,255>"+ObsUIPlayer+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Breite:<color=0,255,255>"+Breite+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Breite0:<color=0,255,255>"+Breite0+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Chi3:<color=0,255,255>"+Chi3+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>playerTiles:<color=0,255,255>"+playerTiles+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>size=2*sqrt(cNumberNonGaiaPlayers*playerTiles):<color=0,255,255>"+size+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>InvisibleProjectileCount:<color=0,255,255>"+InvisibleProjectileCount+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>InvisibleProjectileDistance:<color=0,255,255>"+InvisibleProjectileDistance+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>OneVOnePlacement:<color=0,255,255>"+OneVOnePlacement+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>(FFA)TeamLocation:<color=0,255,255>"+TeamLocation+"\");");
//	oxy("trChatSendSpoofed(0,\"<color=0,255,0>tpvariation:<color=0,255,255>"+tpvariation+"\");");
//	oxy("trChatSendSpoofed(0,\"<color=0,255,0>socketcount:<color=0,255,255>"+socketcount+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>rmGetHomeCityLevel(Last Player):<color=0,255,255>"+Debug1+"\");");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Unittype1463:<color=0,255,255>\"+kbGetUnitTypeName(1463));");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Unittype1480:<color=0,255,255>\"+kbGetUnitTypeName(1480));");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>Unittype1666:<color=0,255,255>\"+kbGetUnitTypeName(1666));");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>cUnittypeUnit:<color=0,2"+"55,255>\"+trQuestVarGet(\"cUnittypeUnit\"));");
	oxy("trChatSendSpoofed(0,\"<color=0,255,0>cUnittypeAbstractWarShip:<color=0,2"+"55,255>\"+trQuestVarGet(\"cUnittypeAbstractWarShip\"));");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>AGG Map : <color=0,254,255>MarshOfTheMoon(Made by XiaoYu)\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>Last modified date : <color=0,254,255>2018.10.29 19:45:10\");");
	oxy("trChatSendSpoofed(0,\"<color=0,254,0>Welcome to our QQ Group : <color=0,254,255>85442352\");");
	if (rmGetNomadStart()!=true)
		{
		for(p=1;<=cNumberNonGaiaPlayers)
			{
			if (rmGetPlayerCiv(p) >= 14 && rmGetPlayerCiv(p) <= 18 )
				{
				oxy("trChatSendToPlayer(0,"+p+",\"{63974}\");");
				}
			else if (rmGetPlayerCiv(p) >= 19 && rmGetPlayerCiv(p) <= 26 )
				{
				oxy("trChatSendToPlayer(0,"+p+",\"{63973}\");");
				}
			else
				{
				oxy("trChatSendToPlayer(0,"+p+",\"{31536}\");");
				}
			}
		}
	oxy("xsDisableRule(\"_Debug\");");
	oxyZ("}} /*");

/*
	oxy("rule _FixedGun active runImmediately { ");
	oxy("if((trTime()-cActivationTime) >= 0.00000000){");
	oxy("trUnitSelectClear();");
	oxy("trUnitSelectByID("+rmGetUnitPlaced(FixedGunBaseID, 0)+");");
	oxy("trUnitChangeProtoUnit(\"SPCFixedGunBase\");");
	oxy("xsDisableRule(\"_FixedGun\");");
	oxyZ("}} /*");
*/
	// ******************************************** Trigger End ********************************************
	oxy("rule _Temp inactive { if(true){");
	oxyZ("xsDisableSelf();");
	// *****************************************************************************************************

	// Text


	// Text
	rmSetStatusText("",1.00);


	} //END
	
	
	
/* */