trading citys to city-states possible?

KnelRivendare

Warlord
Joined
Jan 13, 2012
Messages
271
the title already says it is it somehow possible to add an extra option to the CS menu to trade cities with them like you can do with AI civs to create "buffer states"

it would be enough if it would work as "gift city" so pretty much to force them to take the City i want to give them


thanks in advance for any help.
 
It's possible, but will require some lua coding and understanding of UI coding (whoward69 have done some good tutorial for that)

If you've never programmed before, you may wan't to start with something simpler.
 
Code:
function GiftCity(iPlayer, iCity, iCS)
  local pPlayer = Players[iPlayer]
  local pCity = pPlayer:GetCityByID(iCity)

  local pCS = Players[iCS]
  pCS:AcquireCity(pCity, false, true)
  pCity:ChangeResistanceTurns(-1 * pCity:GetResistanceTurns())

  -- This should probably be based on the city size
  local iGold = GameDefines["MINOR_GOLD_GIFT_LARGE"]
  local iFriendship = pPlayer:GetFriendshipFromGoldGift(iCS, iGold)
  pCS:ChangeMinorCivFriendshipWithMajor(iPlayer, iFriendship)
end

And if you don't know where to get iPlayer, iCity and iCS from you do want to start with something simpler ;)
 
And before someone else says it, of course the biggest issue with this is that the AI will have no idea how to take advantage of it ;)
 
well it was clear the AI cant do it but thats ok, so as i dont even know what IPlayer etc. is i have to read into it first.
I will probably come back with more questions i guess, since this is the first time i try on LUA.

thanks for the great help already.
 
i love city-state empires. i always give them extra troops and keep ONE troop near them, because they tend to "follow" it.

City states can get pretty big, ive seen 5-7 cities owned by a city state, but the real problem is an AI civ with 6k gold, spearmen in the industrial age - will not know it needs to bribe that empire and upgrade its units.
 
Back
Top Bottom