HELP with merging my mod and BUG!!!

EmperorFool, I get the same assert as above too. I didn't before BUG 4.2, but as I just updated my mod to Bug 4.2, I get that assert too. I suspect it's a python error, since I do have a PROMOTION_LEADER in my mod, but the assert appears before the XML loads. I'd appreciate it if you could look into it.
 
EmperorFool, I get the same assert as above too. I didn't before BUG 4.2, but as I just updated my mod to Bug 4.2, I get that assert too. I suspect it's a python error, since I do have a PROMOTION_LEADER in my mod, but the assert appears before the XML loads. I'd appreciate it if you could look into it.

BUG doesn't have that XML file (CIV4GraphicOptionInfos.xml), so I don't see how it could be related. I have never seen that assert, but I don't normally run the debug builds. I'll run a debug and see what happens.

The circle above the action buttons is the missing buttons that I believe are supposed to show up.

Make sure you are using PLE Style and have the Filter Buttons enabled on the Plot List options tab. Ruff did some work recently in this area, and that looks like a different Style setting.

The smaller circle refers to what looks like some sort of text overlap,

This is due to a problem with Civ4's ability to calculate the length of a multi-colored text string. The only solution is to add some spacing after the Civ Name column in your Display Order setting on the Scoreboard options tab.

After I ended my first turn and started the second turn I got some error message in the alert section and then a plethora of python exception pop-ups.

Code:
TypeError: list indices must be integers
File "SdToolKit", line 110, in sdModSave
File "SpyUtil", line 116, in store
File "SpyUtil", line 135, in onBeginPlayerTurn
File "BugEventManager", line 350, in_handleDefaultEvent
Traceback (most recent call last):
[code][/quote]

It sounds like the Next War mod is still writing its information directly to CyGame's script data. Look for setScriptData() calls in all of your code. If you are loading an older test game that was created before you changed the NW code, the script data is already messed up, and you need to create a new test game.

[quote="The Capo, post: 8821971"]I also got a CTD when I selected the BUG Help menu thing in the options screen.[/QUOTE]

Ruff, can you check this out, please?
 
BUG doesn't have that XML file (CIV4GraphicOptionInfos.xml), so I don't see how it could be related. I have never seen that assert, but I don't normally run the debug builds. I'll run a debug and see what happens.

Yeah, I just found the cause, and guess whose fault it is? Ruff_hi and his new PLE. Look in the BugUnitPlot.py, near the top, he declares a variable iLeaderPromo = gc.getInfoTypeForString('PROMOTION_LEADER'). I was right, it was BUG's fault (and The Capo and I aren't crazy).

You guys might want to set it so it looks for the promotion after the XML loads.
 
This is why I created the <init> tag in BUG's configuration XML files. It allows you to tell BUG to call a function after BUG has initialized which is after the XML is loaded. You can use this to look things up in the XML, FontSymbols, etc. that aren't available when your Python module is first loaded.

You can learn about using this tag in the documentation. I'll let Ruff fix it, otherwise he'll never learn to test his code before committing it. :mischief: In the meantime you can lazy load the value. First change the initialization to None:

Code:
iLeaderPromo = None

Then find all functions that use it and make sure they look up the value:

Code:
global iLeaderPromo
if iLeaderPromo is None:
    iLeaderPromo = gc.getInfoTypeForString("PROMOTION_LEADER")

... code that uses iLeaderPromo ...
 
This is why I created the <init> tag in BUG's configuration XML files. It allows you to tell BUG to call a function after BUG has initialized which is after the XML is loaded. You can use this to look things up in the XML, FontSymbols, etc. that aren't available when your Python module is first loaded.

You can learn about using this tag in the documentation. I'll let Ruff fix it, otherwise he'll never learn to test his code before committing it. :mischief: In the meantime you can lazy load the value. First change the initialization to None:

Code:
iLeaderPromo = None
Then find all functions that use it and make sure they look up the value:

Code:
global iLeaderPromo
if iLeaderPromo is None:
    iLeaderPromo = gc.getInfoTypeForString("PROMOTION_LEADER")

... code that uses iLeaderPromo ...

Yeah, I know about it (I use it a couple of times, pretty handy), but I couldn't tell if you were talking to me or the Capo.

Just make sure you tell Ruff about it.
 
Hey EmperorFool, I have a sporadically occuring Assert Failure when playing my mod. Everything works fine and it doesn't seem to be causing any issues while playing but I was wondering if you knew what it was and what it means. Here is an image of the Assert Failure pop-up.

It didn't happen in my mod prior to merging BUG, so it must be related to BUG somehow.
 
What are you doing in the game when that assertion files? Loading? Starting a new game? AI turns?
 
