//------------------------------------------------------------------- // STANDARD INCLUDES: //------------------------------------------------------------------- //#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 //------------------------------------------------------------------- //------------------------------------------------------------------- // SCRIPT START: //------------------------------------------------------------------- public partial class RMScript : RandomMap { private bool _bIsRepeat; private bool _bIsElite; private bool _bIsLegendary; 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 repeatable _bIsRepeat = VariableGet("IsREPEAT", false); // see if this is a elite _bIsElite = VariableGet("bIsELITE", false); // see if this is a legendary _bIsLegendary = VariableGet("IsLEGENDARY", 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; } // PreInitSetup(); // terrain and scenario creation GetTerrain("Roman Inland"); InitializeFromScenario(scenarioFile); SetSkipBeautify(true); // class and mission tool data spawns var questTargetClass = new Class("questTargets"); var nuggets = new Class("nuggets"); Constraint questTargetConstraint = new ClassDistanceConstraint("quest target constraint", questTargetClass, 30.0f); Constraint avoidNuggets = new ClassDistanceConstraint("avoidNuggets", nuggets, 5.0f); PlaceExternalObjects(questTargetClass, 0.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); // PostInitSetup(); //----------------------------------------------------------- // WRAP UP: //----------------------------------------------------------- SetStatusText("Done.", 1.0f); } private void PreInitSetup() { // } 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); } private void SetupHumanPlayer(int playerId) { // Disable all units and techs UtilsCH_ForbidAllUnits(playerId); UtilsCH_DisableAllCivTech(playerId); //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); // Enable back some stuff based on which player they are if (playerId == _mainPlayerId) { UtilsCH_EnableUnitTypeBySuffix(playerId, "Bldg_Fortress"); } } }