Unit Problems

PPQ_Purple

Purple Cube (retired)
Joined
Oct 11, 2008
Messages
5,764
I have a most unusual situation. I have a model that works. I can build the unit in game and it has a model and everything. When I use it in the game to fight stuff the animation works as well. I get no error messages. But when I look the unit up in the pedia it does not show up. The entire right side of the screen where the model should be is just blank.

Spoiler :
PPQUnitProblem1.PNG


Furthermore, the unit does not show up in the game interface (the bottom toolbar) when selected or selected for construction. Once more, the area is just blank.

The unit is the Chinese Spearman from VD. So I know that the model is not bugged. Can anyone help me ID what I could be doing wrong.


CIV4UnitInfos.xml
Spoiler :
<UnitInfo> <!-- PPQ Axeman -->
<Class>UNITCLASS_AXEMAN</Class>
<Type>UNIT_PPQ_AXEMAN</Type>
<Combat>UNITCOMBAT_MELEE</Combat>
<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
<Description>TXT_KEY_UNIT_PPQ_AXEMAN</Description>
<Civilopedia>TXT_KEY_UNIT_PPQ_AXEMAN_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_PPQ_AXEMAN_STRATEGY</Strategy>
<Advisor>ADVISOR_MILITARY</Advisor>
<bMilitaryHappiness>1</bMilitaryHappiness>
<bMilitarySupport>1</bMilitarySupport>
<bMilitaryProduction>1</bMilitaryProduction>
<bPillage>1</bPillage>
<UnitClassUpgrades>
<UnitClassUpgradeType>UNITCLASS_CHAMPION</UnitClassUpgradeType>
</UnitClassUpgrades>
<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_CITY_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>
<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
<iCost>60</iCost>
<iMoves>1</iMoves>
<iCombat>4</iCombat>
<iCityAttack>10</iCityAttack>
<UnitClassAttackMods>
<UnitClassAttackMod>
<UnitClassType>UNITCLASS_WARRIOR</UnitClassType>
<iUnitClassMod>25</iUnitClassMod>
</UnitClassAttackMod>
</UnitClassAttackMods>
<BonusProductionModifiers>
<BonusProductionModifier>
<BonusType>BONUS_WHEAT</BonusType>
<iProductonModifier>10</iProductonModifier>
</BonusProductionModifier>
<BonusProductionModifier>
<BonusType>BONUS_CORN</BonusType>
<iProductonModifier>10</iProductonModifier>
</BonusProductionModifier>
</BonusProductionModifiers>
<iConscription>2</iConscription>
<iCultureGarrison>4</iCultureGarrison>
<iAsset>4</iAsset>
<UnitMeshGroups>
<iGroupSize>3</iGroupSize>
<iMeleeWaveSize>3</iMeleeWaveSize>
<iRangedWaveSize>0</iRangedWaveSize>
<UnitMeshGroup>
<iRequired>1</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_PPQ_AXEMAN</EarlyArtDefineTag>
</UnitMeshGroup>
<UnitMeshGroup>
<iRequired>1</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_PPQ_AXEMAN</EarlyArtDefineTag>
</UnitMeshGroup>
<UnitMeshGroup>
<iRequired>1</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_PPQ_AXEMAN</EarlyArtDefineTag>
</UnitMeshGroup>
</UnitMeshGroups>
<iTier>2</iTier>
<PrereqBuildingClass>BUILDINGCLASS_BARRACKS</PrereqBuildingClass>
</UnitInfo>


