Single unit from mod causing game to crash

rhettrongun

Prince
Joined
Mar 19, 2011
Messages
341
Location
TX
Hello,

I have had a "civ 5 has stopped working..." crash that has been plaguing my ww2 mod for a while now, and thankfully another user has helped me to identify the source of the crash. It is the TBF Avenger torpedo bomber. As soon as it attempts to make an appearance in game then boom "civ 5 has stopped working". This occurs whether it is the player or the AI attempting to build it. The mod works just fine up until this point also.

I went through the xml very thoroughly, but cannot find any problems with the unit. I was wondering if anyone has some experience with this and might have a clue on where to look. Perhaps I just need a second set of eyes to look at it. Did I forget something for the Avenger?

I've included the relevant xml below. I left out TXT_KEY references it uses, because I can see that all the text related to it functions properly in game. I also verified that the promotions it uses function properly, as other units with the exact same promo set do not cause the crash to occur. Same thing with the icon art files. Those are already verified to be working correctly in game, as they are used by other units that don't cause the crash plus show up fine in the civilopedia/tech screen/city build screen. One other thing is that it does not use any upgrade mechanism.

I attached a zip file with the art define files and the art files related to the Avenger if anyone thinks that might be the problem. If you want to check the art defines then just use ctrl+f for "avenger" to find it once you open the data file.

Avenger:
Spoiler :
Code:
<GameData>
	<UnitClasses>
		<Row>
			<Type>UNITCLASS_FIGHTER_BOMBER</Type>
			<Description>TXT_KEY_UNIT_FIGHTER_BOMBER</Description>
			<DefaultUnit>UNIT_FIGHTER_BOMBER</DefaultUnit>
		</Row>
	</UnitClasses>
	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<UnitClassType>UNITCLASS_FIGHTER_BOMBER</UnitClassType>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
	<Units>
		<Row>
			<Class>UNITCLASS_FIGHTER_BOMBER</Class>
			<Type>UNIT_AMERICAN_TBF_AVENGER</Type>
			<PrereqTech>TECH_LASERS</PrereqTech>
			<RangedCombat>55</RangedCombat>
			<Cost>350</Cost>
			<Moves>2</Moves>
			<Immobile>true</Immobile>
			<Range>10</Range>
			<Special>SPECIALUNIT_FIGHTER</Special>
			<CombatClass>UNITCOMBAT_BOMBER</CombatClass>
			<Domain>DOMAIN_AIR</Domain>
			<DefaultUnitAI>UNITAI_ATTACK_AIR</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_AMERICAN_TBF_AVENGER</Description>
			<Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_BOMBER_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_ADVANCED_HEAVY_FIGHTER_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_AMERICAN_TBF_AVENGER</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
			<Mechanized>true</Mechanized>
			<AdvancedStartCost>50</AdvancedStartCost>
			<AirUnitCap>1</AirUnitCap>
			<RangedCombatLimit>100</RangedCombatLimit>
			<CombatLimit>0</CombatLimit>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>2</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_AMERICAN_TBF_AVENGER</UnitArtInfo>
			<UnitFlagIconOffset>64</UnitFlagIconOffset>
			<IconAtlas>CIV_COLOR_UNIT_ATLAS_WWII</IconAtlas>
			<PortraitIndex>7</PortraitIndex>
			<MoveRate>AIR_REBASE</MoveRate>
		</Row>
	</Units>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<PromotionType>PROMOTION_AIR_RECON</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<PromotionType>PROMOTION_DIVE_BOMB</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<PromotionType>PROMOTION_TORPEDO_BOMB</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<PromotionType>PROMOTION_RANGED_DEFENSE_PENALTY</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<ResourceType>RESOURCE_OIL</ResourceType>
		</Row>
	</Unit_ResourceQuantityRequirements>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<UnitAIType>UNITAI_CARRIER_AIR</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<UnitAIType>UNITAI_ATTACK_AIR</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>14</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>12</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<FlavorType>FLAVOR_AIR</FlavorType>
			<Flavor>15</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_AMERICAN_TBF_AVENGER</UnitType>
			<FlavorType>FLAVOR_NAVAL</FlavorType>
			<Flavor>7</Flavor>
		</Row>
	</Unit_Flavors>
</GameData>

:confused:
 

Attachments

Do you have UNIT_FIGHTER_BOMBER defined? It's the default unit of the class, so it should exist.
 
Good question, and thanks for trying to help. I do have the default fighter-bomber defined. It hadn't occurred to me to verify it doesn't crash the game the same way, so I went in and tested it. I found that the default unit shows up fine in game. I also verified a few additional units that were very late in the tech tree while I was at it, and those show up with no crash as well.
Spoiler :
Code:
<Row>
			<Class>UNITCLASS_FIGHTER_BOMBER</Class>
			<Type>UNIT_FIGHTER_BOMBER</Type>
			<PrereqTech>TECH_LASERS</PrereqTech>
			<RangedCombat>40</RangedCombat>
			<Cost>300</Cost>
			<Moves>2</Moves>
			<Immobile>true</Immobile>
			<Range>5</Range>
			<Special>SPECIALUNIT_FIGHTER</Special>
			<CombatClass>UNITCOMBAT_BOMBER</CombatClass>
			<Domain>DOMAIN_AIR</Domain>
			<DefaultUnitAI>UNITAI_ATTACK_AIR</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_ADVANCED_HEAVY_FIGHTER</Description>
			<Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_BOMBER_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_ADVANCED_HEAVY_FIGHTER_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_ADVANCED_HEAVY_FIGHTER</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
			<Mechanized>true</Mechanized>
			<AdvancedStartCost>50</AdvancedStartCost>
			<AirUnitCap>1</AirUnitCap>
			<RangedCombatLimit>100</RangedCombatLimit>
			<CombatLimit>0</CombatLimit>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>2</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_FIGHTER_BOMBER</UnitArtInfo>
			<UnitFlagIconOffset>64</UnitFlagIconOffset>
			<IconAtlas>CIV_COLOR_UNIT_ATLAS_WWII</IconAtlas>
			<PortraitIndex>7</PortraitIndex>
			<MoveRate>AIR_REBASE</MoveRate>
		</Row>
Pretty much identical to the Avenger define I posted earlier, and yet one causes the game to crash. I would think the problem is with the promotion set I gave the Avenger, but I already tested a japanese torpedo bomber with the same promotions and it did not cause the game to crash.
 
I don't know why I didn't think to do it earlier, but I swapped out the art define for the avenger with another one and checked for the crash in game. Sure enough it now shows up fine. So, apparently the problem is with the art defines for it. Looks like it's basically solved then.
 
Back
Top Bottom