Mod compatibility help (CBP + Reseed!)

Joined
Aug 9, 2014
Messages
644
The Community Patch changes the amount of free units given to AIs at the beginning (no additional free settlers or workers), but Reseed! seems to ignore these changes and generate maps with the vanilla number of units on the map.

The changes made by the Community Patch to AI bonuses, using Deity as an example, are as follows:
Spoiler :
Code:
UPDATE HandicapInfos
SET AIPerEraModifier='-10' , HappinessDefault='4', Gold='0' , AIStartingDefenseUnits = '3' , AIDeclareWarProb='200', NumCitiesUnhappinessMod='100' , PopulationUnhappinessMod='100' , AIStartingUnitMultiplier = '0' , ProductionFreeUnits='8' , AIStartingWorkerUnits='0', ProductionFreeUnitsPopulationPercent='50' , ProductionFreeUnitsPerCity='5' , RouteCostPercent='100' , UnitCostPercent='100' , BuildingCostPercent='100' , ResearchPercent='100' , PolicyPercent='100' , ImprovementCostPercent='100' , CityProductionNumOptionsConsidered='2' , TechNumOptionsConsidered='3' , PolicyNumOptionsConsidered='3' , AttitudeChange='-1' , NoTechTradeModifier='40' , BarbCampGold='100' , AIBarbarianBonus='50' , AIWorkRateModifier='0' ,  AIUnhappinessPercent='100' , AIGrowthPercent='100' , AITrainPercent='100' , AICreatePercent='100' , AIConstructPercent='100', AIBuildingCostPercent='100' , AIUnitCostPercent='100' , AIUnitSupplyPercent='75' , AIUnitUpgradePercent='75', AIAdvancedStartPercent='130', AIFreeXP='15' , AIFreeXPPercent='30'
WHERE Type = 'HANDICAP_DEITY';

The relevant LUA that Reseed! uses to spawn units on the map is as follows:
Spoiler :
Code:
-- STARTING UNITS SPAWNS
--===============================================================================================
local function GetDefaultUnitForClass(classType, civType, isFirst)
	-- Specific hacks since Firaxis sometimes used built-in rules rather than implementing XML mechanics
	-- Soshones explorers rather than warriors
	if civType == "CIVILIZATION_SHOSHONE" and classType == "UNITCLASS_WARRIOR" then 
		return GameInfo.Units.UNIT_SHOSHONE_PATHFINDER.ID
	end
	-- Venice uses merchants instead of settlers after the first one
	if civType == "CIVILIZATION_VENICE" and classType == "UNITCLASS_SETTLER" and not isFirst then 
		return GameInfo.Units.UNIT_VENETIAN_MERCHANT.ID
	end

	if civType then
		for row in GameInfo.Civilization_UnitClassOverrides{ CivilizationType=civType, UnitClassType=classType} do
			if row.UnitType then
				local unit = GameInfo.Units[row.UnitType];
				if unit then
					return unit.ID;
				end
			end
		end
	end

	local classRow = GameInfo.UnitClasses[classType];
	if classRow then
		local unitRow = GameInfo.Units[classRow.DefaultUnit];
		return unitRow.ID;
	end

	print("invalid class: "..tostring(classType));
	return 0;
end

-------------------------------------------------------------------------------------------------
local function GetStartingUnits(player)
	local units = {};
	local civType = GameInfo.Civilizations[player:GetCivilizationType()].Type;
	local handicap = GameInfo.HandicapInfos[Game.GetHandicapType()];
	local era = GameInfo.Eras[Game.GetStartEra()]

	local workerCount = 0;
	local defenseCount = 0;
	local explorerCount = 0;
	local freeUnitCountMultiplier = 1;

	if player:IsHuman() then
		workerCount = era.StartingWorkerUnits + handicap.StartingWorkerUnits;
		defenseCount = era.StartingDefenseUnits + handicap.StartingDefenseUnits;
		explorerCount = era.StartingExploreUnits + handicap.StartingExploreUnits;
		freeUnitCountMultiplier = era.StartingUnitMultiplier;
	elseif not player:IsMinorCiv() then
		workerCount = era.StartingWorkerUnits + handicap.AIStartingWorkerUnits;
		defenseCount = era.StartingDefenseUnits + handicap.AIStartingDefenseUnits;
		explorerCount = era.StartingExploreUnits + handicap.AIStartingExploreUnits;
		freeUnitCountMultiplier = era.StartingUnitMultiplier + handicap.AIStartingUnitMultiplier;
	end

	-- Add free units (settlers)
	for row in GameInfo.Civilization_FreeUnits("CivilizationType='"..civType.."'") do
		local freeUnitCount = row.Count * freeUnitCountMultiplier;

		for i = 0, freeUnitCount - 1, 1 do
			local freeUnit = GetDefaultUnitForClass(row.UnitClassType, civType, i == 0);
			table.insert(units, freeUnit);
		end
	end

	-- Add defense units
	local defenseUnit = GetDefaultUnitForClass("UNITCLASS_WARRIOR", civType);
	for i = 0, defenseCount - 1, 1 do
		table.insert(units, defenseUnit);
	end

	-- Add explorer units
	local explorerUnit = GetDefaultUnitForClass("UNITCLASS_SCOUT", civType);
	for i = 0, explorerCount - 1, 1 do
		table.insert(units, explorerUnit);
	end

	-- Add worker units
	local workerUnit = GetDefaultUnitForClass("UNITCLASS_WORKER", civType);
	for i = 0, workerCount - 1, 1 do
		table.insert(units, workerUnit);
	end

	return units;
end

Is there any way to make these compatible, to enable Reseed! to instead use the values changed by the Community Patch? Forgive me if this is a bit of a vague question, but I really don't know much of what to do here. Thanks in advance.

Note: I exclusively play with CBP as this point, so I really don't mind making an ugly edit to the Reseed! LUA.
 
I wound up heading into Civ5HandicapInfos.xml in the install directory in order to manually change AIStartingUnitMultiplier, AIStartingDefenseUnits, and AIStartingWorkerUnits to the values specified in the CBP. I really never play the base game anymore so while I know this isn't ideal, I don't really care that much.

This gives each civilization the correct number of starting units when using Reseed!, but somehow leaves each city-state with zero units save for its settler. Does anyone know what files specify how many units city-states spawn with?
 
Back
Top Bottom