Tying Religions to Buildings

Civitar

Adventurer
Joined
Mar 23, 2014
Messages
1,507
Location
Switzerland
In Warhammer I've changed the way in which religions work. Instead of Religions you have Cults of this deity or that one. The intended mechanic is the following:
  • Before the cult has been founded, there is a buildable Holy Building of that Cult.
  • The first city in the world to finish constructing that Building has the appropriate Cult automatically founded in it as the Holy City.
  • The Holy Building is now unbuildable. But if a cult becomes a majority religion in a city, that city will be given the Holy Building automatically.

Machiavelli's Religions Grant Buildings snippet does #3 perfectly. But how can I basically invert the function of Machiavelli's stuff? So that Buildings Grant Religions?
To do the whole buildable/unbuildable swap happen, I thought I could do the following:
Have a building like BUILDING_TEMPLE_OF_SQL_FOUNDER that is a World Wonder, when it is finished the CULT_CULT_OF_LUA is founded in that city. Wherever the CULT_OF_LUA is a majority religion, the city gets the building BUILDING_TEMPLE_OF_SQL. So really, all I need is some Lua that lets a building found a religion upon being completed. And since all the effects of the religion are implemented through its holy buildings and units, there's no need to worry about effects.
So anyone who can produce that tidbit would be a UNIT_HERO, and their name will be installed in the BUILDING_HALL_OF_CREDITS of the Warhammer mod.
Thank you!
 
I assume that you could use Game.FoundReligion to do it?

A quick search turned up a thread by PawelS here where he and whoward69 talk about how to have a civilization start with a specific pantheon at the start of the game. I presume you'd just use the FoundReligion call instead of FoundPantheon, and have it trigger from the completion of the cult building as opposed to the start of the game?
 
I assume that you could use Game.FoundReligion to do it?
How would I go about doing that?

A quick search turned up a thread by PawelS here where he and whoward69 talk about how to have a civilization start with a specific pantheon at the start of the game. I presume you'd just use the FoundReligion call instead of FoundPantheon, and have it trigger from the completion of the cult building as opposed to the start of the game?
I... guess so. I really don't know how to code anything in Lua. Could someone please write that bit?
I do want the religion to be founded upon completion of the founder building, and since the religion will be a majority religion in its own holy city at the outset the holy building will be immediately granted. If the founder building could be removed immediately after the religion is founded that'd be great too.
 
Back
Top Bottom