Created new building - crashes when i try to build it

thehiredgun

Chieftain
Joined
Jun 28, 2011
Messages
14
Location
Los Gatos, CA
First post - first mod and I need some help.

I've created a new building called inukshuk based on woodelf's graphic improvement:
http://forums.civfanatics.com/downloads.php?do=file&id=8103

Shows up in civpedia fine. Shows up in tech tree fine.

ISSUE
Crashes client the second I click on the inuksuk icon (to build it) in the city production window.

QUESTIONS
What could be causing this crash?
Seems like the way I'm calling the art might be a problem - do I need to add an entry for this building in CIV4CityLSystem.xml?

How do you determine what LSystem to use for a building? I'm just guessing based on the dimension of the building geo.

DETAILS
I've added the art (Inuksuk.nif, stonemanshadow.dds, variedstone.dds) to
/Assets/Art/Structures/Buildings/Inuksuk/

I've added a button (inuksuk.dds) to
/Assets/Art/Interface/Buttons/Buildings/

I've added an entry to CIV4ArtDefines_Building.xml

Code:
	<BuildingArtInfo>
		<Type>ART_DEF_BUILDING_INUKSUK</Type>
		<LSystem>LSYSTEM_2x1</LSystem>
		<bAnimated>0</bAnimated>
		<fScale>1.00</fScale>
		<fInterfaceScale>0.40</fInterfaceScale>
		<NIF>Art/Structures/Buildings/Inuksuk/Inuksuk.nif</NIF>
		<KFM/>
		<Button>,Art/Interface/Buttons/Buildings/Inuksuk.dds</Button>
	</BuildingArtInfo>

I've added an entry to CIV4BuildingInfos.xml

