Modmodding Q&A Thread

What does the onCityAcquired methond in Communications.py works for?

Code:
        def onCityAcquired(self, city):

                for iLoopCiv in range (iNumMajorPlayers):
                        if (city.hasBuilding(iNumBuildingsPlague + iLoopCiv)):
				print "Delete building id: "+str(iNumBuildingsPlague + iLoopCiv)
                                city.setHasRealBuilding(iNumBuildingsPlague + iLoopCiv, False)
				print "Delete building id: "+str(iNumBuildingsPlague + iLoopCiv)+" passed."
                                print ("embassy deleted on city acquired", city.getName())

It removes all embassies when you capture a city.
 
Then I cannot understand why and how that part makes error message which related with cpp errors.


Spoiler :
Civ4_Screen_Shot1160.jpg
 
If you have added a new civ, have you also added their embassy? That's the most common source for errors in that method.
 
What's the point of posting enemy spoilers? I have never understood it.

For the convenient scroll. :lol:

If you have added a new civ, have you also added their embassy? That's the most common source for errors in that method.

I checked embassy in const.py and there was no problem. Yes it seems like simple number problem, but that kind of error is the hardest one to find out..
 
For the convenient scroll. :lol:



I checked embassy in const.py and there was no problem. Yes it seems like simple number problem, but that kind of error is the hardest one to find out..
Not the constants, the actual embassy building in the XML.
 
Spoiler :
Civ4_Screen_Shot1164.jpg


It does not seems like my modding fault, but there's still possibility of it so I brought it here. In first glance, the error caused by BUG scoreboard python files, especially the case when you can see the score of other civ that became another civ's vassal state.

++
Spoiler :
Civ4_Screen_Shot1165.jpg


640px-FACEPALM.png
 
I added some codes into congresses.py to discourage English colony founding in Australia when Australian civ is alive.

Code:
				# colonies
				if iPlayer in lCivGroups[0]:
					if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
						if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
							if iSettlerMapValue > 90:
								iValue += max(1, iSettlerMapValue / 100)
				
					if gc.getPlayer(iAustralia).isAlive():
						if utils.isPlotInArea((x, y), tAustraliaTL, tAustraliaBR):
							iValue -= 40

But still England founds Cairns when Australia is alive. Is my code has some problems or just that '-40' points were not enough to keep Englishmen away from Australia?
 
If one would like to add several civs, what would you advise him to do? Add them one by one or add them all together at once?
 
If one would like to add several civs, what would you advise him to do? Add them one by one or add them all together at once?
All at once. I did the five optional civs in one go, for instance.
I added some codes into congresses.py to discourage English colony founding in Australia when Australian civ is alive.

Code:
# colonies
if iPlayer in lCivGroups[0]:
if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
if iSettlerMapValue > 90:
iValue += max(1, iSettlerMapValue / 100)

if gc.getPlayer(iAustralia).isAlive():
if utils.isPlotInArea((x, y), tAustraliaTL, tAustraliaBR):
iValue -= 40

But still England founds Cairns when Australia is alive. Is my code has some problems or just that '-40' points were not enough to keep Englishmen away from Australia?
The usual values are never more than 10, no idea why it doesn't work.
 
Code:
				# Australia independence check
				if iPlayer in lCivGroups[0]:				
					if gc.getPlayer(iAustralia).isAlive():
						if utils.isPlotInArea((x, y), tAustraliaTL, tAustraliaBR): continue

I changed the codes into form using 'continue' - but still, Englishmen founds Perth or Cairns with congress. Some problems must be there but well.. hmm.
 
If the game crashes without any ingame error message and shows Windows&#8482; error window&#8482;, is it the problem of cpp files?
 
If the game crashes without any ingame error message and shows Windows&#8482; error window&#8482;, is it the problem of cpp files?

Something similar happened to me.

Check the handicap level of your new civ in the scenario files. I forgot to update that and that caused a crash.

(I used "Handicap=HANDICAP_PRINCE" for Sweden, which doesn't exist anymoredue to the new difficulty levels and caused the crash. I updated it to "Handicap=HANDICAP_REGENT" and the problem was solved.)
 
Back
Top Bottom