Strategic Grain Reserve

I am wondering why there is python code with this wonderful building. It should be possible to do all it says it does in XML. In which case this could be a modular national wonder which makes it very easy to add into other mods.

First I'd like to thank you for the kudos on the building. You should know what the Python code actually does and why it is required.

1. A python function determines if the player owns the Strategic Grain Reserve National Wonder. If true, then...

2. A python function adds a free granary to every city the founder owns, even in new cities established on turns well after the national wonder is founded. Without this code, any new city established on turns after the Strategic Grain Reserve is completed, will not receive a free Granary.

3. A python function has been modified to allow a movie file to be played with any national wonder. Without this change the bik file will not play when construction of the national wonder is completed.

4. I have identified all of the the python changes to help make adding this Wonder to other mods very easy.

If you know of a better way to accomplish the same tasks without using python, then please, by all means share your idea. ;)

Respectfully,

Orion Veteran :cool:
 
...
2. A python function adds a free granary to every city the founder owns, even in new cities established on turns well after the national wonder is founded. Without this code, any new city established on turns after the Strategic Grain Reserve is completed, will not receive a free Granary.

I was sure that I have seen an example of a national wonder giving buildings which also gave them to cities built in later turns. Now I will have to go back and make sure that it is so. If it isn't I will have to raise a bug report in that mod.

3. A python function has been modified to allow a movie file to be played with any national wonder. Without this change the bik file will not play when construction of the national wonder is completed.
I missed this one while reading the code - don't know how I did.

Edit: OK - in Rise of Mankind there is a National Wonder, Supreme Court, which gives a new building Local Courthouse to all cities. It is even giving it to cities built after the Supreme Court was built. I just went into world builder on a completed game, made a new island 'cause everything was built upon and put the most primitive settler there - the one which does not come with buildings - and built a city. It was given a local courthouse! I can't see anything in the RoM python to make this happen but I will need to dig deeper. This is why I thought it could be done in just XML.
 
You can accomplish the free building in the XML using:

<FreeBuilding>BUILDINGCLASS_GRANARY</FreeBuilding>

In the national wonder. It's how the Eiffel Tower and Stonehenge work.

After further tests, I stand corrected. The XML is persistent and will provide a free Granary in new cities established on turns well after the national wonder is founded. All without any python. Therefore, I have released Version 1 for download.

1. Eliminated all python except for one line of code needed to run the bik movie file. If you don't want to play movies for national wonders you can just delete the python folder which contains the CvEventManager.py file.

2. This is now one of the easiest mods on CivFanatics to merge into other mods.

Orion Veteran :cool:
 
Back
Top Bottom