Code:
		<BuildingInfo>
			<BuildingClass>BUILDINGCLASS_INUKSUK</BuildingClass>
			<Type>BUILDING_INUKSUK</Type>
			<SpecialBuildingType>NONE</SpecialBuildingType>
			<Description>TXT_KEY_BUILDING_INUKSUK</Description>
			<Civilopedia>TXT_KEY_BUILDING_INUKSUK_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_INUKSUK_STRATEGY</Strategy>
			<Advisor>ADVISOR_ECONOMY</Advisor>
			<ArtDefineTag>ART_DEF_BUILDING_INUKSUK</ArtDefineTag>
			<MovieDefineTag>NONE</MovieDefineTag>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<bStateReligion>0</bStateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<FoundsCorporation>NONE</FoundsCorporation>
			<GlobalReligionCommerce>NONE</GlobalReligionCommerce>
			<GlobalCorporationCommerce>NONE</GlobalCorporationCommerce>
			<VictoryPrereq>NONE</VictoryPrereq>
			<FreeStartEra>NONE</FreeStartEra>
			<MaxStartEra>NONE</MaxStartEra>
			<ObsoleteTech>TECH_METAL_CASTING</ObsoleteTech>
			<PrereqTech>TECH_MEGALITHS</PrereqTech>
			<TechTypes/>
			<Bonus>NONE</Bonus>
			<PrereqBonuses/>
			<ProductionTraits>
				<ProductionTrait>
					<ProductionTraitType>TRAIT_INDUSTRIOUS</ProductionTraitType>
					<iProductionTrait>50</iProductionTrait>
				</ProductionTrait>
			</ProductionTraits>
			<HappinessTraits/>
			<NoBonus>NONE</NoBonus>
			<PowerBonus>NONE</PowerBonus>
			<FreeBonus>NONE</FreeBonus>
			<iNumFreeBonuses>0</iNumFreeBonuses>
			<FreeBuilding>NONE</FreeBuilding>
			<FreePromotion>NONE</FreePromotion>
			<CivicOption>NONE</CivicOption>
			<GreatPeopleUnitClass>NONE</GreatPeopleUnitClass>
			<iGreatPeopleRateChange>0</iGreatPeopleRateChange>
			<iHurryAngerModifier>0</iHurryAngerModifier>
			<bBorderObstacle>0</bBorderObstacle>
			<bTeamShare>0</bTeamShare>
			<bWater>0</bWater>
			<bRiver>0</bRiver>
			<bPower>0</bPower>
			<bDirtyPower>0</bDirtyPower>
			<bAreaCleanPower>0</bAreaCleanPower>
			<DiploVoteType>NONE</DiploVoteType>
			<bForceTeamVoteEligible>0</bForceTeamVoteEligible>
			<bCapital>0</bCapital>
			<bGovernmentCenter>0</bGovernmentCenter>
			<bGoldenAge>0</bGoldenAge>
			<bAllowsNukes>0</bAllowsNukes>
			<bMapCentering>0</bMapCentering>
			<bNoUnhappiness>0</bNoUnhappiness>
			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
			<bNeverCapture>0</bNeverCapture>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqReligion>0</bPrereqReligion>
			<bCenterInCity>0</bCenterInCity>
			<iAIWeight>0</iAIWeight>
			<iCost>40</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>40</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iConquestProb>66</iConquestProb>
			<iCitiesPrereq>0</iCitiesPrereq>
			<iTeamsPrereq>0</iTeamsPrereq>
			<iLevelPrereq>0</iLevelPrereq>
			<iMinLatitude>0</iMinLatitude>
			<iMaxLatitude>90</iMaxLatitude>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
			<iAnarchyModifier>0</iAnarchyModifier>
			<iGoldenAgeModifier>0</iGoldenAgeModifier>
			<iGlobalHurryModifier>0</iGlobalHurryModifier>
			<iExperience>0</iExperience>
			<iGlobalExperience>0</iGlobalExperience>
			<iFoodKept>0</iFoodKept>
			<iAirlift>0</iAirlift>
			<iAirModifier>0</iAirModifier>
			<iAirUnitCapacity>0</iAirUnitCapacity>
			<iNukeModifier>0</iNukeModifier>
			<iNukeExplosionRand>0</iNukeExplosionRand>
			<iFreeSpecialist>0</iFreeSpecialist>
			<iAreaFreeSpecialist>0</iAreaFreeSpecialist>
			<iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
			<iMaintenanceModifier>0</iMaintenanceModifier>
			<iWarWearinessModifier>0</iWarWearinessModifier>
			<iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
			<iEnemyWarWearinessModifier>0</iEnemyWarWearinessModifier>
			<iHealRateChange>0</iHealRateChange>
			<iHealth>0</iHealth>
			<iAreaHealth>0</iAreaHealth>
			<iGlobalHealth>0</iGlobalHealth>
			<iHappiness>0</iHappiness>
			<iAreaHappiness>0</iAreaHappiness>
			<iGlobalHappiness>0</iGlobalHappiness>
			<iStateReligionHappiness>0</iStateReligionHappiness>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<iSpaceProductionModifier>0</iSpaceProductionModifier>
			<iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iCoastalTradeRoutes>0</iCoastalTradeRoutes>
			<iGlobalTradeRoutes>0</iGlobalTradeRoutes>
			<iTradeRouteModifier>0</iTradeRouteModifier>
			<iForeignTradeRouteModifier>0</iForeignTradeRouteModifier>
			<iGlobalPopulationChange>0</iGlobalPopulationChange>
			<iFreeTechs>0</iFreeTechs>
			<iDefense>0</iDefense>
			<iBombardDefense>0</iBombardDefense>
			<iAllCityDefense>0</iAllCityDefense>
			<iEspionageDefense>0</iEspionageDefense>
			<iAsset>2</iAsset>
			<iPower>1</iPower>
			<fVisibilityPriority>1.0</fVisibilityPriority>
			<SeaPlotYieldChanges/>
			<RiverPlotYieldChanges/>
			<GlobalSeaPlotYieldChanges/>
			<YieldChanges/>
			<YieldModifiers>
				<iYield>0</iYield>
				<iYield>10</iYield>
				<iYield>0</iYield>
			</YieldModifiers>
			<CommerceChanges/>
			<ObsoleteSafeCommerceChanges/>
			<CommerceChangeDoubleTimes/>
			<CommerceModifiers/>
			<GlobalCommerceModifiers/>
			<SpecialistExtraCommerces/>
			<StateReligionCommerces/>
			<CommerceHappinesses/>
			<ReligionChanges/>
			<SpecialistCounts>
				<SpecialistCount>
					<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
					<iSpecialistCount>1</iSpecialistCount>
				</SpecialistCount>
			</SpecialistCounts>
			<FreeSpecialistCounts/>
			<CommerceFlexibles/>
			<CommerceChangeOriginalOwners/>
			<ConstructSound>AS2D_BUILD_FORGE</ConstructSound>
			<BonusHealthChanges/>
			<BonusHappinessChanges>
				<BonusHappinessChange>
					<BonusType>BONUS_STONE</BonusType>
					<iHappinessChange>1</iHappinessChange>
				</BonusHappinessChange>
			</BonusHappinessChanges>
			<BonusProductionModifiers>
				<BonusProductionModifier>
					<BonusType>BONUS_STONE</BonusType>
					<iProductonModifier>100</iProductonModifier>
				</BonusProductionModifier>
			</BonusProductionModifiers>
			<UnitCombatFreeExperiences/>
			<DomainFreeExperiences/>
			<DomainProductionModifiers/>
			<BuildingHappinessChanges/>
			<PrereqBuildingClasses/>
			<BuildingClassNeededs/>
			<SpecialistYieldChanges/>
			<BonusYieldModifiers/>
			<ImprovementFreeSpecialists/>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_PRODUCTION</FlavorType>
					<iFlavor>10</iFlavor>
				</Flavor>
			</Flavors>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
		</BuildingInfo>

