Re-skinning a unit?

CheddarCheese

Chieftain
Joined
Sep 6, 2011
Messages
13
Location
Canada
Hi all,

I've been searching these forums for a while now, and I can't seem to find any up-to-date tutorials on how to re-skin an existing unit.

My goal is simple; I plan on creating a new unit which uses the longswordsman skin, but has a darker armour colour. I came across a tutorial which goes over something like that, it can be found here:

I do have a couple of problems. One, the tutorial uses a program which no longer exists (or I simply can't find it on Google), and second, my Nexus Asset Viewer doesn't seem to display any 3D models. Seeing the date the tutorial was created, I'm assuming it's outdated.

Are there any up-to-date tutorials or instructions out there that can help me accomplish this task? If not, how would I go about getting started?

Thanks!
 
Couldn't you just convert the DDS texture map to a jpg or png, open it up in GIMP or photoshop, and just change the color as needed, then re-package it back into the orginal format?
 
I've already managed to edit the skin. It's the "re-package" part that I don't know how to do. Additionally, I'm also unsure how to make the new art defines for the unit.

I've tried to improvise and make it myself, but it doesn't seem to be close to working.
 
I've already managed to edit the skin. It's the "re-package" part that I don't know how to do. Additionally, I'm also unsure how to make the new art defines for the unit.

I've tried to improvise and make it myself, but it doesn't seem to be close to working.

I'm an art guy, not a coding guy, so yeah :p

I need to know also, I assume just do the reverse of you got the texture maps in the first place.
 
There's no "package," but the four files you'll need you will have copied from a vanilla unit, the .gr2, the -diff.dds, the -sref.dds, and the .fxsxml. You add these files to your mod, and make sure they are set to VFS=true.

You know how to edit the dds files, so you just need to change the references in your renamed .fxsxml and .gr2 to point to them. The fxsxml is just text, so that should be easy. As for the .gr2... well, it's true that the tutorial you linked was outdated, but the note at the very top should have pointed you in the right direction:
Update: Don't have time to rewrite this tutorial ATM but if you want to do reskins use this version of NexusBuddy. Just open the GR2 you want to reskin, switch the textures on the materials to your new ones and save the gr2 with a new name.

To be a little more clear, make a copy of the vanilla .gr2, rename it, then using IndieStone Nexus Buddy:
change the material's BaseTextureMap to your diff, and the SREFMap to... yeah, your sref. Save. Done! (EDIT: It also works to convert FBXs to GR2s, if you're going to mod in your own 3-D model). I don't bother with the Smart Exporter.

The Nexus Viewer hasn't worked for some time (an old version was posted here, but it was taken down for obvious--and in this context, stupid--legal reasons).

