Is it possible to allocate expedition production to a non-capital city?

g02703

Chieftain
Joined
Apr 2, 2016
Messages
33
They might have hard-coded this - all production from excavating crashed satellite and other sites, automatically get awarded to your capital city.

Is there a way that I might not know where we could choose which city to allocate those 80 bolts/hammers to, to help its slow production?

Is this moddable?
 
It's moddable, yes, but requires knowledge of lua. All Bonuses from Expeditions ("PlotBonuses") can be found in the PlotBonuses-Folder. The one you're looking for is ProductionPlotBonus.lua.

I've actually done exactly that in my Awesome Pods and Ruins Mod:
Spoiler :

Code:
----------------------------------------------------
-- Plot Bonus: Production (Satellite)
----------------------------------------------------
local PlotBonus = {};
local PlotBonusInfo = GameInfo.PlotBonuses["PLOT_BONUS_PRODUCTION"];
local iResearchMod = GameInfo.GameSpeeds[Game.GetGameSpeedType()].ResearchPercent / 100

local ProductionChange = 80 * iResearchMod;

local MinChange = 5;
local MaxChange = 9;
local ChangeFactor = 10;

function PlotBonus.IsValidForPlayerAtPlot(player, plot)
	local city = player:GetCapitalCity();
	if (city == nil) then
		return false;
	end

	return true;
end

function PlotBonus.DoBonus(plot, player, fromExpedition)
	
	local roll = Game.Rand(MaxChange + 1 - MinChange, "Choosing amount of production to give from plot bonus");
	local ProductionChange = math.ceil((MinChange + roll) * iResearchMod * ChangeFactor)
	print("Production plot bonus for player " .. player:GetID());
	-- Which city?
	local city = PickACity(player)	
	print("- Food changed by (" .. ProductionChange .. ") in " .. city:GetName() .. ".")

	-- Give the bonus
	city:ChangeOverflowProduction(ProductionChange);

	-- Notify the player
	local summary = Locale.ConvertTextKey(PlotBonusInfo.Description);
	local message = Locale.ConvertTextKey(PlotBonusInfo.Help, city:GetName(), ProductionChange);
	ShowMessage(player, plot, summary, message, fromExpedition);
end

-- Picks a Random City from all of the Cities that the Player owns
function PickACity(player)

	-- print("Choosing a Random City now.")
	local iCity = math.random(player:GetNumCities())  
	local CityNumber = 0
	for pCity in player:Cities() do
		CityNumber = CityNumber + 1	
		if (CityNumber == iCity) then
			-- print("City " .. pCity:GetName() .. " was chosen.")
			return pCity
		end
	end
end

return PlotBonus;

Probably not the most efficient implementation (and it makes the possibly dangerous error of not covering a situation where the player getting the plotbonus doesn't have any cities), but still.
 
Top Bottom