Detect when an Ideology has been adopted?

Leugi

Supreme Libertador
Joined
Jan 25, 2013
Messages
1,675
Location
Bolivia
What the title says... I'm not too familiar with lua and BNW mechanics yet, and so isn't the Modiki I think :p

So, how does one know when X player has adopted an ideollogy?
 
There is an event that fires when a player adopts a social policy. There is also one that fires when a player adopts a branch (usually an opening policy). I'm not sure off hand if the branch event fires when a player adopts an ideology with 0 free social policies but it wouldn't be hard to investigate it a bit and determine if that was the case.
 
The PlayerAdoptPolicyBranch does NOT fire for ideologies, but PlayerAdoptPolicy should fire for the tenets.
 
So then I'd havee to check for every level 1 tenet?
 
Technically, the player could have an ideology but no tenants. That's probably the most sensible solution though.

Maybe, but not if you're the first to an ideology. When you're first, you get two free Tenets.

So then I'd havee to check for every level 1 tenet?

This is basically how I do it:

Code:
function OnIdeologyChosen(playerID, policyTypeID)
    local player = Players[playerID]
    local policyLevel = GameInfo.Policies[policyTypeID].Level
    if policyLevel == 1 then
      --Do stuff
    end
end
GameEvents.PlayerAdoptPolicy.Add(OnIdeologyChosen)

I use this method in my social policy mod.
 
Top Bottom