change yield of improvement

DeadEND

Chieftain
Joined
Feb 22, 2016
Messages
5
Hey civfanatics :)

I'm totally new into lua and sorry for the following big noob question. I searched on civfanatics wiki but found nothing helpful, sadly. :(

Do you guys know how to change the yield of all improvements from one specific type when i choose a policy?

I have done this so far...

Code:
function crystalpolicy(iPlayer, policyID)
  local pPlayer = Players[iPlayer]
  local pPolicy = policyID
  if (pPlayer:IsAlive() and pPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_JAPAN"] and pPolicy == 0) then
  ... 	
  end
	
end
GameEvents.PlayerAdoptPolicy.Add(crystalpolicy)

I hope my idea is possible :rolleyes:

Thanks for your help :)
 
Can you clarify what exact effect you're going to achieve? If you mean that a specific policy should change yields from a specific improvement for all civs, then it's easy to do and doesn't require any Lua, just XML or SQL. See the Policy_ImprovementYieldChanges table (and, in case of culture, Policy_ImprovementCultureChanges). There are existing policies that do it.

But your code suggests that you want this effect to happen only for a specific civ. This is more complicated, probably the best way to do it is to use a hidden policy that is activated (using Lua) together with the target policy.
 
Back
Top Bottom