As far as the artdefines, G+K and its accompanying patches to vanilla have changed things quite a bit, and a new tutorial hasn't been posted yet, but you can piece it together from the comments following Gedemon's tutorial. But in short: Since you can't edit the civ5artdefines XML files anymore (a good thing for mod compatibility), now you need to put something like the following in a .SQL file in your mod, and make sure you have the file set to OnModActivated/UpdateDatabase:
Spoiler :
Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_LONGSWORDSMAN_NEW"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_LONGSWORDSMAN");
INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
	SELECT	("ART_DEF_UNIT_LONGSWORDSMAN_NEW"), ("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), "NumMembers"
	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_LONGSWORDSMAN");
INSERT INTO "ArtDefine_UnitMemberCombats" ('UnitMemberType', 'EnableActions', 'DisableActions', 'MoveRadius', 'ShortMoveRadius', 'ChargeRadius', 'AttackRadius', 'RangedAttackRadius', 'MoveRate', 'ShortMoveRate', 'TurnRateMin', 'TurnRateMax', 'TurnFacingRateMin', 'TurnFacingRateMax', 'RollRateMin', 'RollRateMax', 'PitchRateMin', 'PitchRateMax', 'LOSRadiusScale', 'TargetRadius', 'TargetHeight', 'HasShortRangedAttack', 'HasLongRangedAttack', 'HasLeftRightAttack', 'HasStationaryMelee', 'HasStationaryRangedAttack', 'HasRefaceAfterCombat', 'ReformBeforeCombat', 'HasIndependentWeaponFacing', 'HasOpponentTracking', 'HasCollisionAttack', 'AttackAltitude', 'AltitudeDecelerationDistance', 'OnlyTurnInMovementActions', 'RushAttackFormation')
	SELECT	("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), "EnableActions", "DisableActions", "MoveRadius", "ShortMoveRadius", "ChargeRadius", "AttackRadius", "RangedAttackRadius", 
			"MoveRate", "ShortMoveRate", "TurnRateMin", "TurnRateMax", "TurnFacingRateMin", "TurnFacingRateMax", "RollRateMin", "RollRateMax", "PitchRateMin", "PitchRateMax", "LOSRadiusScale", "TargetRadius", "TargetHeight", "HasShortRangedAttack", "HasLongRangedAttack", "HasLeftRightAttack", "HasStationaryMelee", "HasStationaryRangedAttack", "HasRefaceAfterCombat", "ReformBeforeCombat", "HasIndependentWeaponFacing", "HasOpponentTracking", "HasCollisionAttack", "AttackAltitude", "AltitudeDecelerationDistance", "OnlyTurnInMovementActions", "RushAttackFormation"
	FROM "ArtDefine_UnitMemberCombats" WHERE (UnitMemberType = "ART_DEF_UNIT_MEMBER_LONGSWORDSMAN");
INSERT INTO "ArtDefine_UnitMemberCombatWeapons" ('UnitMemberType', 'Index', 'SubIndex', 'ID', 'VisKillStrengthMin', 'VisKillStrengthMax', 'ProjectileSpeed', 'ProjectileTurnRateMin', 'ProjectileTurnRateMax', 'HitEffect', 'HitEffectScale', 'HitRadius', 'ProjectileChildEffectScale', 'AreaDamageDelay', 'ContinuousFire', 'WaitForEffectCompletion', 'TargetGround', 'IsDropped', 'WeaponTypeTag', 'WeaponTypeSoundOverrideTag')
	SELECT ("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), "Index", "SubIndex", "ID", "VisKillStrengthMin", "VisKillStrengthMax", "ProjectileSpeed", "ProjectileTurnRateMin", "ProjectileTurnRateMax", "HitEffect", "HitEffectScale", "HitRadius", "ProjectileChildEffectScale", "AreaDamageDelay", "ContinuousFire", "WaitForEffectCompletion", "TargetGround", "IsDropped", "WeaponTypeTag", "WeaponTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberCombatWeapons" WHERE (UnitMemberType = "ART_DEF_UNIT_MEMBER_LONGSWORDSMAN");
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
	SELECT	("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), "Scale", "ZOffset", "Domain", 
			("longswordsman_new.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_LONGSWORDSMAN");

Just change the references to LONGSWORDSMAN_NEW and longswordsman_new.fxsxml.
 
Thanks everyone for your help! I've got it working after following Nutty's instructions.

I do have one question however, since I'm completely new to SQL. What do I have to do to change certain values for my units? Currently, my new unit uses the same values as the regular longswordsman.

How would I go about changing NumMembers, Formation or Scale?
 
What INSERT INTO... SELECT... FROM... WHERE... does is to copy a row or set of rows that match the FROM... WHERE... condition, and makes changes as designated. The INSERT INTO part tells the game what the SELECT part is going to do, and you'll notice there's a lot of overlap of terms. The places that are different are the changes you'd like to make in this case.

For example, notice
Code:
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain"...
and
Code:
SELECT	("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), "Scale", "ZOffset", "Domain"...

The first entry after SELECT changes the Type column to the entry in parantheses. If you wanted to change the scale, you'd specify a number for Scale (because it's a number, it's not in quotes), so, for example:
Code:
SELECT	("ART_DEF_UNIT_MEMBER_LONGSWORDSMAN_NEW"), (0.1), "ZOffset", "Domain"...

Good luck!
 
Back
Top Bottom