Model crashing game.

NovaSilisko

Chieftain
Joined
Jan 18, 2010
Messages
69
(Forgive me if this is the wrong section/a stupid question <_<)

So I attempted to make a completely custom unit, model, texture and all, and failed miserably. Specifically, as the title suggests, my unit model is CTD-ing the game as soon as the game attempts to load it.

Just wish to know what sorts of things could cause this to happen, considering my Navy SEAL edit with a custom weapon model on him worked fine and this doesn't.

If there is any information you want me to add that would help, say so.
 
Check the string you have set for the unit's art defines entry, and verify that's what you actually have in the ArtDefinesUnit file. That's almost always the cause of a crash while initializing the XML when adding something new to the game.
 
It wasn't when loading the XML. It was when I placed the unit in WB to test it.
 
Check the string you have set for the unit's art defines entry, and verify that's what you actually have in the ArtDefinesUnit file. That's almost always the cause of a crash while initializing the XML when adding something new to the game.

It wasn't when loading the XML. It was when I placed the unit in WB to test it.

Yeah, he's basically saying that same thing. When you have in the ArtDefines, say something like ART_DEF_UNIT_MY_UNIT and then in the ArtStyles something like ART_DEF_UNIT_MYUNIT you might get an error like this. That's normally the cause for something like this.
 
If this is an ethnic unit, it is usually the same issue, ie the string you have set in UnitArtStyleTypeInfos isn't pointing toward an existing string in the ArtDefinesUnit file. If it's not an ethnic unit, run a debug dl (extract it and place it in the assets folder of your mod, this will only work if your mod doesn't have SDK modifications, as this debug dll is for straight 3.19 with 50 civs), and see what error message you get. A 50 civ debug dll for BtS 3.19 can be found here:

http://www.filefront.com/14170947/3.19-50Civ-Debug.zip/
 
Ok, downloading the Debug DLL.

And, I've triplechecked the XML, and it seems to be fine. I think the problem is my lack of experience with NIF files.

Edit: I don't know if I'm able to use the debug DLL since I'm running the steam version...I'll give it a shot though.
 
In my experience bad art rarely breaks the game by iself, it will just look messed up and throw all sorts of python errors. Though it can happen. What happens when you try to look at the unit in the civilopedia?
 
I actually haven't tried...I feel dumb for not doing so. Will do that now.

Edit: The CP entry appears blank.

Edit2: The debug dll crashes the game, too, but when it's loading a map.

Edit3: Changed to the gunship art def and it doesn't crash, so It's not the unit itself.
 
The debug dll is a 50 civ dll, you need to start a new map (or be loading a map that was created using a 50 civ dll). Sorry if this wasn't clear.

I don't understand what your edit point #3 is saying. So I don't know how to reply. Like I said before this is generally caused by having the string you're pointing to not exist in the ArtDefinesUnit file. If you think it might be the art itself, use a different nif in your ArtDefinesUnit file and see if it still crashes. Also if the unit uses a custom button, ensure the button doesn't have a comma in it (unless the button is in an atlas). Bad buttons though shouldn't cause a crash from WB, they cause crashes when hitting the button in the city screen (AI or human player).
 
1. Oh.

2. The art def is there, as I said before. I triplechecked the connection between the 2 and it's good.

Going to go try the DLL again.

(Another question: Is there a way to make new "Invisible" parameters instead of having to use an existing one?)


Edit: It still crashes in the debug DLL, no assert message or anything.
 
Yep invisibleInfos found in the XML\BasicInfos folder. It's really easy making a new invisibility type.

Could you show your XML that you have for your unit? Remember to put it in code tags. [code]XML goes in here[/code]
 
Unit Def:
Code:
	<UnitInfo>
			<Class>UNITCLASS_RECON</Class>
			<Type>UNIT_RECON</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>NONE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
			<Invisible>INVISIBLE_RECON</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>Recon Plane</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>0</bOnlyDefensive>
			<bNoCapture>1</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>1</bRivalTerritory>
			<bMilitaryHappiness>0</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>0</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>1</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>1</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>1</bMechanized>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>1</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<UnitClassUpgrades/>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes/>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_EXPLORE</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_COMPUTERS</PrereqTech>
			<TechTypes>
				<PrereqTech>TECH_FLIGHT</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
			</TechTypes>
			<BonusType>BONUS_ALUMINUM</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>150</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>80</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>8</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>0</iCombat>
			<iCombatLimit>0</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>0</iXPValueAttack>
			<iXPValueDefense>0</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>0</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>100</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>8</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>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>10</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>4</iAsset>
			<iPower>26</iPower>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>1</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_RECON</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_SENTRY</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
			</FreePromotions>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>
Art Def:
Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_RECON</Type>
			<Button>Modules/ReconPlane/icon.dds,</Button>
			<fScale>0.36</fScale>
			<fInterfaceScale>0.7</fInterfaceScale>
			<bActAsLand>0</bActAsLand>
			<bActAsAir>0</bActAsAir>
			<NIF>Modules/ReconPlane/reconplane.nif</NIF>
			<KFM>Modules/ReconPlane/reconplane.kfm</KFM>
			<SHADERNIF>Modules/ReconPlane/reconplane_FX.nif</SHADERNIF>
			<ShadowDef>
				<ShadowNIF>Art/Units/01_UnitShadows/GunshipShadow.nif</ShadowNIF>
				<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
				<fShadowScale>0.75</fShadowScale>
			</ShadowDef>
			<fBattleDistance>0.5</fBattleDistance>
			<fRangedDeathTime>0.12</fRangedDeathTime>
			<bActAsRanged>0</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>


Before you ask, I -have- made the unitclass code.
 
You created a new unitclass for this unit, rather then making it a UU. Where is the UnitClassInfos?

Edit: Also don't use NONE for unit combat type for units that have a combat strength. That's not the cause of your crash, but it can cause crashes later on. It would make sense to give it a UNITCOMBAT_RECON like the scout and explore.
-Nevermind I see it's iCombat is zero, so NONE will be fine. Though if you want the AI to use it you should probably give it a strength value.


Edit2: Also UNIT_RECON is a bad choice as it's very simliar to UNITCOMBAT_RECON, I'd use something else like UNIT_HELISCOUT or something dissimilar from other existant strings. This isn't a big deal but will help later on if you keep modding.
 
Forgive me if I'm doing it wrong but the unit is made for all civs, and from my limited understanding of how the units work I need to make a new class for it.
Here's the UnitClassInfos anyway:
Code:
		<UnitClassInfo>
			<Type>UNITCLASS_RECON</Type>
			<Description>Recon Plane</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_RECON</DefaultUnit>
		</UnitClassInfo>

And I already changed the "NONE" in combat.
 
<Button>Modules/ReconPlane/icon.dds,</Button>

Remove that comma
 
Well it still crashes. Really, the only other thing I can think of that could be wrong is something with the NIF file.
 
Yeah, try changing the shadernif and nif entry to something you know works. Also while testing get rid of the invisible type, keep that as NONE for now. Other then that comma (which would have caused a crash when you or the AI tried to build it, but shouldn't in WB) I can't see anything wrong with your XML though :dunno:
 
Changed the shadernif to the gunship and it works perfect. I guess the only thing I can do now is to upload my nifs and have an expert diagnose them, eh?
 
Yeap, that means the nifs are messed up, you'll need to have an artist fix them.
 
Back
Top Bottom