• Civilization 7 has been announced. For more info please check the forum here .

Units and GetReligion(), can you change a unit's Religion?


Mar 18, 2023
I am trying to create an Enhancer Belief which allows Great Generals to spread religion like Prophets do. To accomplish this, in XML I have outlined a new unit called a 'Prophet General.' Using Lua code, I check if a player has chosen the right belief, and then find any great generals they have and convert them into Prophet Generals using Unit.Convert().

Unfortunately, the newly spawned Prophet Generals always have a ReligionType of -1, and cannot spread any religion since the Great Generals they upgraded from are not religious. If I allow the Prophet Generals the ability to FOUND a religion, they can indeed found a religion if the player hasn't already. Interesingly, If a General is converted into a Prophet General before the player founded a religion, when a religion is founded by a Great Prophet the Prophet Generals gain the ReligionType of the newly founded religion. This would indicate that when you found a religion, all existing units gain the ReligionType of your religion (or just those capable of spreading religion?).

Given that there is no Unit.SetReligion() method, is there any way around this issue? Does anyone know of either a way to change a unit's ReligionType, or have a different approach to adding the spread religion functionality to Great Generals?

XML Code for Prophet Generals

Lua function for converting Generals to Prophet Generals
function UpgradeGeneralsToProphetGenerals(player)

    for unit in player:Units() do

        if (unit:GetUnitType() == GameInfoTypes.UNIT_GREAT_GENERAL) then

            local prophetGeneral = player:InitUnit(GameInfoTypes.UNIT_PROPHET_GENERAL, unit:GetX(), unit:GetY())

            if (unit) then



Attached are two zip files. Connor's Pantheons is the mod I am working on with the Great General religion spreading. For testing the effects of the first mod, Connor's Piety Tree has been edited to make adopting Piety give +200 faith, +1000 culture, and +100 food from the Palace in your capital. To test Great Generals, I would start a game in the classical era on duel size, and turn on policy saving. Then you can adopt Honor and Warrior Code to spawn a Great General, which the lua code will then convert into a Prophet General on the following turn.


  • Connor's Pantheons (v 1).zip
    3.8 KB · Views: 8
  • Connor's Piety Tree (v 1).zip
    4.1 KB · Views: 8
You are a magician and a saint, sir. Worked perfectly first try without any hassle. Thank you so much!
Top Bottom