Prerequisite Building in XML

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
I have yet another interesting problem to work through. In the Inquisition Mod is a generic Inquisitor Unit that comes from Gods of Old. My goal is to make the state religion temple the Prerequisite building before a city is allowed to build the Inquisitor Unit.

There is an XML tag <PrereqBuilding>NONE</PrereqBuilding> in the Civ4UnitInfos.XML file. There are 7 different temples in the game. Python can easily determine the correct temple based upon the state religion. I can code a funtion that returns the correct temple name.

My question: Is there a way to place a variant value in XML that would retrieve the temple value from my python function? ...or is there a beter way to refer to the state religion temple in XML?

Orion Veteran :cool:
 
I can think of several ways to handle the issue.

1)Make duplicate Inquisitors, one for each religion. Set each one to have the relevant temple as the prerequisite. That is how the game handles Missionaries and Executives. You can reuse all the art, etc. Also, set the "StateReligion" entry to the relevant religion.

2)Forget about the XML, and just handle it through Python.
 
Would your Inquisitor unit also be generic, or would be it acceptable to have one unit for each religion type just like Missionaries? If that would work, here's how I would try it (educated guessing here).

  1. Create the Inquisitor units, 1 per religion.
  2. Set the religion's Temple as the prereq building for each unit.
  3. Modify CvGameUtils.cannotTrain() to check that the Inquisitor's religion is the state religion since you already know that the city has the correct Temple.
I have never tried changing cannotTrain(), but from other discussions I think it gets enforced for all players -- not just the active human player.

The other way I can think of is kinda hokey.

  1. Create the generic Inquisitor unit.
  2. Create a generic building that trains Inquisitors and make it the prereq for the Inquisitor.
  3. Use events to add and remove this building at the correct times:
    • buildingBuilt: If it is a Temple for the state religion, add the Inquisitor building.
    • playerChangeStateReligion: Scan all cities and add/remove the Inquisitor building appropriately.
    • cityAcquiredAndKept: Remove/add the building if necessary.
Of course there's no event for when a building gets destroyed (by a random event or a spy), so looks like this backup plan won't work 100%. :( You can also check all cities during playerBeginTurn to catch those cases that fall through the cracks.
 
I can think of several ways to handle the issue.

1)Make duplicate Inquisitors, one for each religion. Set each one to have the relevant temple as the prerequisite. That is how the game handles Missionaries and Executives. You can reuse all the art, etc. Also, set the "StateReligion" entry to the relevant religion.

2)Forget about the XML, and just handle it through Python.

If at all possible, I really want to avoid duplicate Inquisitors. Any ideas?

Looks like EmperFool turned out a post just before this one. Thanks. I think I will create a generic building called the "Holy Office of the Inquisition".
 
Did you try SPECIALBUILDING_TEMPLE? This might work...

Nope. Won't work, as SPECIALBUILDING_TEMPLE refers to the Forbidden Palace, not the Temple. Instead I just created a new generic building called the "Holy Office", which history defines as "Holy Office Building" or "Branch Office Building" of the Holy Inquisition.
 
I just created a new generic building called the "Holy Office"

You can modify CvMainInterface so that it doesn't show this building if you want. Or perhaps there's already an existing XML tag to make a building invisible.
 
You can modify CvMainInterface so that it doesn't show this building if you want. Or perhaps there's already an existing XML tag to make a building invisible.

No need. After thorough research, I am satisfied to use the "Holy Office", instead of the Temple, as the prerequisite building for producing inquisitors. The building is historically accurate and adds more realism to the Inquisition Mod. It's turning out very nice, as I have created a DDS file for the build button, which has a picture of a guillotine. :lol:

You just got to love CIV4!

V/R,

Orion Veteran :cool:
 
No need. After thorough research, I am satisfied to use the "Holy Office", instead of the Temple, as the prerequisite building for producing inquisitors.

So does the player now build the Office specifically? It's no longer tied to having the state religion? I'm curious how this worked out.

I have created a DDS file for the build button, which has a picture of a guillotine. :lol:

Whenever I think of the Inquisition, I inevitably think of The Pit and the Pendulum even though it is historically inaccurate.
 
So does the player now build the Office specifically? It's no longer tied to having the state religion? I'm curious how this worked out.

The Holy Office is required to build the Inquisitor and the state religion must be present in the city to build a Holy Office.

The folowing XML tag for the building makes the state religion a prerequisite in the city before the Holy Office can be built.

<bStateReligion>1</bStateReligion>

This follows the general principle that you can't conduct an inquisition unless your state religion is established in the city first. Here are the preliminary attributes of the building (subject to change after testing):

Cost 240 hammers
+2 Gold (Simulates the confiscation of victom's personal property)
+2 happiness (City benefit for maintaining Religious Unity)
+1 Unhealthy (Simulates loss of population due to Inquisition)
Can turn one citizen into Priest
State Religion must be present in the city
Required to train Inquisitor

I would like to add 75% resistance to the spread of a non-state religion for every city that has the Holy Office. ...not sure how to do that.

V/R,

Orion Veteran :cool:
 
What happens if you switch to a religion that is not present in a city with a Holy Office?

I would bet $5 that changing the religion spread rate must be done in the SDK.
 
What happens if you switch to a religion that is not present in a city with a Holy Office?

I would bet $5 that changing the religion spread rate must be done in the SDK.

The Inquisitor would not be able to conduct an inquisition in that city until a missionary established the new state religion. Perhaps the Holy Office building should be destroyed if the state religion is changed. That would mean the inquisition for the old religion failed.

Don't want to mess with SDK. Drat!

Orion Veteran :cool:
 
Don't want to mess with SDK.

Is it an aversion of C++ or simply that you want your mod to easily work with SDK-only mods such as Solver's Unofficial Patch and Better BTS AI.
 
Is it an aversion of C++ or simply that you want your mod to easily work with SDK-only mods such as Solver's Unofficial Patch and Better BTS AI.

1. I simply do not have a compiler.
2. I currently use the DLL from Dale's Combat Mod to run Orion's Challenge. If we both make changes to the DLL it could get a little complex to keep everything working correctly. On the other hand, I could make some much needed changes to get all of the options to appear on the game setup page instead of using an XML file. Quality -- That really would be cool!

Awe heck with the complexity, I just need a compiler and learn how to compile a DLL. Any thoughts on what application I could use? Is there any free software that can get the job done easily?

V/R,

Orion Veteran :cool:
 
Also, have you considered starting with BUG as a base? The BUG core makes creating an options screen, loading settings from an INI, and adding your own events pretty easy. BUG has no DLL changes, so it wouldn't make that part any more difficult than it already is. ;)

</shameless-plug>
 
Top Bottom