A problem with using a custom unit member in a mod.

The Tollan

Prince
Joined
Oct 29, 2005
Messages
418
I have encountered a problem with a mod that I have been working on. With whoward69's help I have progressed to a stage in which I am trying to add a new unit member type to the game and then incorporate it into an existing unit from Civilization V.

I have uploaded a copy of the mod for reference. The artwork on the .dds is not complete and not detailed since it is mainly for testing purposes. The objective of this mod is to place a new unit member, basically a reskinned Paratrooper, into the database and then include four of these in the Mechanized Infantry unit formation (cutting the number of vehicles to two).

The mod has two xml files within a folder called UnitArt. These files are: MechanizedInfantryNewArtDefines.xml and Civ5ArtDefines_UnitMembers.xml. It also has modernsoldier.fxsxml and modernsoldier_diff.dds. I have not put a gr2 or _sref.dds file into the mod as of yet. This fxsxml file is exactly like the paratrooper.fxsxml version except that it set to use modernsoldier_diff.dds instead of Paratrooper_diff.dds.

The MechanizedInfantryNewArtDefines.xml, that changes the unit members of the Mechanized Infantry unit, functions properly when it is set to include only Mechanized Infantry and Paratrooper unit members.

The problem is that once I change the Paratrooper unit members to a member type not already in the game (in this case a new Modernsoldier member) then these unit members do not display in game (but the rest of the formation does appear).

This is the xml I used for the unit member (it appears at the end of the Civ5ArtDefines_UnitMembers.xml file):

Code:
<UnitMemberArtInfo>
		<Type>ART_DEF_UNIT_MEMBER_MODERNSOLDIER</Type>
		<fScale>0.14</fScale>
		<Granny>modernsoldier.fxsxml</Granny>
		<Combat>
			<Defaults>ART_DEF_TEMPLATE_SOLDIER</Defaults>
			<bReformBeforeCombat>1</bReformBeforeCombat>
			<bHasShortRangedAttack>1</bHasShortRangedAttack>
			<Weapon>
				<WeaponTypeTag>BULLET</WeaponTypeTag>
				<WeaponTypeSoundOverrideTag>BULLET</WeaponTypeSoundOverrideTag>
			</Weapon>
		</Combat>
		<MaterialTypeTag>CLOTH</MaterialTypeTag>
		<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
	</UnitMemberArtInfo>

The Mechanized Infantry unit displays two of MI vehicles while the four Modernsoldier members are either lacking appearance or absent. I have tried several things to resolve whatever is causing the problem, but have not yet determined what exactly what is causing it. I have tried a few different versions of the Civ5ArtDefines_UnitMembers.xml. I have the mod activated in the game during each test.

I noticed that this problem occurs even when I set the modern soldier unit member's granny as <Granny>Assets/Units/Paratrooper/Paratrooper.fxsxml</Granny>. This seems to indicate that the immediate problem preceeds the fxsxml and dds files and is connected to the Modernsoldier unit member not being incorporated into the game properly.

The "Modernsoldier" is only a unit member and not a unit itself so I did not add an SQL file.

I have set true for import into VFS on all the files within the mod except for MechanizedInfantryNewArtDefines.xml The MechanizedInfantryNewArtDefines.xml and the Civ5ArtDefines_UnitMembers.xml are both set to be loaded into the database upon mod activation.
 

Attachments

Like everything else related to unit art, all updates/additions are done to database tables and NOT the Civ5ArtDefines_{XYZ}.xml files. In this case you need to add entries to the <ArtDefine_UnitMemberCombats> and <ArtDefine_UnitMemberCombatWeapons> tables.

Download a copy of Salac's Tiny Death Robots mod and follow the patterens in that.
 
I have encountered a problem with a mod that I have been working on. With whoward69's help I have progressed to a stage in which I am trying to add a new unit member type to the game and then incorporate it into an existing unit from Civilization V.

I have uploaded a copy of the mod for reference. The artwork on the .dds is not complete and not detailed since it is mainly for testing purposes. The objective of this mod is to place a new unit member, basically a reskinned Paratrooper, into the database and then include four of these in the Mechanized Infantry unit formation (cutting the number of vehicles to two).

The mod has two xml files within a folder called UnitArt. These files are: MechanizedInfantryNewArtDefines.xml and Civ5ArtDefines_UnitMembers.xml. It also has modernsoldier.fxsxml and modernsoldier_diff.dds. I have not put a gr2 or _sref.dds file into the mod as of yet. This fxsxml file is exactly like the paratrooper.fxsxml version except that it set to use modernsoldier_diff.dds instead of Paratrooper_diff.dds.

