[Lua] How to make policies unattainable by player?

3335d

CCtP Player
Joined
Jun 15, 2012
Messages
642
I wanted to create a mod with a political angle to it, where a legislature makes the decisions on various policy areas (obviously if the player desires so). In order to do so, I created a bunch of ideological "policies." I don't want these to be actively gained by the player, I would like them to be gained as a function of various factors including :c5gold:, :c5culture:, :c5happy:, and :c5science:, as well as a new stability factor that I am introducing. However, I still want them to function otherwise like policies, with a bonus provided for each of them.

Is there any way for me to state that while a given XML boolean tag's value is equal to 1, that the player cannot get the policies through normal culture and must be given the policy through SetHasPolicy()?
 
Code:
function OnCanAdoptPolicyBranch (iPlayer, iPolicyBranch)
  if ( /* some test on iPolicyBranch */ ) then
    return false
  endif

  return true    
end
GameEvents.PlayerCanAdoptPolicyBranch.Add(OnCanAdoptPolicyBranch)
 
Top Bottom