• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Game mechanic question

JPetroski

Deity
SLeague Staff
Joined
Jan 24, 2011
Messages
4,898
Hi,

Does anyone know how the amount of money taken per city capture is calculated? Are there any improvements or conditions that reduce or increase the amount captured per city?
 
I haven't been able to find a reference, but I'm pretty sure that the formula is:

plunder = treasury*populationCapturedCity/(populationOfCiv+1)

Where both populations are in terms of citizens. I think that the population of the civ is only computed at the start of the turn, so on the first turn of the scenario, populationOfCiv is 0, and capturing a city results in plundering the entire treasury.

In Catfish's Saved Game Reference there is a 'Sum of the city sizes' pair of 2 bytes. If you want to hex edit a correct population for the first turn of a scenario, that is probably where you would have to do it.

EDIT: Updated link.
 
Last edited:
I recently provided some sample code in a PM for overriding the standard plunder computation:

Code:
local treasuries = {[0]=0,0,0,0,0,0,0,0,}

discreteEvents.onActivateUnit(function(unit,source,repeatMove)
    for id=0,7 do
        treasuries[id] = civ.getTribe(id).money
    end
end)

discreteEvents.onCityTaken(function (city, defender)
    city.owner.money = treasuries[city.owner.id]
    defender.money = treasuries[defender.id]
    local plunderValue = 50
    local transferAmount = math.min(defender.money, plunderValue)
    city.owner.money = city.owner.money + transferAmount
    defender.money = defender.money - transferAmount
end)
This code uses a fixed value of 50 gold, but you could use an arbitrary calculation.

Note that it would probably be wise to change the @CITYCAPTURE section in game.txt if you want to use an alternate plunder calculation.
 
Back
Top Bottom