1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Bug Reports and Discussion

Discussion in 'More Naval AI Modmod' started by Tholal, Jan 3, 2013.

  1. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    Due to the naming of the BBAI log file, the game is crashing if you log something outside a game (with no active player).

    (I'm (mis)using the BBAI logger to log XML loading stuff.)
     
  2. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Here's a DLL that fixes this crash bug.
     

    Attached Files:

  3. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,115
    Location:
    Kael's head
    Is that supposed to be 2.7x larger than the old dll?

    Or to have these pop up?

    Code:
    Assert Failed
    
    File:  CvXMLLoadUtilitySet.cpp
    Line:  1688
    Expression:  bSuccess
    Message:  
    
    ----------------------------------------------------------
    Code:
    Assert Failed
    
    File:  CvGlobals.cpp
    Line:  3718
    Expression:  strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
    Message:  info type NO_BONUS not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

    I think you may have left some debug settings active that are normally turned off for final releases.

    It does at least seem to fix the crash though.
     
  4. Tolina

    Tolina trust the pillars with your s e c r e t s

    Joined:
    Feb 20, 2013
    Messages:
    10,519
    Location:
    Nightvale, US
    So I just installed MNAI. All is good, except that I'm getting spammed with the message that BugOptions folder not found. Is it because I have installed a separate BUG for BTS?
     
  5. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Ah. I accidentally uploaded the debug DLL instead. I'll add the release DLL to my previous post.

    Those error messages are saying that you have some sort of formatting issue with your XML (I think. XML errors are not really my area of expertise).
     
  6. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Entered a bug for this issue.

    OK. I'll add a bug for this as well.

    Possibly. You should have a folder in Documents->My Games->BTS that is labeled 'FFH - More Naval AI'. That is where the BUG settings for this mod are stored. The game is supposed to make the directory but it might get confused if you already have BUG installed. This is one of those areas that I really dont know much about.
     
  7. Tolina

    Tolina trust the pillars with your s e c r e t s

    Joined:
    Feb 20, 2013
    Messages:
    10,519
    Location:
    Nightvale, US
    There's no FFH - More Naval AI folder in My Games > BTS.
     
  8. Horatius

    Horatius Prince

    Joined:
    Sep 30, 2006
    Messages:
    575
    So, I tried the new version after a long time.
    Is it now intended that when researching a religion tech you don't receive a disciple anymore if youre not the first one to it?
    Unfortunate it is that diplomacy is still quite meh. Elohim consistently breaking off open borders even at friendly, same religion, same align is enough to put me off the game.
    When sharing a war, any AI should auto open borders btw, its probably the only mod where the normal behaviour does not happen. I could not reach by land the opp that some AI demanded to attack.
    Good align should not attack other Good align at pleased or friendly. Otherwise there's no roleplay and few points to alignments. Thats what I think anyway.
     
  9. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Unable to replicate this issue. I had no problems asking for and receiving Open Borders with civs with whom I shared a mutual military struggle. I even tested it where there was a civ who wouldn't share Open Borders because they were Annoyed at me. But as soon as I declared war on the civ they were currently fighting, they were happy to agree to Open Borders. It's not automatic, you still have to ask, but I did not see this issue during gameplay nor do I see anything in the code that would hinder Open Borders in the situation you describe.

    For these sorts of reports, a savegame is most useful since I can look at the specific situation in your game.
     
  10. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Create a directory with that name and try copying your BUG folder into it.
     
  11. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Makes sense. Unfortunately, war is done on a team level, and teams could potentially have members with differing alignments. I'll add a feature request for this issue.
     
  12. Tolina

    Tolina trust the pillars with your s e c r e t s

    Joined:
    Feb 20, 2013
    Messages:
    10,519
    Location:
    Nightvale, US
    Neat, worked. Thanks.
     
  13. Horatius

    Horatius Prince

    Joined:
    Sep 30, 2006
    Messages:
    575
    :):):)
     
  14. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Sorry. I missed this comment the first time through. I have a misplaced elif in CvEventManager. I'll fix it. Thanks!

    Interesting. Even though the Kuriotates cancel open borders with you at the start of the turn, they diplo screen with them shows Open Borders as being an option (though they wont accept). I'm thinking that someone possibly bribed or coerced them into cancelling borders with you. Do you have the savegame from a turn before by chance?
     
  15. Horatius

    Horatius Prince

    Joined:
    Sep 30, 2006
    Messages:
    575
    Unfortunately, I don't have a save game from the previous turn. I don't think Cardith was bribed as I had only met him and the Doviello by then if I recall correctly.
    Such behaviour is not rare and could be seen in previous versions. If you're suprised to see them close borders while the option is still available in the diplo screen maybe it is related to the difficulty level? I don't know. I saw such things every time I tried a game in the last couple of years, I think.

    What happened in the previous turn is that I switched to Cardith's religion. He went from cautious to pleased and then closed borders.
     
  16. rebl

    rebl Chieftain

    Joined:
    Oct 21, 2012
    Messages:
    16
    When running MNAI with extramod (i have tried 0.4, 0.4 beta and 0.31) the game starts with an empty tech screen and no interface (alt+ I or ctrl + I doesnt work. Also i cant acess civilopedia or options in the main menu.
    I have tried reinstalling BTS and MNAI.
    This only happens with EMM installed, only MNAI works fine.

    This is from the PythonErr2.log:
    Spoiler :
    sys.path = ['..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\email', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\encodings', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\build', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\colourchooser', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\editor', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\floatcanvas', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\masked', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\mixins', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\ogl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py\\tests', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

    sys.modules = {'zipimport': <module 'zipimport' (built-in)>, 'signal': <module 'signal' (built-in)>, '__builtin__': <module '__builtin__' (built-in)>, 'sys': <module 'sys' (built-in)>, '__main__': <module '__main__' (built-in)>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>}

    sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
    load_module CvEventInterface
    load_module BugEventManager
    load_module CvEventManager
    load_module CvUtil
    load_module traceback
    load_module CvScreensInterface
    load_module CvMainInterface
    load_module ScreenInput
    load_module CvScreenEnums
    load_module time
    load_module BugDll
    load_module BugOptions
    load_module BugConfig
    load_module BugCore
    load_module BugUtil
    load_module BugPath
    load_module BugConfigTracker
    load_module shutil
    load_module ColorUtil
    load_module BugInit
    load_module BugTypes
    load_module xmllib
    ..\WARLORDS\ASSETS\PYTHON\SYSTEM\xmllib.py:9: DeprecationWarning: The xmllib module is obsolete. Use xml.sax instead.
    05:07:50 DEBUG: BugConfig - registering xml handler BugConfig.RootHandler
    05:07:50 DEBUG: BugConfig - registering bug handler BugConfig.BugHandler
    05:07:50 DEBUG: BugConfig - registering load handler BugConfig.LoadHandler
    05:07:50 DEBUG: BugConfig - registering config handler BugConfig.ConfigHandler
    05:07:50 DEBUG: BugConfig - registering arg handler BugConfig.ArgHandler
    load_module configobj
    load_module __future__
    load_module codecs
    load_module validate
    validate import failed
    load_module RevInstances
    load_module ScenarioFunctions
    load_module Popup
    load_module PyHelpers
    load_module CustomFunctions
    load_module CvCameraControls
    load_module CvEspionageAdvisor
    load_module CvWBDesc
    load_module array
    load_module BugOptionsScreen
    load_module BugErrorOptionsTab
    load_module BugOptionsTab
    load_module BugHelp
    05:07:51 INFO : BugCore - creating uninitialized mod Core
    05:07:51 INFO : BugCore - creating uninitialized mod MainInterface
    load_module CityUtil
    05:07:51 INFO : BugCore - creating uninitialized mod NJAGC
    05:07:51 INFO : BugCore - creating uninitialized mod Scores
    05:07:51 INFO : BugCore - creating uninitialized mod CityScreen
    05:07:51 INFO : BugCore - creating uninitialized mod Revolution
    05:07:51 INFO : BugCore - creating uninitialized mod PLE
    load_module Scoreboard
    load_module DealUtil
    load_module PlayerUtil
    load_module TradeUtil
    load_module DiplomacyUtil
    load_module AttitudeUtil
    load_module FontUtil
    load_module GameUtil
    load_module BugUnitPlot
    load_module MonkeyTools
    load_module UnitUtil
    load_module ReminderEventManager
    load_module SdToolKit
    load_module BugData
    load_module cPickle
    load_module autolog
    load_module CvModName
    05:07:51 INFO : BugCore - creating uninitialized mod Autolog
    05:07:51 INFO : BugCore - creating uninitialized mod Reminder
    load_module CvAppInterface
    load_module GGUtil
    load_module GPUtil
    load_module ProgressBarUtil
    load_module PLE
    load_module AStarTools
    load_module RawYields
    load_module CvTechChooser
    load_module TechPrefs
    05:07:51 INFO : BugCore - creating uninitialized mod Advisors
    load_module CvForeignAdvisor
    load_module math
    load_module CvExoticForeignAdvisor
    load_module IconGrid_BUG
    load_module DomPyHelpers
    load_module TechTree
    load_module FavoriteCivicDetector
    load_module CvReligionScreen
    load_module ReligionUtil
    load_module CvCorporationScreen
    load_module CvSomniumInterface
    load_module copy
    load_module CvCivicsScreen
    load_module CvVictoryScreen
    load_module TechUtil
    load_module GameSetUpCheck
    load_module AutoSave
    load_module MapFinder
    load_module MapFinderStatusScreen
    05:07:52 INFO : BugCore - creating uninitialized mod MapFinder
    05:07:52 INFO : BugCore - creating uninitialized mod AutoSave
    load_module Buffy
    05:07:52 INFO : BugCore - creating uninitialized mod BUFFY
    load_module CvOptionsScreen
    load_module CvReplayScreen
    load_module CvHallOfFameScreen
    load_module CvDanQuayle
    load_module CvGameUtils
    load_module CvUnVictoryScreen
    load_module CvDawnOfMan
    load_module CvTechSplashScreen
    load_module CvTopCivs
    load_module random
    load_module CvInfoScreen
    load_module CvIntroMovieScreen
    load_module CvVictoryMovieScreen
    load_module CvWonderMovieScreen
    load_module CvEraMovieScreen
    load_module CvSpaceShipScreen
    load_module SevoScreenEnums
    load_module CvWorldBuilderScreen
    load_module WBBuildingScreen
    load_module WBCityDataScreen
    load_module WBCityEditScreen
    load_module WBPlayerScreen
    load_module WBProjectScreen
    load_module WBTeamScreen
    load_module WBTechScreen
    load_module WBPlayerUnits
    load_module WBUnitScreen
    load_module WBPromotionScreen
    load_module WBPlotScreen
    load_module WBEventScreen
    load_module WBLandMarks
    load_module WBCorporationScreen
    load_module WBBonusScreen
    load_module WBSpecialistScreen
    load_module WBDiplomacyScreen
    load_module CvDebugTools
    load_module CvDebugInfoScreen
    load_module CvMapGeneratorUtil
    load_module CvGFCScreen
    load_module CvPopupInterface
    load_module CvScreenUtilsInterface
    load_module CvOverlayScreenUtils
    load_module CvDotMapOverlayScreen
    load_module CvStrategyOverlay
    05:07:54 INFO : BugCore - creating uninitialized mod StrategyOverlay
    load_module CvTrophyHall
    load_module Trophies
    05:07:54 INFO : BugCore - creating uninitialized mod CustDomAdv
    05:07:54 INFO : BugCore - creating uninitialized mod TechWindow
    init-ing world builder screen
    Traceback (most recent call last):
    File "<string>", line 1, in ?
    File "<string>", line 52, in load_module
    File "CvEventInterface", line 17, in ?
    File "<string>", line 52, in load_module
    File "BugEventManager", line 102, in ?
    File "<string>", line 52, in load_module
    File "CvEventManager", line 11, in ?
    File "<string>", line 52, in load_module
    File "CvScreensInterface", line 1527, in ?
    TypeError: __init__() takes exactly 2 arguments (1 given)
     
  17. Terkhen

    Terkhen King

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    Since the bug only happens with ExtraModMod, you should report it at ExtraModMod's forum thread. Having said that, it seems like an installation problem. Make sure that you are installing ExtraModMod on top of a clean FFH2 0.41o version (as described in the readme) and try again. If the error still happens, please make another post at ExtraModMod's forum thread. Thank you!
     
  18. Horatius

    Horatius Prince

    Joined:
    Sep 30, 2006
    Messages:
    575
    I think Sephi rcently added code in MoM to prevent AIs from declaring on the same align while pleased or friendly. It may or not be useful.
     
  19. Akbarthegreat

    Akbarthegreat Angel of Junil

    Joined:
    Sep 23, 2010
    Messages:
    1,747
    Location:
    Erebus
    An annoyance that MC told me to report here:
    Before HBR is discovered, if workers get free exp from any source (apprenticeship) there is a blue glow around them. Same with settlers. How can you remove the glow from units who have no promotions to pick?
     
  20. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,115
    Location:
    Kael's head
    In my current game with my modmod I'm getting a repeatable crash to desktop, with this in PythonErr.log:

    Code:
    Traceback (most recent call last):
      File "BugEventManager", line 361, in _handleDefaultEvent
      File "RevEvents", line 435, in onCityAcquired
      File "RevEvents", line 494, in checkRebelBonuses
    RuntimeError: unidentifiable C++ exception
    
    Spoiler :

    BugEventManager.py
    Code:
    	def _handleDefaultEvent(self, eventType, argsList):
    		if self.EventHandlerMap.has_key(eventType):
    			for eventHandler in self.EventHandlerMap[eventType]:
    				try:
    					[COLOR="Red"]eventHandler(argsList)[/COLOR]
    				except:
    					BugUtil.trace("Error in %s event handler %s", eventType, eventHandler)
    
    
    RevEvents.py
    Code:
    
    def onCityAcquired( argsList ):
    		'City Acquired'
    
    		owner,playerType,pCity,bConquest,bTrade = argsList
    
    		[COLOR="Red"]checkRebelBonuses( argsList )[/COLOR]
    		updateRevolutionIndices( argsList )
    
    		# Init city script data (unit spawn counter, rebel player)
    		iRevCiv = RevData.getCityVal(pCity, 'RevolutionCiv')
    		RevData.initCity(pCity)
    		RevData.setCityVal( pCity, 'RevolutionCiv', iRevCiv )
    		
    		iTurns = pCity.getOccupationTimer()
    		#if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - Occupations timer is currently %d"%(iTurns))
    		pCity.setRevolutionCounter( max([int(1.5*iTurns),3]) )
    		
    def checkRebelBonuses( argsList ) :
    		# Give bonuses to a rebel player who successfully captures one of their rebellious cities
    		owner,playerType,pCity,bConquest,bTrade = argsList
    
    		newOwnerID = pCity.getOwner()
    		newOwner = gc.getPlayer(newOwnerID)
    		newOwnerCiv = newOwner.getCivilizationType()
    		oldOwnerID = pCity.getPreviousOwner()
    		orgOwnerID = pCity.getOriginalOwner()
    		
    		# TODO: Handle case where city is acquired by disorganized rebels
    		if( newOwnerID == gc.getBARBARIAN_PLAYER() and pCity.getRevolutionCounter() > 0 ) :
    			if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s captured by barb rebels!"%(pCity.getName()))
    			oldOwner = gc.getPlayer(oldOwnerID)
    
    			if( not oldOwnerID == orgOwnerID ) :
    				orgOwner = gc.getPlayer(orgOwnerID)
    				#if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s originally owned by %s!"%(pCity.getName(),orgOwner.getCivilizationDescription(0)))
    
    			if( pCity.countTotalCultureTimes100() > 100*100 ) :
    				if( not (oldOwnerID == pCity.findHighestCulture()) ) :
    					cultOwner = gc.getPlayer( pCity.findHighestCulture() )
    					#if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s culturally dominated by %s!"%(pCity.getName(),cultOwner.getCivilizationDescription(0)))
    
    		elif( newOwnerCiv == RevData.getCityVal(pCity, 'RevolutionCiv') ) :
    
    			# TODO: Check whether revolt is active in RevoltData
    			if( (pCity.getReinforcementCounter() > 0 or (pCity.unhappyLevel(0) - pCity.happyLevel()) > 0) ) :
    				if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - Rebellious pCity %s is captured by rebel identity %s (%d)!!!"%(pCity.getName(),newOwner.getCivilizationDescription(0),newOwnerCiv))
    
    				newOwnerTeam = gc.getTeam(newOwner.getTeam())
    				oldOwner = gc.getPlayer(oldOwnerID)
    				oldOwnerTeam = gc.getTeam(oldOwner.getTeam())
    				if( oldOwnerTeam.isAVassal() ) :
    					for teamID in range(0,gc.getMAX_CIV_TEAMS()) :
    						if( oldOwnerTeam.isVassal(teamID) ) :
    							oldOwnerTeam = gc.getTeam( teamID )
    				
    				ix = pCity.getX()
    				iy = pCity.getY()
    				
    				[iWorker,iBestDefender,iCounter,iAttack] = RevUtils.getHandoverUnitTypes( pCity, newOwner, newOwner )
    				
    				newUnitList = list()
    
    				# Couple units regardless of rebel status
    				[COLOR="Red"]newUnitList.append(newOwner.initUnit( iBestDefender, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    				if( pCity.getPopulation() > 4 ) :
    					newUnitList.append(newOwner.initUnit( iCounter, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))
    		
    
    


    (I could post a saved game, but it is with a version of my modmod that have been changed a bit since my last release. I don't see how the changes could be relevant for this bug, but they would make saved games incompatible.)

    edit: I was able to prevent the crash with these changes, making sure that each of the unit types exist before trying to initilize them.
    Spoiler :
    Code:
    def checkRebelBonuses( argsList ) :
    		# Give bonuses to a rebel player who successfully captures one of their rebellious cities
    		owner,playerType,pCity,bConquest,bTrade = argsList
    
    		newOwnerID = pCity.getOwner()
    		newOwner = gc.getPlayer(newOwnerID)
    		newOwnerCiv = newOwner.getCivilizationType()
    		oldOwnerID = pCity.getPreviousOwner()
    		orgOwnerID = pCity.getOriginalOwner()
    		
    		# TODO: Handle case where city is acquired by disorganized rebels
    		if( newOwnerID == gc.getBARBARIAN_PLAYER() and pCity.getRevolutionCounter() > 0 ) :
    			if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s captured by barb rebels!"%(pCity.getName()))
    			oldOwner = gc.getPlayer(oldOwnerID)
    
    			if( not oldOwnerID == orgOwnerID ) :
    				orgOwner = gc.getPlayer(orgOwnerID)
    				#if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s originally owned by %s!"%(pCity.getName(),orgOwner.getCivilizationDescription(0)))
    
    			if( pCity.countTotalCultureTimes100() > 100*100 ) :
    				if( not (oldOwnerID == pCity.findHighestCulture()) ) :
    					cultOwner = gc.getPlayer( pCity.findHighestCulture() )
    					#if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - City %s culturally dominated by %s!"%(pCity.getName(),cultOwner.getCivilizationDescription(0)))
    
    		elif( newOwnerCiv == RevData.getCityVal(pCity, 'RevolutionCiv') ) :
    
    			# TODO: Check whether revolt is active in RevoltData
    			if( (pCity.getReinforcementCounter() > 0 or (pCity.unhappyLevel(0) - pCity.happyLevel()) > 0) ) :
    				if( LOG_DEBUG ) : CvUtil.pyPrint("Revolt - Rebellious pCity %s is captured by rebel identity %s (%d)!!!"%(pCity.getName(),newOwner.getCivilizationDescription(0),newOwnerCiv))
    
    				newOwnerTeam = gc.getTeam(newOwner.getTeam())
    				oldOwner = gc.getPlayer(oldOwnerID)
    				oldOwnerTeam = gc.getTeam(oldOwner.getTeam())
    				if( oldOwnerTeam.isAVassal() ) :
    					for teamID in range(0,gc.getMAX_CIV_TEAMS()) :
    						if( oldOwnerTeam.isVassal(teamID) ) :
    							oldOwnerTeam = gc.getTeam( teamID )
    				
    				ix = pCity.getX()
    				iy = pCity.getY()
    				
    				[iWorker,iBestDefender,iCounter,iAttack] = RevUtils.getHandoverUnitTypes( pCity, newOwner, newOwner )
    				
    				newUnitList = list()
    
    				# Couple units regardless of rebel status
    				[COLOR="Red"]if iBestDefender != -1:#Magister
    					newUnitList.append(newOwner.initUnit( iBestDefender, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    				if( pCity.getPopulation() > 4 ) :
    					[COLOR="Red"]if iCounter != -1:#Magister
    						newUnitList.append(newOwner.initUnit( iCounter, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    				
    				if( newOwner.isRebel() ) :
    					# Extra benefits if still considered a rebel
    					mess = localText.getText("TXT_KEY_REV_MESS_YOUR_CAPTURE",())%(pCity.getName())
    					CyInterface().addMessage(newOwnerID, false, gc.getDefineINT("EVENT_MESSAGE_TIME"), mess, "AS2D_CITY_REVOLT", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, CyArtFileMgr().getInterfaceArtInfo("INTERFACE_RESISTANCE").getPath(), ColorTypes(8), ix, iy, True, True)
    					mess = localText.getText("TXT_KEY_REV_MESS_REBEL_CONTROL",())%(newOwner.getCivilizationDescription(0),pCity.getName())
    					CyInterface().addMessage(oldOwnerID, false, gc.getDefineINT("EVENT_MESSAGE_TIME"), mess, None, InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, None, ColorTypes(7), -1, -1, False, False)
    					
    					# Gold
    					iGold = game.getSorenRandNum(min([80,8*pCity.getPopulation()]),'Rev') + 8
    					mess = localText.getText("TXT_KEY_REV_MESS_YOUR_CAPTURE_GOLD",())%(pCity.getName(),iGold)
    					CyInterface().addMessage(newOwnerID, false, gc.getDefineINT("EVENT_MESSAGE_TIME"), mess, "AS2D_CITY_REVOLT", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, CyArtFileMgr().getInterfaceArtInfo("INTERFACE_RESISTANCE").getPath(), ColorTypes(8), ix, iy, False, False)
    					newOwner.changeGold( iGold )
    					
    					# Culture
    					newCulVal = int( revCultureModifier*max([pCity.getCulture(oldOwnerID),pCity.countTotalCultureTimes100()/200]) )
    					newPlotVal = int( revCultureModifier*max([pCity.plot().getCulture(oldOwnerID),pCity.plot().countTotalCulture()/2]) )
    					RevUtils.giveCityCulture( pCity, newOwnerID, newCulVal, newPlotVal, overwriteHigher = False )
    					
    					# Extra units
    					if(iWorker != -1):
    						newUnitList.append(newOwner.initUnit( iWorker, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))
    					if( pCity.getPopulation() > 7 ) :
    						[COLOR="Red"]if iBestDefender != -1:#Magister
    							newUnitList.append(newOwner.initUnit( iBestDefender, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    					if( pCity.getPopulation() > 4 and newOwnerTeam.getPower(True) < oldOwnerTeam.getPower(True)/4 ) :
    						[COLOR="Red"]if iAttack != -1:#Magister
    							newUnitList.append(newOwner.initUnit( iAttack, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    					
    					if( newOwner.getNumCities() <= 1 ) :
    						# Extra units for first city captured
    [COLOR="Red"]
    						if iCounter != -1:#Magister[/COLOR]
    							newUnitList.append(newOwner.initUnit( iCounter, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))
    						if( newOwnerTeam.getPower(True) < oldOwnerTeam.getPower(True)/2 ) :
    							[COLOR="Red"]if iBestDefender != -1:#Magister
    								newUnitList.append(newOwner.initUnit( iBestDefender, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))
    							if iAttack != -1:#Magister
    								newUnitList.append(newOwner.initUnit( iAttack, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    						elif( newOwnerTeam.getPower(True) < oldOwnerTeam.getPower(True) ) :
    							[COLOR="Red"]if iAttack != -1:#Magister
    								newUnitList.append(newOwner.initUnit( iAttack, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH ))[/COLOR]
    					
     

Share This Page