Lua for CS influence based on shared religion

punishaer

Chieftain
Joined
Aug 11, 2022
Messages
3
Hi folks,

so I'm on my first mod and struggle a bit with the lua for following trait:

Gain x Influence with City States that have your Religion as their majority Religion.

I tried two lua from different mods but unfortunately to no avail (no increase in influence for the respective CS after the missionary did his job). The first lua is...

function raiseCityStateInfluence( player )
local pPlayer = Players[player]
for iLoop = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
local pMinorCiv = Players[iLoop]
if pMinorCiv:IsEverAlive() and pMinorCiv:IsAlive() then
if pMinorCiv:GetCapitalCity():GetReligiousMajority() == religion then
pMinorCiv:ChangeMinorCivFriendshipWithMajor(pPlayer,10)
end
end
GameEvents.PlayerDoTurn.Add(raiseCityStateInfluence)

...and the second...

local yourCiv = GameInfoTypes.CIVILIZATION_yourCiv
function yourCivReligionCityStates(iPlayer)
local pPlayer = Players[iPlayer];
if pPlayer:GetCivilizationType() ~= yourCiv then return end
if not pPlayer:HasCreatedReligion() then return end
local religion = pPlayer:GetReligionCreatedByPlayer()
for iLoop = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
pMinorCiv=Players[iLoop]
if pMinorCiv:IsEverAlive() and pMinorCiv:IsAlive() then
if pMinorCiv:GetCapitalCity():GetReligiousMajority() == religion then
pMinorCiv:ChangeMinorCivFriendshipWithMajor(pPlayer,2)
end
end
end
end
GameEvents.PlayerDoTurn.Add(yourCivReligionCityStates)

I tried VFS = true on or InGameUIAdinn as the lua property since I wasn't sure which case applies here following whoward69's tutorial.
The other mods I am usually using are Vox Populi and R.E.D and they are listed as references. The database log doesn't show any loading issues (except a missung entry for the UU).

So I wonder, is there a combatibility issue between the aformentioned mods or does the lua needs better coding?
Attached is the mod itself. Any help would be appreciated. Cheers
 

Attachments

  • Brotherhood of Nod (v 1).zip
    1.9 MB · Views: 19
Hi folks,

the finalisation of my first mod is nigh :goodjob:

Your input would immensely help to give the civ more flavour.

Could compatibility issues be the reason for the effect not applying? I also use the historical religions complete mod besides VP and R.E.D.

Cheers
 
Top Bottom