and I've added an entry to CIV4BuildingClassInfo.xml

Code:
		<BuildingClassInfo>
			<Type>BUILDINGCLASS_INUKSUK</Type>
			<Description>TXT_KEY_BUILDING_INUKSUK</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iExtraPlayerInstances>0</iExtraPlayerInstances>
			<bNoLimit>0</bNoLimit>
			<bMonument>0</bMonument>
			<DefaultBuilding>BUILDING_INUKSUK</DefaultBuilding>
			<VictoryThresholds/>
		</BuildingClassInfo>

I've added TXT_KEYs to CIV4GameText_Civilopedia_BuildingsProjects.xml, CIV4GameTextInfos_Objects.xml.

I've added my prereq techs and such.
 
Welcome to CFC :).


The problem is here:
PHP:
<Button>,Art/Interface/Buttons/Buildings/Inuksuk.dds</Button>

The comma at the beginning brings the game to crash. Remove it, and everything should be fine (if the size of the button is not more than 64*64, else it will still crash).

No idea why the comma does what it does, but it does it :dunno:. It's one of the most occuring problems for new modders, and we have no idea what causes it.
 
The mystery, it seems, is why new modders are putting the comma in there to begin with...
 
You need the leading comma if the button is in an atlas. But in that case you also need the atlas' path + name and the two integers that specify which button in the atlas to use, all separated by more commas.

The crash is presumably because it sees the leading comma and says to itself "this button is in an atlas, so I'll go look it up". It then opens up the specified atlas. Except there isn't one. No atlas was specified so it is using a null pointer instead of a valid file name, which makes it crash. Or something along those lines.

Correct (button in an atlas):
Code:
<Button>,Art/Interface/Buttons/Buildings/Palace.dds,Art/Interface/Buttons/Buildings_Atlas.dds,6,5</Button>
Also correct (button not in an atlas):
Code:
<Button>Art/Interface/Buttons/Buildings/Palace.dds</Button>
NOT correct (just plain wrong):
Code:
<Button>,Art/Interface/Buttons/Buildings/Palace.dds</Button>
 
Thank you for the prompt replies.

The reason for the comma is that I'm following tutorials on the site where they mention to copy and paste but I had yet to see someone mention removing the initial comma if you copy a previous entry and remove the Atlas entry after the .dds file path.

Cheers!
 
Code:
<Button>,[B]Art/Interface/Buttons/Buildings/Palace.dds[/B],Art/Interface/Buttons/Buildings_Atlas.dds,6,5</Button>

If the game takes the art from the atlas, why does it need the other image file specified?
 
If the game takes the art from the atlas, why does it need the other image file specified?

I seem to recall reading somewhere that the vanilla game draws from different sources for the "big" version of the button (in the city build list and in the Pedia) and the "small" version (the ones you see when you click on a stack of units). If that's accurate, then my speculation is that the distinction between the two versions became unnecessary with Warlords or BtS. But that's just speculation on my part; I haven't once used the comma, I point each button to a single file, and it's given me no problems so far--no apparent need to fuss with the atlas.
 
If the game takes the art from the atlas, why does it need the other image file specified?

I guess that might be for easier working.
So that you don't have to redo the whole atlas if you only want to add one other button.
But that's just my guess, and i think Herostratus is also right.
 
Top Bottom