Modmodding Q&A Thread

You mean when you edit the file while the game is opened?

That's normal. The thing is that when you change a file, the entire Python environment will be reloaded with the new code. This deletes all data currently in memory. BugData is the module that handles saved data, I made it aware of this so that saved data will be reloaded at that point.

Note that this isn't a perfect solution: editing a Python file does not save the data in memory beforehand, so you might load an older state that had been saved at some point (usually along with an autosave).
 
I was hoping someone could tell me in which file can I edit the starting plots of civs in original RFC? I'm not sure if this thread is only for DoC questions but I would appreciate it if anyone could tell me.
 
I'm still getting the message even after exiting and relaunching the game without changing anything in the code. It didn't show up when I switched to the develop branch before starting the game, though.
Not having seen your code, I am not sure what might have caused this then.

I was hoping someone could tell me in which file can I edit the starting plots of civs in original RFC? I'm not sure if this thread is only for DoC questions but I would appreciate it if anyone could tell me.
Not sure, but I would try Consts.py first, maybe RiseAndFall.py.
 
I am already familiar with both of the files you suggested and haven't seen anything yet. Do you think it's in the Game Core dll?

In vanilla RFC it is in Const.py. Search for "tCapitals".
 
Hi! I am pretty new to modding DoC (and CIV) so I have a basic question I'm trying to figure out to learn the structure of the mod better (and sorry if it has been asked elsewhere):

In the original Rhye's and Fall, I think each Civ that had a later start than the start of the scenario had a Catapult somewhere on the map so that when turns were autoplaying, the player would not receive the message that they were defeated. I do not see any such loading units in the scenario file (all that's there for 3000 BC are Egypt and Babylonia, who start at the beginning of the scenario) for later civs. Can someone point me to the mechanism that prevents the player from losing during the auto turns while they are waiting to begin? Thanks!
 
Hi! I am pretty new to modding DoC (and CIV) so I have a basic question I'm trying to figure out to learn the structure of the mod better (and sorry if it has been asked elsewhere):

In the original Rhye's and Fall, I think each Civ that had a later start than the start of the scenario had a Catapult somewhere on the map so that when turns were autoplaying, the player would not receive the message that they were defeated. I do not see any such loading units in the scenario file (all that's there for 3000 BC are Egypt and Babylonia, who start at the beginning of the scenario) for later civs. Can someone point me to the mechanism that prevents the player from losing during the auto turns while they are waiting to begin? Thanks!
Everything that makes Rhye's and Fall is in the python files and in the dll. If I'm not mistaken the year that makes the civilization spawn is in Assets/Python/consts.py.
The file which says how many units spawn in in Rise.py, same folder as consts.
Also make sure not to edit the original file or if you want to edit the original make a copy of it!
 
Can you tell us what you want to achieve?
 
Hi! I am pretty new to modding DoC (and CIV) so I have a basic question I'm trying to figure out to learn the structure of the mod better (and sorry if it has been asked elsewhere):

In the original Rhye's and Fall, I think each Civ that had a later start than the start of the scenario had a Catapult somewhere on the map so that when turns were autoplaying, the player would not receive the message that they were defeated. I do not see any such loading units in the scenario file (all that's there for 3000 BC are Egypt and Babylonia, who start at the beginning of the scenario) for later civs. Can someone point me to the mechanism that prevents the player from losing during the auto turns while they are waiting to begin? Thanks!

I described how the autoplay mechanism functions here. A small correction to that post is that in RFC (and DoC) it isn't unit no. 0 that is spawned in reviveActivePlayer, but rather a catapult - not that this really changes anything, it's still needlessly complex.
 
That post is very helpful, thanks! That makes a lot of sense, and glad to see the catapult is still around.

What I am trying to achieve is just to have some custom Civilizations I made work with autoplay, which they currently aren't with my code. I assume I made a silly mistake somewhere, but I can dig for that on my own. I was interested in finding the roots of this system, and doTurn() seems to be it. Thanks for the help!
 
That post is very helpful, thanks! That makes a lot of sense, and glad to see the catapult is still around.

