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

Crashes when building units I created

Discussion in 'Civ4 - Creation & Customization' started by Sturmgewher88mm, May 24, 2016.

  1. Sturmgewher88mm

    Sturmgewher88mm Kaiser

    Joined:
    Sep 28, 2013
    Messages:
    388
    Gender:
    Male
    Location:
    石川琉球
    Wasn't sure if I should post here or the bug forum. So I made a handful of units, and two specifically have been crashing the game. I have a Transport Helicopter and a Modern Privateer, and both have working graphics, animations, and are fully coded in the XML files. I can spawn them with the IGE and they work fine, but if I open the city production queue it crashes the game the instant I click on either of them. These are the only units I made that don't work. Here are all the files for the helo unit:
    Spoiler :
    <UnitInfo>
    <Class>UNITCLASS_TRANSPORT_HELICOPTER</Class>
    <Type>UNIT_TRANSPORT_HELICOPTER</Type>
    <UniqueNames/>
    <Special>NONE</Special>
    <Capture>NONE</Capture>
    <Combat>UNITCOMBAT_HELICOPTER</Combat>
    <Domain>DOMAIN_LAND</Domain>
    <DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
    <Invisible>NONE</Invisible>
    <SeeInvisible>NONE</SeeInvisible>
    <Description>TXT_KEY_UNIT_TRANSPORT_HELICOPTER</Description>
    <Civilopedia>TXT_KEY_UNIT_GUNSHIP_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_UNIT_GUNSHIP_STRATEGY</Strategy>
    <Advisor>ADVISOR_MILITARY</Advisor>
    <bAnimal>0</bAnimal>
    <bFood>0</bFood>
    <bNoBadGoodies>0</bNoBadGoodies>
    <bOnlyDefensive>1</bOnlyDefensive>
    <bNoCapture>1</bNoCapture>
    <bQuickCombat>0</bQuickCombat>
    <bRivalTerritory>0</bRivalTerritory>
    <bMilitaryHappiness>0</bMilitaryHappiness>
    <bMilitarySupport>1</bMilitarySupport>
    <bMilitaryProduction>1</bMilitaryProduction>
    <bPillage>1</bPillage>
    <bSpy>0</bSpy>
    <bSabotage>0</bSabotage>
    <bDestroy>0</bDestroy>
    <bStealPlans>0</bStealPlans>
    <bInvestigate>0</bInvestigate>
    <bCounterSpy>0</bCounterSpy>
    <bFound>0</bFound>
    <bGoldenAge>0</bGoldenAge>
    <bInvisible>0</bInvisible>
    <bFirstStrikeImmune>0</bFirstStrikeImmune>
    <bNoDefensiveBonus>1</bNoDefensiveBonus>
    <bIgnoreBuildingDefense>1</bIgnoreBuildingDefense>
    <bCanMoveImpassable>1</bCanMoveImpassable>
    <bCanMoveAllTerrain>0</bCanMoveAllTerrain>
    <bFlatMovementCost>0</bFlatMovementCost>
    <bIgnoreTerrainCost>1</bIgnoreTerrainCost>
    <bNukeImmune>0</bNukeImmune>
    <bPrereqBonuses>0</bPrereqBonuses>
    <bPrereqReligion>0</bPrereqReligion>
    <bMechanized>0</bMechanized>
    <bSuicide>0</bSuicide>
    <bHiddenNationality>0</bHiddenNationality>
    <bAlwaysHostile>0</bAlwaysHostile>
    <UnitClassUpgrades/>
    <UnitClassTargets/>
    <UnitCombatTargets/>
    <UnitClassDefenders/>
    <UnitCombatDefenders/>
    <FlankingStrikes/>
    <UnitAIs>
    <UnitAI>
    <UnitAIType>UNITAI_EXPLORE</UnitAIType>
    <bUnitAI>1</bUnitAI>
    </UnitAI>
    <UnitAI>
    <UnitAIType>UNITAI_SETTLER_SEA</UnitAIType>
    <bUnitAI>1</bUnitAI>
    </UnitAI>
    </UnitAIs>
    <NotUnitAIs/>
    <Builds/>
    <ReligionSpreads/>
    <CorporationSpreads/>
    <GreatPeoples/>
    <Buildings/>
    <ForceBuildings/>
    <HolyCity>NONE</HolyCity>
    <ReligionType>NONE</ReligionType>
    <StateReligion>NONE</StateReligion>
    <PrereqReligion>NONE</PrereqReligion>
    <PrereqCorporation>NONE</PrereqCorporation>
    <PrereqBuilding>NONE</PrereqBuilding>
    <PrereqTech>TECH_ADVANCED_FLIGHT</PrereqTech>
    <TechTypes/>
    <BonusType>NONE</BonusType>
    <PrereqBonuses>
    <BonusType>BONUS_OIL</BonusType>
    <BonusType>NONE</BonusType>
    <BonusType>NONE</BonusType>
    <BonusType>NONE</BonusType>
    </PrereqBonuses>
    <ProductionTraits/>
    <Flavors/>
    <iAIWeight>0</iAIWeight>
    <iCost>125</iCost>
    <iHurryCostModifier>0</iHurryCostModifier>
    <iAdvancedStartCost>100</iAdvancedStartCost>
    <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
    <iMinAreaSize>20</iMinAreaSize>
    <iMoves>5</iMoves>
    <bNoRevealMap>0</bNoRevealMap>
    <iAirRange>0</iAirRange>
    <iAirUnitCap>0</iAirUnitCap>
    <iDropRange>0</iDropRange>
    <iNukeRange>-1</iNukeRange>
    <iWorkRate>0</iWorkRate>
    <iBaseDiscover>0</iBaseDiscover>
    <iDiscoverMultiplier>0</iDiscoverMultiplier>
    <iBaseHurry>0</iBaseHurry>
    <iHurryMultiplier>0</iHurryMultiplier>
    <iBaseTrade>0</iBaseTrade>
    <iTradeMultiplier>0</iTradeMultiplier>
    <iGreatWorkCulture>0</iGreatWorkCulture>
    <iEspionagePoints>0</iEspionagePoints>
    <TerrainImpassables/>
    <FeatureImpassables/>
    <TerrainPassableTechs/>
    <FeaturePassableTechs/>
    <iCombat>16</iCombat>
    <iCombatLimit>100</iCombatLimit>
    <iAirCombat>0</iAirCombat>
    <iAirCombatLimit>0</iAirCombatLimit>
    <iXPValueAttack>4</iXPValueAttack>
    <iXPValueDefense>2</iXPValueDefense>
    <iFirstStrikes>0</iFirstStrikes>
    <iChanceFirstStrikes>0</iChanceFirstStrikes>
    <iInterceptionProbability>0</iInterceptionProbability>
    <iEvasionProbability>0</iEvasionProbability>
    <iWithdrawalProb>0</iWithdrawalProb>
    <iCollateralDamage>0</iCollateralDamage>
    <iCollateralDamageLimit>0</iCollateralDamageLimit>
    <iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
    <iCityAttack>0</iCityAttack>
    <iCityDefense>0</iCityDefense>
    <iAnimalCombat>0</iAnimalCombat>
    <iHillsAttack>0</iHillsAttack>
    <iHillsDefense>0</iHillsDefense>
    <TerrainNatives/>
    <FeatureNatives/>
    <TerrainAttacks/>
    <TerrainDefenses/>
    <FeatureAttacks/>
    <FeatureDefenses/>
    <UnitClassAttackMods/>
    <UnitClassDefenseMods/>
    <UnitCombatMods/>
    <UnitCombatCollateralImmunes/>
    <DomainMods/>
    <BonusProductionModifiers/>
    <iBombRate>0</iBombRate>
    <iBombardRate>0</iBombardRate>
    <SpecialCargo>NONE</SpecialCargo>
    <DomainCargo>DOMAIN_LAND</DomainCargo>
    <iCargo>3</iCargo>
    <iConscription>0</iConscription>
    <iCultureGarrison>0</iCultureGarrison>
    <iExtraCost>0</iExtraCost>
    <iAsset>4</iAsset>
    <iPower>6</iPower>
    <UnitMeshGroups>
    <iGroupSize>1</iGroupSize>
    <fMaxSpeed>2.25</fMaxSpeed>
    <fPadTime>1</fPadTime>
    <iMeleeWaveSize>1</iMeleeWaveSize>
    <iRangedWaveSize>1</iRangedWaveSize>
    <UnitMeshGroup>
    <iRequired>1</iRequired>
    <EarlyArtDefineTag>ART_DEF_UNIT_TRANSPORT_HELICOPTER</EarlyArtDefineTag>
    </UnitMeshGroup>
    </UnitMeshGroups>
    <FormationType>FORMATION_TYPE_MACHINE</FormationType>
    <HotKey/>
    <bAltDown>0</bAltDown>
    <bShiftDown>0</bShiftDown>
    <bCtrlDown>0</bCtrlDown>
    <iHotKeyPriority>0</iHotKeyPriority>
    <FreePromotions>
    <FreePromotion>
    <PromotionType>PROMOTION_MEDIC1</PromotionType>
    <bFreePromotion>1</bFreePromotion>
    </FreePromotion>
    </FreePromotions>
    <LeaderPromotion>NONE</LeaderPromotion>
    <iLeaderExperience>0</iLeaderExperience>
    </UnitInfo>

    Spoiler :
    <UnitClassInfo>
    <Type>UNITCLASS_TRANSPORT_HELICOPTER</Type>
    <Description>TXT_KEY_UNIT_TRANSPORT_HELICOPTER</Description>
    <iMaxGlobalInstances>-1</iMaxGlobalInstances>
    <iMaxTeamInstances>-1</iMaxTeamInstances>
    <iMaxPlayerInstances>-1</iMaxPlayerInstances>
    <iInstanceCostModifier>0</iInstanceCostModifier>
    <DefaultUnit>UNIT_TRANSPORT_HELICOPTER</DefaultUnit>
    </UnitClassInfo>

    Spoiler :
    <UnitArtInfo>
    <Type>ART_DEF_UNIT_TRANSPORT_HELICOPTER</Type>
    <Button>,Art/Interface/Buttons/Units/Helo.dds</Button>
    <fScale>0.36</fScale>
    <fInterfaceScale>0.7</fInterfaceScale>
    <bActAsLand>0</bActAsLand>
    <bActAsAir>0</bActAsAir>
    <NIF>Art/Units/Helo/chinookyelow.nif</NIF>
    <KFM>Art/Units/Gunship/GunShip.kfm</KFM>
    <SHADERNIF>Art/Units/Helo/chinookyelow.nif</SHADERNIF>
    <ShadowDef>
    <ShadowNIF>Art/Units/01_UnitShadows/GunshipShadow.nif</ShadowNIF>
    <ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
    <fShadowScale>0.75</fShadowScale>
    </ShadowDef>
    <iDamageStates>4</iDamageStates>
    <fBattleDistance>0.5</fBattleDistance>
    <fRangedDeathTime>0.12</fRangedDeathTime>
    <bActAsRanged>1</bActAsRanged>
    <TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
    <AudioRunSounds>
    <AudioRunTypeLoop>LOOPSTEP_GUNSHIP</AudioRunTypeLoop>
    <AudioRunTypeEnd>ENDSTEP_GUNSHIP</AudioRunTypeEnd>
    </AudioRunSounds>
    <SelectionSound>AS3D_UN_GUNSHIP_FORT</SelectionSound>
    <ActionSound>AS3D_UN_GUNSHIP_FORT</ActionSound>
    </UnitArtInfo>

    I have no clue what could be wrong :confused:

    Moderator Action: Moved to the main forum as that is where questions belong. Good luck.
     
  2. SaibotLieh

    SaibotLieh Emperor

    Joined:
    Sep 25, 2009
    Messages:
    1,520
    You need to remove the comma from this line:
    Code:
    <Button>,Art/Interface/Buttons/Units/Helo.dds</Button>
    We all made this error at least once. :)
     
  3. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,544
    Gender:
    Male
    Location:
    Canberra, Australia
    The other possibility is that the buttons for the units are not exactly 64x64 pixels is size. If they are not that size the crash happens when the exe tries to display it in the city bar when the unit comes to the top of the build queue.
     
  4. Sturmgewher88mm

    Sturmgewher88mm Kaiser

    Joined:
    Sep 28, 2013
    Messages:
    388
    Gender:
    Male
    Location:
    石川琉球
    I just checked them, all buttons are exactly 64x64 pixels.

    I read this and then looked at the code, and all of the <Button> tags in the CIV4ArtDefinesUnit.xml have the comma at the beginning :confused:
    I'll go ahead and remove them from my units and report what happens.
     
  5. SaibotLieh

    SaibotLieh Emperor

    Joined:
    Sep 25, 2009
    Messages:
    1,520
    Yeah, that is in fact the confusing part. A definition like this is fine:
    Code:
    <Button>,Art/Interface/Buttons/Units/Lion.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,6,5</Button>
    while this would lead to the problems you had:
    Code:
    <Button>,Art/Interface/Buttons/Units/Lion.dds</Button>
    and this is how it works again:
    Code:
    <Button>Art/Interface/Buttons/Units/Lion.dds</Button>
    Not completely sure what the comma is for, but my guess is that it is somehow necessary if you have more than one path to a dds file in the button definition.
     
  6. vincentz

    vincentz Programmer

    Joined:
    Feb 4, 2009
    Messages:
    3,556
    Gender:
    Male
    Location:
    Denmark
    the comma is (iirc) for separating icons and atlas (a collection of icons in a single image). The later requires the position of the icon used (3,5 f.ex)
     
  7. Sturmgewher88mm

    Sturmgewher88mm Kaiser

    Joined:
    Sep 28, 2013
    Messages:
    388
    Gender:
    Male
    Location:
    石川琉球
    SaibotLieh, it works now! Thanks everyone for the help :thanx:
     
  8. SaibotLieh

    SaibotLieh Emperor

    Joined:
    Sep 25, 2009
    Messages:
    1,520
    No problem. Good to know that it works for you now. :)
     

Share This Page