The MechanizedInfantryNewArtDefines.xml, that changes the unit members of the Mechanized Infantry unit, functions properly when it is set to include only Mechanized Infantry and Paratrooper unit members.

The problem is that once I change the Paratrooper unit members to a member type not already in the game (in this case a new Modernsoldier member) then these unit members do not display in game (but the rest of the formation does appear).

This is the xml I used for the unit member (it appears at the end of the Civ5ArtDefines_UnitMembers.xml file):

The Mechanized Infantry unit displays two of MI vehicles while the four Modernsoldier members are either lacking appearance or absent. I have tried several things to resolve whatever is causing the problem, but have not yet determined what exactly what is causing it. I have tried a few different versions of the Civ5ArtDefines_UnitMembers.xml. I have the mod activated in the game during each test.

I noticed that this problem occurs even when I set the modern soldier unit member's granny as <Granny>Assets/Units/Paratrooper/Paratrooper.fxsxml</Granny>. This seems to indicate that the immediate problem preceeds the fxsxml and dds files and is connected to the Modernsoldier unit member not being incorporated into the game properly.

The "Modernsoldier" is only a unit member and not a unit itself so I did not add an SQL file.

I have set true for import into VFS on all the files within the mod except for MechanizedInfantryNewArtDefines.xml The MechanizedInfantryNewArtDefines.xml and the Civ5ArtDefines_UnitMembers.xml are both set to be loaded into the database upon mod activation.

Hi dude, your code id slightly wrong, I'll post you an example:-

XML - 3 Tables to add to here.
Code:
<GameData>
	<ArtDefine_UnitMemberInfos>
		<!-- Housecarl -->
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_HOUSECARL_C</Type>
			<Scale>1.22</Scale>
			<ZOffset>NULL</ZOffset>
			<Model>Art/housecarl_c.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>
</GameData>

[B]<GameData>
	<ArtDefine_UnitInfoMemberInfos>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_GERMAN_LONGSWORDSMAN</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_GERMAN_LONGSWORDSMAN3</UnitMemberInfoType>
			<NumMembers>1</NumMembers>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>
</GameData>[/B]

<GameData>
	<ArtDefine_UnitInfos>		
		<Row>
			<Type>ART_DEF_UNIT_GERMAN_LONGSWORDSMAN</Type>
			<DamageStates>1</DamageStates>
			<Formation>DefaultMelee</Formation>
		</Row>
	</ArtDefine_UnitInfos>
</GameData>

SQL - 2 Tables to add too here. I found it easier to use SQL here.(Used SQLite for firefox to look at the table and copy an example(Like swordsman for you) I wanted, and just changed what I wanted to change)
Code:
INSERT INTO "ArtDefine_UnitMemberCombats" VALUES ("ART_DEF_UNIT_MEMBER_GERMAN_LONGSWORDSMAN","Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge","",null,"12",null,null,null,null,"0.3499999940395355",null,null,null,null,null,null,null,null,null,null,"8",null,null,null,null,null,"1",null,null,null,null,null,null,null,"");

INSERT INTO "ArtDefine_UnitMemberCombatWeapons" VALUES ("ART_DEF_UNIT_MEMBER_GERMAN_LONGSWORDSMAN","0","0","",null,null,null,null,null,"",null,null,null,null,null,null,null,null,"METAL","SWORD");
INSERT INTO "ArtDefine_UnitMemberCombatWeapons" VALUES ("ART_DEF_UNIT_MEMBER_GERMAN_LONGSWORDSMAN","1","0","","10","20",null,null,null,"",null,null,null,null,null,null,null,null,"FLAMING_ARROW","");

Oh I forgot Strategic View:
Code:
INSERT INTO "ArtDefine_StrategicView" VALUES ("ART_DEF_UNIT_GERMAN_LONGSWORDSMAN","Unit","SV_Longswordsman.dds");

Create New xml's/sql's for these, since artdefines is in the database now, you dont need to include the original.
 
Excellent. It appears that this problem is now resolved. I made an SQL file and several XML files similar to what Horem posted.

The "modernsoldier" unit members now appear in the game.

The last two steps should be to prepare the art and to compare the custom Modern Soldier SQL file to the Paratrooper's information. I know the basics about changing the art. I will download SQLite to check the combatweapons values on the Modern Soldier to ensure they match with the Paratrooper's values. The combat animation looked normal during a quick test, but I will investigate further.
 
Back
Top Bottom