What I am trying to achieve is just to have some custom Civilizations I made work with autoplay, which they currently aren't with my code. I assume I made a silly mistake somewhere, but I can dig for that on my own. I was interested in finding the roots of this system, and doTurn() seems to be it. Thanks for the help!
Well, adding a new custom civilization in mods like RFC is a bit more complicated then just editing some python files.
You have to edit a lot of the C++ and H files in the DLL to add your new civ to all the entries, and then in consts you will also need to edit all the other ID's so they don't interfere with your custom civs UU and UB.
If you want to add a new civ to RFC I suggest using this guide https://forums.civfanatics.com/threads/rfc-koreans.396903/ at the bottom of it is a txt file in which are all the details of all the files you need to edit to add a new civ.
 
Well, adding a new custom civilization in mods like RFC is a bit more complicated then just editing some python files.
You have to edit a lot of the C++ and H files in the DLL to add your new civ to all the entries, and then in consts you will also need to edit all the other ID's so they don't interfere with your custom civs UU and UB.
If you want to add a new civ to RFC I suggest using this guide https://forums.civfanatics.com/threads/rfc-koreans.396903/ at the bottom of it is a txt file in which are all the details of all the files you need to edit to add a new civ.

Understood :). I personally have used Leoreth's guide https://forums.civfanatics.com/threads/guide-adding-a-civilization-to-doc-updated.561840/, and have already edited the dll, xml, and python somewhat extensively, but I probably have a bug somewhere. Everything else is working (I can play as Egypt and switch to my new Civ when it spawns, for example), but autoloading a civ without a unit present on the map from Turn 0 doesn't work; it just sits on the DoM text without advancing, and when you press Escape the player is defeated. I don't expect solutions from the little detail I am giving, but I also don't want to ask someone else to look through my entire codebase for bugs, so I was just looking for a better understanding of the system for myself. Thanks for the tips!
 
When I created my civs, I had this error too. I don't know anymore what the exact problem was, but I'm fairly sure it was a python error. (But don't quote me on this) I hope this narrows down the location of the bug a bit.

Using the guide you mention is the good one, as it is specifically written for adding civs to DoC. But in some cases it is a bit outdated. (Especially after the code rewrite)
Small trivia: Jarkov (the writer of the guide linked in Louis' post) was the first person (probably outside Rhye) to add a civ to RFC. Before that there were also a few civ mods, but those replaced an already existing civ by a new one.
 
Last edited:
It was Jarkov's guide that helped me add the first proper civilisation to DoC (which was Byzantium). Before, I could only do the "x respawns as y" thing that is currently still being used by Iran, Mexico and Colombia.
 
Here's a basic question:
I have a "player" object in Python: for example, as obtained by an event callback:
player = gc.getPlayer(kTriggeredData.ePlayer)

Now I want to get the capital coordinates for that player, as defined in Areas.py. I can't do:
Areas.getCapital(player)
Because getCapital is expecting an integer, not a player object.

So is there an easy way to obtain the Python "iPlayer" integer from a player object? Something akin to player.getCivilizationType(), but for the PlayerTypes enum.

I may be misunderstanding something fundamentally, and let me know if there's a better way. Still getting used to the way everything is laid out.
 
I am not a pro like Leoreth but, don't most hooks provide the iplayer instead of pplayer anyways? Usually you want to convert from iplayer to the pplayer afaik.


if there is no built in method I guess you can iterate over all player ids, and check if that id returns the same pplayer object:


for iPlayer in xrange(gc.getMAX_PLAYERS()):
pPlayer = gc.getPlayer(iPlayer)
if pPlayer is myPlayer:...


(Although I am not sure whether player objects can be compared using 'is' or == operators)
 
Here's a basic question:
I have a "player" object in Python: for example, as obtained by an event callback:
player = gc.getPlayer(kTriggeredData.ePlayer)

Now I want to get the capital coordinates for that player, as defined in Areas.py. I can't do:
Areas.getCapital(player)
Because getCapital is expecting an integer, not a player object.

So is there an easy way to obtain the Python "iPlayer" integer from a player object? Something akin to player.getCivilizationType(), but for the PlayerTypes enum.

I may be misunderstanding something fundamentally, and let me know if there's a better way. Still getting used to the way everything is laid out.

player.getID() should do the job.
 
Back
Top Bottom