CIV4ArtDefines_Unit.xml
Spoiler :
<UnitArtInfo>
<Type>ART_DEF_UNIT_PPQ_AXEMAN</Type>
<Button>,Art/Interface/Buttons/Units/Spearman.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,4,6</Button>
<fScale>0.44</fScale>
<fInterfaceScale>1.0</fInterfaceScale>
<bActAsLand>0</bActAsLand>
<bActAsAir>0</bActAsAir>
<NIF>Modules/NormalModules/PPQ/Art/Units/Axeman/spearman.nif</NIF>
<KFM>Modules/NormalModules/PPQ/Art/Units/Axeman/Spearman_Chinese.kfm</KFM>
<SHADERNIF>Modules/NormalModules/PPQ/Art/Units/Axeman/spearman_fx.nif</SHADERNIF>
<ShadowDef>
<ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>
<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
<fShadowScale>1.0</fShadowScale>
</ShadowDef>
<fBattleDistance>0.35</fBattleDistance>
<fRangedDeathTime>0.31</fRangedDeathTime>
<bActAsRanged>0</bActAsRanged>
<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
<AudioRunSounds>
<AudioRunTypeLoop/>
<AudioRunTypeEnd/>
</AudioRunSounds>
</UnitArtInfo>


Note I am modding FFH so any unfamiliar tags are from there.
 
Just a wild guess: since both displays (pedia & interface) are coded in Python and probably heavily modified by the mod, maybe the path is not accepted (or the module not read for this specific task).

Also, are there no special NIF & SHADERNIF for the model?
 
I did some random jabbing and made it work by using the default spearman animations instead of the ones provided by VD. Apparently there is some bug in those that does not mesh well with FFH.
 
And I have a new problem. Does anyone have any idea why a unit might appear much darker in game than it does in nifscope? I animated a unit to use a rather bright texture but in game the entire thing is darkened so that gray becomes black. Simply put, the effect is as if someone took a black filter and laid it over the unit. I have messed around with gloss maps, but they do nothing to alleviate the issue.
 
Regarding your first problem: the folder with animations that you use for the unit should have its default .nif files as well. My guess is that you had a .kfm and all the .kf files there, but not nif.

Regarding your current problem: this is due to materials settings. Civ 4 render engine treats darker materials much more intensely than, for example, Nifskope renderer. Since this means you can't view your unit in Nifskope the way it'll look in game, I always set unit/building materials' ambient and diffuse color to be white in the nif file, then Civ 4 engine doesn't darken them.
 
Regarding your first problem: the folder with animations that you use for the unit should have its default .nif files as well. My guess is that you had a .kfm and all the .kf files there, but not nif.
It's a model from VD that uses the default Chinese Archer animation. But the error cleared it self up after I messed randomly with the XML.

Regarding your current problem: this is due to materials settings. Civ 4 render engine treats darker materials much more intensely than, for example, Nifskope renderer. Since this means you can't view your unit in Nifskope the way it'll look in game, I always set unit/building materials' ambient and diffuse color to be white in the nif file, then Civ 4 engine doesn't darken them.
Thanks. But I am not quite sure how to do that. I know how to adjust the nifscope rendered but not how to adjust the model it self. Here is the unit in question btw.
 

Attachments

In your particular case, the body of the unit didn't even have a material property specified! Compare this fixed nif (namely, the body) to the original one, and you'll see the difference. I didn't test it in game, but I guess it should be fixed now.
 

Attachments

In your particular case, the body of the unit didn't even have a material property specified! Compare this fixed nif (namely, the body) to the original one, and you'll see the difference. I didn't test it in game, but I guess it should be fixed now.
Thanks. I would have newer known how to do that. I am good with kitbashing units in nifscope and using paint.net to texture then. But the whole node modification thing is beyond me. For the record, how did you make one? Is there a tutorial or something online I could look up?


Also, there is one slight issue with the way the unit renders in game...

Newer mind. I found that the new material property had it's alpha set to 0. I set it to 1 and now it renders right. Great job overall! You are definitively going into my credits.
 

Attachments

  • Commander.JPG
    Commander.JPG
    19.4 KB · Views: 60
To add a new property (including material), you simply right-click on NiTriShape in NifSkope and choose Node->Attach Property. Some other useful properties you can add are Alpha, Stencil, Texturing (if for some reason it's missing) etc.
 
Back
Top Bottom