
The problem is what to do when you get a free city from a hut - the accepted method is to give it away, and if you can't do that, have it make a settler and set the disband city option. While making my own custom ruleset I figured out a way to prevent getting a city from a hut by editing the "default.lua" script.
Code: Select all
-- Randomly choose a hut event
function _deflua_hut_enter_callback(unit)
local chance = random(0, 11)
local alive = true
local owner = unit.owner
if chance == 0 then
_deflua_hut_get_gold(unit, 25)
elseif chance == 1 or chance == 2 or chance == 3 then
_deflua_hut_get_gold(unit, 50)
elseif chance == 4 then
_deflua_hut_get_gold(unit, 100)
elseif chance == 5 or chance == 6 or chance == 7 then
_deflua_hut_get_tech(unit)
elseif chance == 8 or chance == 9 then
if not _deflua_hut_get_mercenaries(unit) then
_deflua_hut_consolation_prize(unit)
end
elseif chance == 10 then
alive = _deflua_hut_get_barbarians(unit)
elseif chance == 11 then
if unit.owner:is_human() then
notify.event(owner, unit.tile, E.HUT_BARB_CITY_NEAR,
_("An abandoned village is here."))
elseif not _deflua_hut_get_city(unit) then
_deflua_hut_consolation_prize(unit)
end
end
-- continue processing if unit is alive
return (not alive)
end