//------------------------------------------------------------------- // STANDARD INCLUDES: //------------------------------------------------------------------- //StartInclude //#include ..\..\externalobjects.cs //#include ..\..\playerAreas.cs //#include ..\..\terrainpicker.cs //#include ..\..\HuntingAreas.cs //#include ..\..\nuggetUtils.cs //#include ..\..\default_start_groupings.cs //#include ..\..\Utils_CommonTriggers.cs //#include ..\..\Utils_CivHandler.cs //#include ..\..\Utils_GameTuning.cs //#include ..\..\Utils_Helpers.cs //#include ..\..\Utils_Econ.cs //#include ..\..\Utils_TriggerConditionWrappers.cs //#include ..\..\Utils_TriggerEffectWrappers.cs //#include ..\Utils_Celeste.cs //#include ..\Utils_TechId.cs //#include ..\..\Utils_AttackHelpers.cs //#include ..\..\Utils_WaveAttack.cs //#include ..\Global\Utils_CustomAttack.cs //EndInclude //------------------------------------------------------------------- #region Using directives using System; using System.Collections.Generic; #endregion //------------------------------------------------------------------- // SCRIPT START: //------------------------------------------------------------------- public partial class RMScript : RandomMap { //--------------------------------------------------------------- //the next 3 lines of code is standard stuff. can mostly be ignored. a template should fill in those things. private bool _bIsRepeat; private bool _bIsElite; private bool _bIsLegendary; //--------------------------------------------------------------- //this is also mostly standard stuff. private int _mainPlayerId; private int _coopPlayerId; private bool _isMapCoop; //--------------------------------------------------------------- // MAIN: //--------------------------------------------------------------- public override void Main() { //----------------------------------------------------------- // SETUP: //----------------------------------------------------------- UtilsGT_PreInit(); SetStatusText("", 0.01f); // see if this is a legendary _bIsLegendary = VariableGet("IsLEGENDARY", false); // see if this is a repeatable _bIsRepeat = VariableGet("IsREPEAT", false); // see if this is a elite _bIsElite = VariableGet("bIsELITE", false); // fetch variable from the mission var scenarioFile = VariableGet("scenarioFile", ""); if (string.IsNullOrEmpty(scenarioFile)) { // early out on invalid scenario SetStatusText("Failed to load. Invalid scenarioFile.", 1.0f); return; } // // terrain and scenario creation GetTerrain("Roman Country"); InitializeFromScenario(scenarioFile); SetSkipBeautify(true); // class and mission tool data spawns var questTargetClass = new Class("questTargets"); //Constraint questTargetConstraint = // new ClassDistanceConstraint("quest target constraint", questTargetClass, 30.0f); PlaceExternalObjects(questTargetClass, 5.0f); // UtilsGT_Init(); // _mainPlayerId = VariableGet("MainPlayerID", -1); if (_mainPlayerId == -1) { Info("No MainPlayerID specified, defaulting to 1"); _mainPlayerId = 1; } _coopPlayerId = VariableGet("CoopPlayerID", -1); _isMapCoop = _coopPlayerId != -1 && IsPlayerHuman(_coopPlayerId); //----------------------------------------------------------- // Place player //----------------------------------------------------------- PlacePlayer(_mainPlayerId, 0.38f, 0.40f); if (_isMapCoop) PlacePlayer(_coopPlayerId, 0.27f, 0.40f); //----------------------------------------------------------- // Place starting units //----------------------------------------------------------- if (_isMapCoop) { var startingVillagers = new ObjectDef("starting villagers"); startingVillagers.AddItem(UtilsCH_GetVillager(_mainPlayerId), 25, 7.0f); startingVillagers.SetMinDistance(0); startingVillagers.SetMaxDistance(0); startingVillagers.PlaceAtLoc(_mainPlayerId, PlayerLocXFraction(_mainPlayerId), PlayerLocZFraction(_mainPlayerId), 1); var startingVillagers2 = new ObjectDef("starting villagers2"); startingVillagers2.AddItem(UtilsCH_GetVillager(_coopPlayerId), 25, 7.0f); startingVillagers2.SetMinDistance(0); startingVillagers2.SetMaxDistance(0); startingVillagers2.PlaceAtLoc(_coopPlayerId, PlayerLocXFraction(_coopPlayerId), PlayerLocZFraction(_coopPlayerId), 1); } else { var startingVillagers = new ObjectDef("starting villagers"); startingVillagers.AddItem(UtilsCH_GetVillager(_mainPlayerId), 50, 8.0f); startingVillagers.SetMinDistance(0); startingVillagers.SetMaxDistance(0); startingVillagers.PlaceAtLoc(_mainPlayerId, PlayerLocXFraction(_mainPlayerId), PlayerLocZFraction(_mainPlayerId), 1); } //-------------------------------- // SetupWaves PostInitSetup(); //----------------------------------------------------------- // WRAP UP: //----------------------------------------------------------- SetStatusText("Done.", 1.0f); } //--------------------------------------------------------------- private void PostInitSetup() { // report our settings if (_isMapCoop) Info("MAP SETTINGS: bIsREPEAT:[" + _bIsRepeat + "], bIsELITE:[" + _bIsElite + "], bIsLEGENDARY:[" + _bIsLegendary + "], region:[" + region + "], MainPlayerID:[" + _mainPlayerId + "], CoopPlayerID:[" + _coopPlayerId + "]"); else Info("MAP SETTINGS: bIsREPEAT:[" + _bIsRepeat + "], bIsELITE:[" + _bIsElite + "], bIsLEGENDARY:[" + _bIsLegendary + "], region:[" + region + "], MainPlayerID:[" + _mainPlayerId + "]"); CommonMapSetup(_bIsRepeat, _bIsElite, _bIsLegendary); SetupHumanPlayer(_mainPlayerId); if (_isMapCoop) SetupHumanPlayer(_coopPlayerId); } private void SetupHumanPlayer(int playerId) { // Disable all units and techs UtilsCH_ForbidAllUnits(playerId); UtilsCH_DisableAllCivTech(playerId); // Enable back some units UtilsCH_EnableUnitTypeBySuffix(playerId, "Bldg_StoreHouse"); UtilsCH_EnableUnitTypeBySuffix(playerId, "Bldg_GuardTower"); UtilsCH_EnableUnitTypeBySuffix(playerId, "Bldg_Farm"); // Free Tribute Upgrade In Market (edit, setting these techs to obtainable instead - pf 2021/03/10) // Enable Techs in available buildings TriggerEffect_SetTechStatus(playerId, TechTreeId["TechMarketTribute1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechMarketTribute2"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["RomanTechAbacus"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechTower2"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechTower3"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherBerry1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechHunting1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherWood1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherWood2"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherGold1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherGold2"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherStone1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherStone2"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherStone3"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherFarm1"], 1); TriggerEffect_SetTechStatus(playerId, TechTreeId["TechGatherFarm2"], 1); //Set Player age CreateTrigger("Force_Age_3_P" + playerId, true, true, false, 4, false, false); TriggerEffect_SetTechStatus(playerId, UtilsCH_GetAgeTechID(playerId, 1), 2); TriggerEffect_SetTechStatus(playerId, UtilsCH_GetAgeTechID(playerId, 2), 2); TriggerEffect_SetTechStatus(playerId, UtilsCH_GetAgeTechID(playerId, 3), 2); } }