Well, at first it seemed to only occur during the Autosave, but then it started happening sporadically. It doesn't seem to occur at any specific interval, and actually doesn't even occur that often. I can't really tell what is causing it to happen. If you want to I could send you a link to my mod's playtest and you can play it (so far I've played two games and it starts happening around the Classical age), but its a little less than an hour to DL and I don't want to waste your time any more than I already have.

As far as I can tell it seems random, so to answer your question I don't know what is causing it to happen.
 
When I get home I'll look at that area of the SDK and see where BUG is calling it. Maybe I can figure out the problem.
 
When I get home I'll look at that area of the SDK and see where BUG is calling it. Maybe I can figure out the problem.

Thanks, I'm not sure if it is BUG or my mod with BUG. Because I haven't played BUG on its own before with a DebugDLL so I'm just not sure. But if nobody has reported it yet, it's probably on my end.
 
This line is in CvTeam::isHasMet(), and it means that the code is asking one team if they've met the NO_TEAM team which is illegal. It ends up returning whatever happens to be stored in memory just before the list of booleans marking which teams the first team has met. In other words, some random value. :(

I've added a bunch of new code to BUG lately that makes use of isHasMet(), so it's possible that it's a problem on my end as well, but I can't say for sure. There's plenty of other non-BUG code that uses this function. The only way to be sure is to play a BUG game using a debug DLL which I'll do sometime in the not too distant future.
 
This line is in CvTeam::isHasMet(), and it means that the code is asking one team if they've met the NO_TEAM team which is illegal. It ends up returning whatever happens to be stored in memory just before the list of booleans marking which teams the first team has met. In other words, some random value. :(

I've added a bunch of new code to BUG lately that makes use of isHasMet(), so it's possible that it's a problem on my end as well, but I can't say for sure. There's plenty of other non-BUG code that uses this function. The only way to be sure is to play a BUG game using a debug DLL which I'll do sometime in the not too distant future.

Well, are either of these issues game-breaking as far as you can tell? I haven't really seen them cause anything to happen that effects the game really. But I do have the DebugDLL in, which seems to have been prevent a CTD upon selection of return to main menu, so it might be preventing a CTD here too.
 
@ EmeperorFool: I'd like to revisit the PROMOTION_LEADER issue from before. I am adding a few new wonders to my mod and one of them is Leonardo's Workshop by Tsentom1. Here is the code used for that wonder, it goes in the CvGameUtils.py file:

Code:
	def getUpgradePriceOverride(self, argsList):
		iPlayer, iUnitID, iUnitTypeUpgrade = argsList

## Leonardo's Workshop Start ##

		pPlayer = gc.getPlayer(iPlayer)
		pUnit = pPlayer.getUnit(iUnitID)

		iPrice = gc.getDefineINT("BASE_UNIT_UPGRADE_COST")
		iPrice += (max(0, (pPlayer.getUnitProductionNeeded(iUnitTypeUpgrade) - pPlayer.getUnitProductionNeeded(pUnit.getUnitType()))) * gc.getDefineINT("UNIT_UPGRADE_COST_PER_PRODUCTION"))

		if ((not pPlayer.isHuman()) and (not pPlayer.isBarbarian())):
			pHandicapInfo = gc.getHandicapInfo(gc.getGame().getHandicapType())
			iPrice = iPrice * pHandicapInfo.getAIUnitUpgradePercent() / 100
			iPrice = iPrice * max(0, ((pHandicapInfo.getAIPerEraModifier() * pPlayer.getCurrentEra()) + 100)) / 100

		iPrice = iPrice - ((iPrice * pUnit.getUpgradeDiscount()) / 100)

		b_Leonardo = gc.getInfoTypeForString("BUILDING_LEONARDO")
		obsoleteTech = gc.getBuildingInfo(b_Leonardo).getObsoleteTech()
		if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
			for iCity in range(pPlayer.getNumCities()):
				ppCity = pPlayer.getCity(iCity)
				if ppCity.getNumActiveBuilding(b_Leonardo) == true:
					iPrice = ((gc.getDefineINT("BASE_UNIT_UPGRADE_COST"))/2)
					iPrice += (((max(0, (pPlayer.getUnitProductionNeeded(iUnitTypeUpgrade) - pPlayer.getUnitProductionNeeded(pUnit.getUnitType()))) * gc.getDefineINT("UNIT_UPGRADE_COST_PER_PRODUCTION")))/2)

					if ((not pPlayer.isHuman()) and (not pPlayer.isBarbarian())):
						pHandicapInfo = gc.getHandicapInfo(gc.getGame().getHandicapType())
						iPrice = ((iPrice * pHandicapInfo.getAIUnitUpgradePercent() / 100)/2)
						iPrice = ((iPrice * max(0, ((pHandicapInfo.getAIPerEraModifier() * pPlayer.getCurrentEra()) + 100)) / 100)/2)

						iPrice = ((iPrice - ((iPrice * pUnit.getUpgradeDiscount()) / 100))/2)

		if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_LEADER')):

			iPrice = 0
		
		return iPrice

## Leonardo's Workshop End ##	

## Leonardo's Workshop Start ##	
#
## NOTE: You need to comment out (add a # before) the original return -1 (done below) ##
#
#		return -1	# Any value 0 or above will be used
#
## Leonardo's Workshop End ##	
	
	def getExperienceNeeded(self, argsList):
		# use this function to set how much experience a unit needs
		iLevel, iOwner = argsList
		
		iExperienceNeeded = 0

I noticed within this code there is a reference to the PROMOTION_LEADER tag or whatever. I added this python to my mod, and while I can build Leonardo's Workshop there is no effect on unit upgrade costs (it is supposed to halve the cost to upgrade a unit). Since someone in Tsentom's thread told me it worked, and since I definitely added it correctly (I compared my python to his) I was wondering if it wasn't working becuase of the missing PROMOTION_LEADER tag from this assert failure:

attachment.php

I was wondering, if this is the case, how can I fix it, or if you have tried to yet?
 
Did you remove that promotion from your mod? That code runs at a point where all of the promotions have definitely been read in from the XML. If you get an assert failure there, it means the promotion is actually missing.
 
No I didn't remove it, it's there in m PromotionInfos XML file. See...

Code:
		<PromotionInfo>
			<Type>PROMOTION_LEADER</Type>
			<Description>TXT_KEY_PROMOTION_GREAT_GENERAL</Description>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<LayerAnimationPath>NONE</LayerAnimationPath>
			<PromotionPrereq>NONE</PromotionPrereq>
			<PromotionPrereqOr1>NONE</PromotionPrereqOr1>
			<PromotionPrereqOr2>NONE</PromotionPrereqOr2>
			<TechPrereq>NONE</TechPrereq>
			<StateReligionPrereq>NONE</StateReligionPrereq>
			<bLeader>1</bLeader>
			<bBlitz>0</bBlitz>
			<bAmphib>0</bAmphib>
			<bRiver>0</bRiver>
			<bEnemyRoute>0</bEnemyRoute>
			<bAlwaysHeal>0</bAlwaysHeal>
			<bHillsDoubleMove>0</bHillsDoubleMove>
			<bImmuneToFirstStrikes>0</bImmuneToFirstStrikes>
			<iVisibilityChange>0</iVisibilityChange>
			<iMovesChange>0</iMovesChange>
			<iMoveDiscountChange>0</iMoveDiscountChange>
			<iAirRangeChange>0</iAirRangeChange>
			<iInterceptChange>0</iInterceptChange>
			<iEvasionChange>0</iEvasionChange>
			<iWithdrawalChange>0</iWithdrawalChange>
			<iCargoChange>0</iCargoChange>
			<iCollateralDamageChange>0</iCollateralDamageChange>
			<iBombardRateChange>0</iBombardRateChange>
			<iFirstStrikesChange>0</iFirstStrikesChange>
			<iChanceFirstStrikesChange>0</iChanceFirstStrikesChange>
			<iEnemyHealChange>0</iEnemyHealChange>
			<iNeutralHealChange>0</iNeutralHealChange>
			<iFriendlyHealChange>0</iFriendlyHealChange>
			<iSameTileHealChange>0</iSameTileHealChange>
			<iAdjacentTileHealChange>0</iAdjacentTileHealChange>
			<iCombatPercent>0</iCombatPercent>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<iKamikazePercent>0</iKamikazePercent>
			<iRevoltProtection>0</iRevoltProtection>
			<iCollateralDamageProtection>0</iCollateralDamageProtection>
			<iPillageChange>0</iPillageChange>
			<iUpgradeDiscount>100</iUpgradeDiscount>
			<iExperiencePercent>0</iExperiencePercent>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitCombatMods/>
			<DomainMods/>
			<TerrainDoubleMoves/>
			<FeatureDoubleMoves/>
			<UnitCombats>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_SIEGE</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_ARMOR</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_HELICOPTER</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_NAVAL</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_ASSAULT_MECH</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_DREADNOUGHT</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
			</UnitCombats>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<Button>,Art/Interface/Buttons/Promotions/Combat5.dds,Art/Interface/Buttons/Warlords_Atlas_1.dds,5,10</Button>
		</PromotionInfo>

I think Afforess said he had the same issue when he ran BUG with a DebugDLL. I'm just wondering if BUG is incompatible with the Leonardo's Workshop python (from Tsentom1's Python Wonders) that I have here. I ask this because a couple people have reported on Tsentom1's thread that the wonder works, the building is completely buildable and is properly inserted (as a wonder, with working video and art, and you get the effects from BuildingInfos too) it is just that the python effect (the -50% upgrade cost) doesn't happen at all.

Also, you will notice that it references the GraphicOptions xml file, not the PromotionInfos XML, so I'm wondering why it is looking for the Promotion there anyway.
 
Back
Top Bottom