Modmodding Q&A Thread

Does a function exist that returns the continent when a coordinate is put in? I know that some kind of definition for continents exist (to forbid settler to be build on other continents before a certain tech and some other functions)

EDIT:
Nevermind. I found it. (plot.getRegionID())
 
Regions are smaller than continents though. The game also has the concept of Areas, which are separate landmasses now matter how small.
 
Good.
 
Is there a method to get the list of active core plots? Areas.getCoreAreas can only return the vanilla core or a pre-defined alternative core. But if I change a random tile to core, the game will recognize it as core, Areas.getCoreAreas won't.

And if I change the settlermap with gc.getMap().plot(x, y).setSettlerValue(iPlayer, getMapValue(iCiv, x, y, bChanged)), will that change be permanent or only for that game? And what does the bChanged do?
 
You would need to loop over all plots on the map, for example:
Code:
[(x, y) for x in range(iWorldX) for y in range(iWorldY) if gc.getMap().plot(x,y).isCore(iPlayer)]

I know the code is currently kind of schizophrenic on what method to use, currently all "give me all plots" use cases use Python (not editable) and all "check if plot is core" uses the DLL (editable).

Changing settler maps will only be persistent throughout the ongoing game. getMapValue is simply a utility method to retrieve a value from the predefined map in the SettlerMaps module. bChanged simply specifies if the changed settler map from the extra dictionary should be used (some civs change their historical areas along the way, for example HRE -> Austria).

For a permanent change, the settler map still needs to be edited. To do that programmatically, the best approach should be to edit the settler map for the ongoing map and then add an option to output the current map in Python format for convenient pasting into the corresponding file.
 
You would need to loop over all plots on the map, for example:
Code:
[(x, y) for x in range(iWorldX) for y in range(iWorldY) if gc.getMap().plot(x,y).isCore(iPlayer)]

I know the code is currently kind of schizophrenic on what method to use, currently all "give me all plots" use cases use Python (not editable) and all "check if plot is core" uses the DLL (editable).

This is fine. I need to loop over all plots anyway if I need it for multiple tile. Otherwise I just need it for 1 tile.
Does this also apply for birtharea?

Changing settler maps will only be persistent throughout the ongoing game. getMapValue is simply a utility method to retrieve a value from the predefined map in the SettlerMaps module. bChanged simply specifies if the changed settler map from the extra dictionary should be used (some civs change their historical areas along the way, for example HRE -> Austria).

For a permanent change, the settler map still needs to be edited. To do that programmatically, the best approach should be to edit the settler map for the ongoing map and then add an option to output the current map in Python format for convenient pasting into the corresponding file.

Great. My current export tool is already doing this.
 
I see you added the code below at the end of RFCUtils.py.
Code:
utils = RFCUtils()

Does that mean that
Code:
import RFCUtils
utils = RFCUtils.RFCUtils()
and
Code:
from RFCUtils import utils
are the same?
 
Yes. There is no reason to instantiate the RFCUtils class in every module, because there is no difference between those instances. It's called singleton pattern.

In the long run, the utils methods don't need to be in a class at all (I think Rhye only did it because that's what he was used to from C), but I didn't want to change the RFCUtils module to that extent right now.
 
What do I do if I want to make the spawn of a civ conditional? :mischief:

Wait a minute... Didn't I post this in another thread? Am I being gaslighted? What if I wanted to make the spawn of a civ I want to add conditional, hm? Or am I just getting senile...
 
1. How do I use the reformation mechanic and adapt it for my own purposes?

2. How do I alter religious spread rules?

3. How do I get that larger civic interface? EDIT: Nevermind, I figured it out. New question: how to add the military civic column?

Remember I'm not that familiar with modding, so use very very clear language. :D
 
As for the last question, CIV4CivicOptionInfos.xml

This does not appear to exist in Legends of Revolutions (the mod which I'm using as a base). EDIT: OK, just copied and pasted. Apparently I can't even do XML properly. :p

EDIT2: OK, something has gone terribly terribly wrong. It claims that there is an "error parsing civ4gametextinfos_objects" and the reason given is that the "end tag 'Civ4GameText' does not match the start tag 'TEXT'." As far I know I haven't touched the start and end tags. I just added in the civicoption for military and the first civic, which is militia.

The game will start, but all civics, units, buildings are referred to by their XML description. So I managed to screw up the whole file somehow.

EDIT3: Huh... it was because I greened out the foreign language areas (french, german, spanish, etc). How do modders get anything done like this?
 
Presumably because Legends of Revolutions doesn't change the civic options? Copy the file from the Beyond the Sword directory, then (and if it isn't there, from Warlords, and if it isn't there, from Civilization IV).
 
How do modders get anything done like this?

By not removing/greening out stuff unless we know it won't have any negative side effects. ;)

What exactly do you want to transfer from Legends of Revolution anyway?
 
1. How do I use the reformation mechanic and adapt it for my own purposes?
You can find the DoC Reformation implementation in Assets\Python\Religions.py, from line 447 on. The entry point is the onTechAcquired method which checks for Printing Press and Catholic state religion, and proceeds from there. Depending on your base mod it should have a Python file that is called EventManager or something similar, where the onTechAcquired method exists as well. You can either copy DoC by creating your own Religions file (then the onTechAcquired method in the event manager has to call its counterpart in Religions) or just implement everything in the event manager itself.

I suggest you first try to work through what DoC does and then replicate it for your mod. Adapting it to do something else is much easier after you've understood how it does what it currently does.

2. How do I alter religious spread rules?
That's in the DLL unfortunately. The current spread rules are in CvCity::doReligion().
 
By not removing/greening out stuff unless we know it won't have any negative side effects. ;)

I didn't do all of them, just the two I added. I don't really think the five extra languages will be in high demand.

Besides, I did the same for other civics that I changed around.

What exactly do you want to transfer from Legends of Revolution anyway?

Nothing. I'm using it as a base.
 
Why not simply paste the English text for the other languages?
 
Why not simply paste the English text for the other languages?

It's longer than just greening them, and I had no idea it could affect the game like that. That's what I'm doing from here on out.
 
In my mod, Sword of Islam expanded, I was creating victory goals for Portugal, when I accidentall did something that caused the game to not work. When I try to load it, it just shows the map, no interface, and it is impossible to do anything. Victory.py is the only file I changed since the last working version, my broken version is linked in post #240 in that thread
There is a problem with line 1950 in victory.py

I've attached the file. I would appreciate it if someone could take a look at it for me.


Can you please help me fix it
 
Back
Top Bottom