Modmodding Q&A Thread

I'm having difficulty modding DOC for some reason. After I edit the XML files in RFC Dawn of Civlization/Assets/XML, save them, and reload DOC, no changes appear in the Civilopedia. This also applies to edits in Python (consts.py) - they do not appear in-game.

What am I missing here? Do I need to recompile the DLL? I thought XML edits didn't require this.
 
I'm trying to change the spawn date of a civilization. I tried editing the respective entries in CIV4CivilizationInfos.XML as well as tbirth and tyear in consts.py.
 
I've created a new scenario for a R&F mod (not DOC).
In the scenario it is automatically creating a settler and warrior on the first turn for the civ the human player selects (even if the civ does not spawn till later). This then stops the game from automatically running through until the civ actually spawns. If I go into WB and delete the units, it then runs through to the spawn date.
Is there a way of editing python to stop it creating this settler or warrior, or to automatically delete them?
Thanks.
 
Well, there must be code that creates these units. Find the code and modify it so that only happens for civs that are supposed to start with units. Not much more advice to give for a question this generic.
 
I did have a similar problem when I made one of my new civs. Unfortunately I don't remember what I did to fix it. Maybe it will come back to me.
 
I'm assuming it is this in rise&fall.py that causes it:

def create4000BCstartingUnits( self ):

#RFGW
for iLoopCiv in range(iNumMajorPlayers):
if (tBirth[iLoopCiv] == 0 or iLoopCiv == utils.getHumanID()):
utils.makeUnit(iSettler, iLoopCiv, tCapitals[iLoopCiv], 1)
utils.makeUnit(iWarrior, iLoopCiv, tCapitals[iLoopCiv], 1)
self.assignTechs(iLoopCiv)


Everything works fine in my scenario which starts at 0 turn.
However with my scenario which starts at turn 223 it is incorrectly doing the following at the start of the scenario:
1. Creating a settler and warrior for both civs which start on turn 0.
2. Creating a settler and warrior for the human civ

I changed it to:

def create4000BCstartingUnits( self ):

#RFGW
for iLoopCiv in range(iNumMajorPlayers):
if (tBirth[iLoopCiv] == 0 or iLoopCiv == utils.getHumanID()):
utils.makeUnit(iSettler, iEgypt, tCapitals[iEgypt], 1)
utils.makeUnit(con.iSwordsman, iEgypt, tCapitals[iEgypt], 1)
utils.makeUnit(iSettler, iSumeria, tCapitals[iSumeria], 1)
utils.makeUnit(con.iSwordsman, iSumeria, tCapitals[iSumeria], 1)

It then creates 2 settler and 2 swordsman for both Egypt and Sumeria, and gives a "you have been defeated" for any other civ selected in either scenario.

:hmm:
 
It looks like you are trying to implement a "late" scenario that doesn't start on turn 0, which the mod you are basing your work on (RFCGW?) does not support. Maybe it's worth looking into how DoC handles that stuff, i.e. look into getScenario() and getScenarioStartingTurn() in RFCUtils.py, which could help you here.

The defeat message appears because the human player needs to receive at least one unit at the beginning of the game regardless when they actually spawn, otherwise they lose the game before autoplay can even start. Traditionally that is a settler and a warrior.
 
It looks like you are trying to implement a "late" scenario that doesn't start on turn 0, which the mod you are basing your work on (RFCGW?) does not support. Maybe it's worth looking into how DoC handles that stuff, i.e. look into getScenario() and getScenarioStartingTurn() in RFCUtils.py, which could help you here.

The defeat message appears because the human player needs to receive at least one unit at the beginning of the game regardless when they actually spawn, otherwise they lose the game before autoplay can even start. Traditionally that is a settler and a warrior.

Yep, I've been looking at it, and that does indeed appear to be the problem.
 
Okay I looked at the scenario coding from DOC & RFC Europe. I used the following code for creation of units.

def create600ADstartingUnits( self ):
for iLoopCiv in range(iNumMajorPlayers):
if (tBirth[iLoopCiv] > utils.getScenarioStartYear() and iLoopCiv == utils.getHumanID()):
utils.makeUnit(con.iSettler, iLoopCiv, tCapitals[iLoopCiv], 1)
utils.makeUnit(con.iSpearman, iLoopCiv, tCapitals[iLoopCiv], 1)
self.assignTechs(iLoopCiv)


def create4000BCstartingUnits( self ):

#RFGW
for iLoopCiv in range(iNumMajorPlayers):
if (tBirth[iLoopCiv] > utils.getScenarioStartYear() and iLoopCiv == utils.getHumanID()):
utils.makeUnit(con.iSettler, iLoopCiv, tCapitals[iLoopCiv], 1)
utils.makeUnit(con.iWarrior, iLoopCiv, tCapitals[iLoopCiv], 1)
self.assignTechs(iLoopCiv)

It now correctly produces a warrior and settler in the early scenario and a spearman and settler in the later scenario. It also no longer creates a settler and military unit for Sumeria and Egypt for the AI in the later scenario which is good.
However it still is incorrectly creating a settler and spearman for the human player in the later scenario and does not automatically run through to civs which spawn later.
 
@Bonapartist Have you tried actually playing the game? You might have forgotten to edit CIV4CivilizationInfos.XML. It contains the text for the spawn date--the displayed text doesn't change in-game even if you already changed it in the Python code unless you've modified this one already.
 
How would I go about removing a civilization from the game ? What files should I delete and or modify ?

It might not be this simple, but my thought is follow Leoreth's guide for adding a civ to DOC. The same places where you would add a new civ are where you could delete a civ. Also some civs can be deselected in World Builder.
 
Remove entirely? Or stop from spawning?
 
Which file do you edit to change the population given when cities are founded by the Harrapan City Builders?
 
Those are still two different things.
 
Top Bottom