SHARE
TWEET

Untitled

a guest Dec 12th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-------------------------------------------------------------------
  2. // Description: Script File used for Skirmish Hall/ Arena/ PvP
  3. // Designer:    Matt Craver
  4. //-------------------------------------------------------------------
  5.  
  6. using System;
  7. using System.Collections.Generic;
  8.  
  9. //-------------------------------------------------------------------
  10. public partial class RMScript : RandomMap
  11. {
  12.     void setShelteredPassMapSizeArray(int maxTeam)
  13.     {
  14.         float scale = 1.0f;
  15.  
  16.         switch (maxTeam)
  17.         {
  18.             case 1:
  19.                 scale = shelteredPassMapSizeScaleTeamOfOne;
  20.                 break;
  21.             case 2:
  22.                 scale = shelteredPassMapSizeScaleTeamOfTwo;
  23.                 break;
  24.             case 3:
  25.                 scale = shelteredPassMapSizeScaleTeamOfThree;
  26.                 break;
  27.             case 4:
  28.                 scale = shelteredPassMapSizeScaleTeamOfFour;
  29.                 break;
  30.         };
  31.  
  32.         mapSizeArray = new int[(int)mapSize.eNumMapSizes - 1]
  33.         {
  34.             (int)(shelteredPassMapSizeBaseSmall * scale),                       // Small
  35.             (int)(shelteredPassMapSizeBaseMedium * scale),                       // Medium
  36.             (int)(shelteredPassMapSizeBaseLarge * scale),                       // Large
  37.             (int)(shelteredPassMapSizeBaseHuge * scale),                       // Huge
  38.         };
  39.     }
  40.  
  41.     void placeMapPlayersShelteredPass(int settingFormation, int settingMapSize, mapLoaderGameModeTypes gameMode)
  42.     {
  43.         //PlacePlayersCircular(0.38f, 0.38f, 0);
  44.        
  45.         PlacePlayer(1, 0.5f, 0.76f);
  46.         PlacePlayer(2, 0.5f, 0.24f);
  47.        
  48.         // NOTE: this next line requires the isncluded default_start_groupings.cs file to work.
  49.         // DAL - this goes away IF we rely on quests to place player groupings.
  50.         placeStartingGroupings();
  51.         //PlaceStartingUnits("Shared_Start_Skirmish");
  52.  
  53.         createStartingResourceConstraints(cStartingResourcesAvoidAll, cStartingResourcesGoldVsStone);
  54.     }
  55.  
  56.     void setShelteredPassMapTerrain()
  57.     {
  58.         List<string> regionTypes = new List<string>() { "Celtic Alps"};
  59.         GetRandomTerrain(false, regionTypes);
  60.        
  61.         // Some standard minor elevation changes.
  62.         SetMapElevationParameters(ElevationType.cElevTurbulence, 0.01f, 7, 0.5f, 6.0f);
  63.        
  64.         // This line now does several things that used to be done with multiple lines in the old system -
  65.         // i.e., makes it a land map, sets the mix, and does a terrain-initialize with that mix.
  66.         InitializeAsLandWithMix(baseMix, 5.0f, 0.0f);
  67.        
  68.         SetMapType("grass");
  69.         SetMapType("land");
  70.     }
  71.  
  72.     void createShelteredPassMapShort(mapLoaderMapTypes settingMapType, int[,] mapResourcesTable, int settingStartingResources,
  73.         int settingMapResources, int settingFormation, int settingMapSize, mapLoaderGameModeTypes gameMode)
  74.     {
  75.         createRandomMapClasses();
  76.        
  77.         Class mSplitCliff = new Class("split cliff class");
  78.         Class mPlayerAreas = new Class("player areas class");
  79.         Class mSplitMap = new Class("split map class");
  80.         Class mTrees = new Class("trees class");
  81.         //Class mQuarries = new Class("quarries class");
  82.         Class mHuntAreas = new Class("hunt areas class");
  83.         //Class mPlayerLand = new Class("player land class");
  84.         //Class mAllIslands = new Class("all islands class");
  85.         Class mPonds = new Class("ponds class");
  86.         Class mCliffs = new Class("cliffs class");
  87.  
  88.         createMapConstraints(cAvoidForestDist, cAvoidHillDist, cBerryVsForestDist, cBigForestVsBigForestDist, cCliffAvoidWaterDist, 50.0f,
  89.                              cDangerousVsForestDist, cDeerPlayerGroupingConstraint, 30.0f, 50.0f, 24.0f,
  90.                              10.0f, cForestPlayerGroupingConstraintDist, 35.0f, cGoldVsGoldDist, 25.0f,
  91.                              cPredatorVsForestDist, cPredatorVsPredatorDist, cQuestTargetConstraintDist, cShortAvoidCliffDist, cStoneVsStoneDist, settingMapSize);
  92.  
  93.  
  94.         Constraint goldVsStone = new TypeDistanceConstraint("gold v stone", "MineGold", 6.0f);
  95.         Constraint fishAvoidShore = new TerrainDistanceConstraint("fish Avoid Shore", "Land", true, 6.0f);
  96.  
  97.         //These constraints are used to get a huntable herd just off the screen for each player
  98.         Constraint deerAvoidPlayer = new ClassDistanceConstraint("deer avoid player", mClassPlayer, 30.0f);
  99.         Constraint deerVsDeer = new TypeDistanceConstraint("near player deer v deer", huntableType, 30.0f);
  100.        
  101.  
  102.         float xMeters = XMetersToFraction(10);
  103.         float zMeters = ZMetersToFraction(10);
  104.  
  105.         Constraint forestAvoidEdge = new BoxConstraint("forest v edge", 0.0f + xMeters, 0.0f + zMeters, 1.0f - xMeters, 1.0f - zMeters);
  106.         forestAvoidEdge.SetBufferDistance(4.0f);
  107.        
  108.         float xMeters2 = XMetersToFraction(15);
  109.         float zMeters2 = ZMetersToFraction(15);
  110.        
  111.         Constraint avoidEdge = new BoxConstraint("vs edge", 0.0f + xMeters2, 0.0f + zMeters2, 1.0f - xMeters2, 1.0f - zMeters2);
  112.  
  113.         List<Constraint> westCliffConstraints = new List<Constraint>() { mFarPlayerConstraint, mCliffVscliff };
  114.         List<Constraint> eastCliffConstraints = new List<Constraint>() { mCliffVscliff, mFarPlayerConstraint };
  115.         List<Constraint> centerCliffConstraints = new List<Constraint>() { mCliffVscliff, mFarPlayerConstraint };
  116.         List<Constraint> primaryForestConstraints = new List<Constraint>() { mAvoidAll, mForestAvoidWater, mAvoidCliff, mBigForestVsBigForest, mForestVsResources, mForestPlayerGroupingConstraint, mPlayerConstraint, forestAvoidEdge };
  117.         List<Constraint> secondaryForestConstraints = new List<Constraint>() { mAvoidAll, mForestAvoidCliff, mForestAvoidWater, mForestVsForest, mForestVsResources, mPlayerConstraint, mAvoidCliff };
  118.         List<Constraint> primaryGoldMineConstraints = new List<Constraint>() { mAvoidAll, mMinesAvoidPlayers, mGoldVsGold, mAvoidWater, mShortAvoidCliff, mAvoidForest };
  119.         List<Constraint> primaryStoneMineConstraints = new List<Constraint>() { mAvoidAll, mMinesAvoidPlayers, mStoneVsStone, mAvoidWater, mShortAvoidCliff, goldVsStone, mAvoidForest };
  120.         List<Constraint> huntableConstraints = new List<Constraint>() { mDeerVsDeer, mDeerVsGold, mDeerVsStone, mDeerVsTree, mAvoidWater, mShortAvoidCliff, mDeerPlayerGroupingConstraint };
  121.         List<Constraint> predatorConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mPredatorVsPredator, mPredatorVsForest, mFarPlayerConstraint, mShortAvoidCliff };
  122.         List<Constraint> dangerousHuntableConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mDangerousVsDangerous, mDangerousVsForest, mFarPlayerConstraint, mShortAvoidCliff };
  123.         //List<Constraint> stragglerTreeConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mMediumPlayerConstraint};
  124.         List<Constraint> berryTreeConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mBerryVsBerry, mBerryVsForest, mFarPlayerConstraint, mShortAvoidCliff };
  125.  
  126.         List<Constraint> tertiaryForestConstraints = new List<Constraint>() { mAvoidAll, mPlayerConstraint, mAvoidCliff };
  127.         List<Constraint> huntableRingConstraint = new List<Constraint>() { mAvoidAll, deerVsDeer, deerAvoidPlayer, mAvoidWater, mDeerVsTree, avoidEdge };
  128.        
  129.         List<Constraint> fishConstraints = new List<Constraint>() { mFishVsFish, mFishAvoidEdgeOfMap, fishAvoidShore };
  130.  
  131.         SetStatusText("", 0.2f);
  132.        
  133.        
  134.         placeMapPlayersShelteredPass(settingFormation, settingMapSize, gameMode);
  135.        
  136.         placeStartingResources(settingMapResources);
  137.        
  138.        
  139.  
  140.         //float sign = Math.Sign(RandFloat(-5, 10));
  141.        
  142.         //create cliffs
  143.        
  144.         float sign = 1;
  145.  
  146.         List<InfluenceSegment> segments = new List<InfluenceSegment>();
  147.         //segments.Add(new InfluenceSegment(0.475f, 0.1f, 0.475f, 0.375f));
  148.         //createCliffs(null, "cliff team 2 south", 1, 0.0125f, 0.0175f, cliffType, 1, 1.0f, 0.0f, 1.0f, 0, 0, 0, 3.0f, 6.0f, 0.8f, 5, sign * 8.0f, 0.0f, 5.0f, true, baseMix, 0.5f, 0.25f, false, segments, buildTerrainSettings.eBuildIndividual);
  149.  
  150.         segments.Clear();
  151.         segments.Add(new InfluenceSegment(0.35f, 0.4f, 0.65f, 0.4f));
  152.         createCliffs(null, "cliff team 1 ", 1, 0.0155f, 0.0185f, cliffType, 1, 1.0f, 0.0f, 1.0f, 0, 0, 0, 3.0f, 6.0f, 0.85f, 5, sign * 8.0f, 0.0f, 5.0f, true, baseMix, 0.5f, 0.4f, false, segments, buildTerrainSettings.eBuildIndividual);
  153.        
  154.         Area southForest = new Area("forest team 1");
  155.         southForest.SetSize(0.01125f, 0.01125f);
  156.         southForest.SetLocation(0.5f, 0.34f);
  157.         southForest.SetCoherence(0.8f);
  158.         southForest.SetForestType(forestType);
  159.         southForest.SetForestDensity(1.0f);
  160.         southForest.SetForestClumpiness(0.0f);
  161.         southForest.SetForestUnderbrush(0.0f);
  162.         southForest.AddInfluenceSegment(0.35f, 0.35f, 0.65f, 0.35f);
  163.         southForest.AddToClass(mTrees);
  164.         southForest.Build();
  165.        
  166.        
  167.         segments.Clear();
  168.         segments.Add(new InfluenceSegment(0.35f, 0.6f, 0.65f, 0.6f));
  169.         createCliffs(null, "cliff team 2 ", 1, 0.0155f, 0.0185f, cliffType, 1, 1.0f, 0.0f, 1.0f, 0, 0, 0, 3.0f, 6.0f, 0.85f, 5, sign * 8.0f, 0.0f, 5.0f, true, baseMix, 0.5f, 0.6f, false, segments, buildTerrainSettings.eBuildIndividual);
  170.  
  171.         Area northForest = new Area("north forest");
  172.         northForest.SetSize(0.01125f, 0.01125f);
  173.         northForest.SetLocation(0.5f, 0.66f);
  174.         northForest.SetCoherence(0.8f);
  175.         northForest.SetForestType(forestType);
  176.         northForest.SetForestDensity(1.0f);
  177.         northForest.SetForestClumpiness(0.0f);
  178.         northForest.SetForestUnderbrush(0.0f);
  179.         northForest.AddInfluenceSegment(0.35f, 0.65f, 0.65f, 0.65f);
  180.         northForest.AddToClass(mTrees);
  181.         northForest.Build();
  182.  
  183.         //end cliffs creation
  184.  
  185.         //to create the rivers
  186.        
  187.         float x1, z1, x2, z2, x3, z3, x4, z4;
  188.        
  189.         x1 = 0.0f;
  190.         z1 = 0.03f; //decides where the river ends
  191.  
  192.         x2 = 1.0f;
  193.         z2 = 0.03f; //decides where the river starts
  194.  
  195.         x3 = 0.0f;
  196.         z3 = 0.97f;
  197.  
  198.         x4 = 0.97f;
  199.         z4 = 1.0f;
  200.  
  201.         List<InfluenceSegment> segments1 = new List<InfluenceSegment>();
  202.         segments1.Add(new InfluenceSegment(x1, z1, x2, z2));
  203.         List<InfluenceSegment> segments2 = new List<InfluenceSegment>();
  204.         segments2.Add(new InfluenceSegment(x3, z3, x4, z4));
  205.  
  206.         createRiver(null, "Bottom River", 0.09f, 0.09f, waterType, 3.0f, 0.75f, 25, 0.5f, 0.03f, segments1, null, 2.65f);
  207.         createRiver(null, "Top River", 0.09f, 0.09f, waterType, 3.0f, 0.75f, 25, 0.5f, 0.97f, segments2, null, 2.65f);
  208.        
  209.         //end river creation
  210.        
  211.         // Split map for placing resources
  212.        
  213.         Constraint splitMapAvoidCliffs = new TerrainDistanceConstraint("split map avoid cliffs", "land", false, 5.0f);
  214.         Constraint splitMapAvoidEachOther = new ClassDistanceConstraint("split map avoid each other", mSplitMap, 25.0f);
  215.        
  216.         Area splitMap1 = new Area("split map team 1");
  217.         splitMap1.SetSize(0.5f, 0.5f);
  218.         splitMap1.SetLocation(0.0f, 0.5f);
  219.         splitMap1.SetCoherence(1.0f);
  220.         //splitMap1.SetTerrainType(@"celt\dirt49_df");
  221.         splitMap1.AddConstraint(splitMapAvoidCliffs);
  222.         splitMap1.AddConstraint(splitMapAvoidEachOther);
  223.         splitMap1.AddToClass(mSplitMap);
  224.         //splitMap1.Build();
  225.        
  226.         Area splitMap2 = new Area("split map team 2");
  227.         splitMap2.SetSize(0.5f, 0.5f);
  228.         splitMap2.SetLocation(1.0f, 0.5f);
  229.         splitMap2.SetCoherence(1.0f);
  230.         //splitMap2.SetTerrainType(@"celt\dirt49_df");
  231.         splitMap2.AddConstraint(splitMapAvoidCliffs);
  232.         splitMap2.AddConstraint(splitMapAvoidEachOther);
  233.         splitMap2.AddToClass(mSplitMap);
  234.        
  235.         BuildAllAreas();
  236.      
  237.      
  238.         //Create a single huntable group near to the players base.
  239.         //Second group added for this map
  240.         for (int i = 1; i < cNumberPlayers; ++i)
  241.         {
  242.             if (IsPlayerSpectator(i))
  243.                 continue;
  244.             AreaMaxDistanceConstraint max = new AreaMaxDistanceConstraint("player max" + i.ToString(), FindArea("Player" + i), 40.0f);
  245.             huntableRingConstraint.Add(max);
  246.             createSkirmishHuntables(huntableRingConstraint, "playerhuntables" + i, 1, suggestedHuntableNum, suggestedHuntableNum + 2, XMetersToFraction(40), -1, -1);
  247.             createSkirmishHuntables(huntableRingConstraint, "playerhuntables 2" + i, 1, suggestedHuntableNum, suggestedHuntableNum + 2, XMetersToFraction(40), -1, -1);
  248.             huntableRingConstraint.Remove(max);
  249.         }
  250.      
  251.      
  252.         // add fish to the rivers
  253.         createWaterFish(fishConstraints, "Top Fish", 4 + (4 * cNumberNonSpectatorPlayers), 0.0f, 0.5f, 1.0f, 0.5f);
  254.         createWaterFish(fishConstraints, "Bottom Fish", 4 + (4 * cNumberNonSpectatorPlayers), 0.0f, 0.5f, 0.0f, 0.5f);
  255.      
  256.  
  257.        
  258.         SetStatusText("", 0.6f);
  259.        
  260.         // Resource Triggers
  261.         CreateTrigger("grant resource all players");
  262.         SetTriggerRunImmediately(true);
  263.         TriggerEffect_GrantResources(1, "stone", 10000);
  264.         TriggerEffect_GrantResources(1, "gold", 10000);
  265.         TriggerEffect_GrantResources(1, "wood", 10000);
  266.         TriggerEffect_GrantResources(1, "food", 10000);
  267.  
  268.         Info("Finished generating B02 ShelteredPass Map");
  269.     }
  270. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top