Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------------------------------
- // Description: Script File used for Skirmish Hall/ Arena/ PvP
- // Designer: Matt Craver
- //-------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- //-------------------------------------------------------------------
- public partial class RMScript : RandomMap
- {
- void setShelteredPassMapSizeArray(int maxTeam)
- {
- float scale = 1.0f;
- switch (maxTeam)
- {
- case 1:
- scale = shelteredPassMapSizeScaleTeamOfOne;
- break;
- case 2:
- scale = shelteredPassMapSizeScaleTeamOfTwo;
- break;
- case 3:
- scale = shelteredPassMapSizeScaleTeamOfThree;
- break;
- case 4:
- scale = shelteredPassMapSizeScaleTeamOfFour;
- break;
- };
- mapSizeArray = new int[(int)mapSize.eNumMapSizes - 1]
- {
- (int)(shelteredPassMapSizeBaseSmall * scale), // Small
- (int)(shelteredPassMapSizeBaseMedium * scale), // Medium
- (int)(shelteredPassMapSizeBaseLarge * scale), // Large
- (int)(shelteredPassMapSizeBaseHuge * scale), // Huge
- };
- }
- void placeMapPlayersShelteredPass(int settingFormation, int settingMapSize, mapLoaderGameModeTypes gameMode)
- {
- //PlacePlayersCircular(0.38f, 0.38f, 0);
- PlacePlayer(1, 0.5f, 0.76f);
- PlacePlayer(2, 0.5f, 0.24f);
- // NOTE: this next line requires the isncluded default_start_groupings.cs file to work.
- // DAL - this goes away IF we rely on quests to place player groupings.
- placeStartingGroupings();
- //PlaceStartingUnits("Shared_Start_Skirmish");
- createStartingResourceConstraints(cStartingResourcesAvoidAll, cStartingResourcesGoldVsStone);
- }
- void setShelteredPassMapTerrain()
- {
- List<string> regionTypes = new List<string>() { "Celtic Alps"};
- GetRandomTerrain(false, regionTypes);
- // Some standard minor elevation changes.
- SetMapElevationParameters(ElevationType.cElevTurbulence, 0.01f, 7, 0.5f, 6.0f);
- // This line now does several things that used to be done with multiple lines in the old system -
- // i.e., makes it a land map, sets the mix, and does a terrain-initialize with that mix.
- InitializeAsLandWithMix(baseMix, 5.0f, 0.0f);
- SetMapType("grass");
- SetMapType("land");
- }
- void createShelteredPassMapShort(mapLoaderMapTypes settingMapType, int[,] mapResourcesTable, int settingStartingResources,
- int settingMapResources, int settingFormation, int settingMapSize, mapLoaderGameModeTypes gameMode)
- {
- createRandomMapClasses();
- Class mSplitCliff = new Class("split cliff class");
- Class mPlayerAreas = new Class("player areas class");
- Class mSplitMap = new Class("split map class");
- Class mTrees = new Class("trees class");
- //Class mQuarries = new Class("quarries class");
- Class mHuntAreas = new Class("hunt areas class");
- //Class mPlayerLand = new Class("player land class");
- //Class mAllIslands = new Class("all islands class");
- Class mPonds = new Class("ponds class");
- Class mCliffs = new Class("cliffs class");
- createMapConstraints(cAvoidForestDist, cAvoidHillDist, cBerryVsForestDist, cBigForestVsBigForestDist, cCliffAvoidWaterDist, 50.0f,
- cDangerousVsForestDist, cDeerPlayerGroupingConstraint, 30.0f, 50.0f, 24.0f,
- 10.0f, cForestPlayerGroupingConstraintDist, 35.0f, cGoldVsGoldDist, 25.0f,
- cPredatorVsForestDist, cPredatorVsPredatorDist, cQuestTargetConstraintDist, cShortAvoidCliffDist, cStoneVsStoneDist, settingMapSize);
- Constraint goldVsStone = new TypeDistanceConstraint("gold v stone", "MineGold", 6.0f);
- Constraint fishAvoidShore = new TerrainDistanceConstraint("fish Avoid Shore", "Land", true, 6.0f);
- //These constraints are used to get a huntable herd just off the screen for each player
- Constraint deerAvoidPlayer = new ClassDistanceConstraint("deer avoid player", mClassPlayer, 30.0f);
- Constraint deerVsDeer = new TypeDistanceConstraint("near player deer v deer", huntableType, 30.0f);
- float xMeters = XMetersToFraction(10);
- float zMeters = ZMetersToFraction(10);
- Constraint forestAvoidEdge = new BoxConstraint("forest v edge", 0.0f + xMeters, 0.0f + zMeters, 1.0f - xMeters, 1.0f - zMeters);
- forestAvoidEdge.SetBufferDistance(4.0f);
- float xMeters2 = XMetersToFraction(15);
- float zMeters2 = ZMetersToFraction(15);
- Constraint avoidEdge = new BoxConstraint("vs edge", 0.0f + xMeters2, 0.0f + zMeters2, 1.0f - xMeters2, 1.0f - zMeters2);
- List<Constraint> westCliffConstraints = new List<Constraint>() { mFarPlayerConstraint, mCliffVscliff };
- List<Constraint> eastCliffConstraints = new List<Constraint>() { mCliffVscliff, mFarPlayerConstraint };
- List<Constraint> centerCliffConstraints = new List<Constraint>() { mCliffVscliff, mFarPlayerConstraint };
- List<Constraint> primaryForestConstraints = new List<Constraint>() { mAvoidAll, mForestAvoidWater, mAvoidCliff, mBigForestVsBigForest, mForestVsResources, mForestPlayerGroupingConstraint, mPlayerConstraint, forestAvoidEdge };
- List<Constraint> secondaryForestConstraints = new List<Constraint>() { mAvoidAll, mForestAvoidCliff, mForestAvoidWater, mForestVsForest, mForestVsResources, mPlayerConstraint, mAvoidCliff };
- List<Constraint> primaryGoldMineConstraints = new List<Constraint>() { mAvoidAll, mMinesAvoidPlayers, mGoldVsGold, mAvoidWater, mShortAvoidCliff, mAvoidForest };
- List<Constraint> primaryStoneMineConstraints = new List<Constraint>() { mAvoidAll, mMinesAvoidPlayers, mStoneVsStone, mAvoidWater, mShortAvoidCliff, goldVsStone, mAvoidForest };
- List<Constraint> huntableConstraints = new List<Constraint>() { mDeerVsDeer, mDeerVsGold, mDeerVsStone, mDeerVsTree, mAvoidWater, mShortAvoidCliff, mDeerPlayerGroupingConstraint };
- List<Constraint> predatorConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mPredatorVsPredator, mPredatorVsForest, mFarPlayerConstraint, mShortAvoidCliff };
- List<Constraint> dangerousHuntableConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mDangerousVsDangerous, mDangerousVsForest, mFarPlayerConstraint, mShortAvoidCliff };
- //List<Constraint> stragglerTreeConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mMediumPlayerConstraint};
- List<Constraint> berryTreeConstraints = new List<Constraint>() { mAvoidAll, mAvoidWater, mBerryVsBerry, mBerryVsForest, mFarPlayerConstraint, mShortAvoidCliff };
- List<Constraint> tertiaryForestConstraints = new List<Constraint>() { mAvoidAll, mPlayerConstraint, mAvoidCliff };
- List<Constraint> huntableRingConstraint = new List<Constraint>() { mAvoidAll, deerVsDeer, deerAvoidPlayer, mAvoidWater, mDeerVsTree, avoidEdge };
- List<Constraint> fishConstraints = new List<Constraint>() { mFishVsFish, mFishAvoidEdgeOfMap, fishAvoidShore };
- SetStatusText("", 0.2f);
- placeMapPlayersShelteredPass(settingFormation, settingMapSize, gameMode);
- placeStartingResources(settingMapResources);
- //float sign = Math.Sign(RandFloat(-5, 10));
- //create cliffs
- float sign = 1;
- List<InfluenceSegment> segments = new List<InfluenceSegment>();
- //segments.Add(new InfluenceSegment(0.475f, 0.1f, 0.475f, 0.375f));
- //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);
- segments.Clear();
- segments.Add(new InfluenceSegment(0.35f, 0.4f, 0.65f, 0.4f));
- 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);
- Area southForest = new Area("forest team 1");
- southForest.SetSize(0.01125f, 0.01125f);
- southForest.SetLocation(0.5f, 0.34f);
- southForest.SetCoherence(0.8f);
- southForest.SetForestType(forestType);
- southForest.SetForestDensity(1.0f);
- southForest.SetForestClumpiness(0.0f);
- southForest.SetForestUnderbrush(0.0f);
- southForest.AddInfluenceSegment(0.35f, 0.35f, 0.65f, 0.35f);
- southForest.AddToClass(mTrees);
- southForest.Build();
- segments.Clear();
- segments.Add(new InfluenceSegment(0.35f, 0.6f, 0.65f, 0.6f));
- 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);
- Area northForest = new Area("north forest");
- northForest.SetSize(0.01125f, 0.01125f);
- northForest.SetLocation(0.5f, 0.66f);
- northForest.SetCoherence(0.8f);
- northForest.SetForestType(forestType);
- northForest.SetForestDensity(1.0f);
- northForest.SetForestClumpiness(0.0f);
- northForest.SetForestUnderbrush(0.0f);
- northForest.AddInfluenceSegment(0.35f, 0.65f, 0.65f, 0.65f);
- northForest.AddToClass(mTrees);
- northForest.Build();
- //end cliffs creation
- //to create the rivers
- float x1, z1, x2, z2, x3, z3, x4, z4;
- x1 = 0.0f;
- z1 = 0.03f; //decides where the river ends
- x2 = 1.0f;
- z2 = 0.03f; //decides where the river starts
- x3 = 0.0f;
- z3 = 0.97f;
- x4 = 0.97f;
- z4 = 1.0f;
- List<InfluenceSegment> segments1 = new List<InfluenceSegment>();
- segments1.Add(new InfluenceSegment(x1, z1, x2, z2));
- List<InfluenceSegment> segments2 = new List<InfluenceSegment>();
- segments2.Add(new InfluenceSegment(x3, z3, x4, z4));
- createRiver(null, "Bottom River", 0.09f, 0.09f, waterType, 3.0f, 0.75f, 25, 0.5f, 0.03f, segments1, null, 2.65f);
- createRiver(null, "Top River", 0.09f, 0.09f, waterType, 3.0f, 0.75f, 25, 0.5f, 0.97f, segments2, null, 2.65f);
- //end river creation
- // Split map for placing resources
- Constraint splitMapAvoidCliffs = new TerrainDistanceConstraint("split map avoid cliffs", "land", false, 5.0f);
- Constraint splitMapAvoidEachOther = new ClassDistanceConstraint("split map avoid each other", mSplitMap, 25.0f);
- Area splitMap1 = new Area("split map team 1");
- splitMap1.SetSize(0.5f, 0.5f);
- splitMap1.SetLocation(0.0f, 0.5f);
- splitMap1.SetCoherence(1.0f);
- //splitMap1.SetTerrainType(@"celt\dirt49_df");
- splitMap1.AddConstraint(splitMapAvoidCliffs);
- splitMap1.AddConstraint(splitMapAvoidEachOther);
- splitMap1.AddToClass(mSplitMap);
- //splitMap1.Build();
- Area splitMap2 = new Area("split map team 2");
- splitMap2.SetSize(0.5f, 0.5f);
- splitMap2.SetLocation(1.0f, 0.5f);
- splitMap2.SetCoherence(1.0f);
- //splitMap2.SetTerrainType(@"celt\dirt49_df");
- splitMap2.AddConstraint(splitMapAvoidCliffs);
- splitMap2.AddConstraint(splitMapAvoidEachOther);
- splitMap2.AddToClass(mSplitMap);
- BuildAllAreas();
- //Create a single huntable group near to the players base.
- //Second group added for this map
- for (int i = 1; i < cNumberPlayers; ++i)
- {
- if (IsPlayerSpectator(i))
- continue;
- AreaMaxDistanceConstraint max = new AreaMaxDistanceConstraint("player max" + i.ToString(), FindArea("Player" + i), 40.0f);
- huntableRingConstraint.Add(max);
- createSkirmishHuntables(huntableRingConstraint, "playerhuntables" + i, 1, suggestedHuntableNum, suggestedHuntableNum + 2, XMetersToFraction(40), -1, -1);
- createSkirmishHuntables(huntableRingConstraint, "playerhuntables 2" + i, 1, suggestedHuntableNum, suggestedHuntableNum + 2, XMetersToFraction(40), -1, -1);
- huntableRingConstraint.Remove(max);
- }
- // add fish to the rivers
- createWaterFish(fishConstraints, "Top Fish", 4 + (4 * cNumberNonSpectatorPlayers), 0.0f, 0.5f, 1.0f, 0.5f);
- createWaterFish(fishConstraints, "Bottom Fish", 4 + (4 * cNumberNonSpectatorPlayers), 0.0f, 0.5f, 0.0f, 0.5f);
- SetStatusText("", 0.6f);
- // Resource Triggers
- CreateTrigger("grant resource all players");
- SetTriggerRunImmediately(true);
- TriggerEffect_GrantResources(1, "stone", 10000);
- TriggerEffect_GrantResources(1, "gold", 10000);
- TriggerEffect_GrantResources(1, "wood", 10000);
- TriggerEffect_GrantResources(1, "food", 10000);
- Info("Finished generating B02 ShelteredPass Map");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement