How to completely swap art for a unit?

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
In Dune Wars, we want to completely swap art for a unit. I got a lead that this is possible in FFH so I started this thread.

I'm not sure FfH has the capability or not, but in FF there is a tag available for promotions, <UnitArtStyleType> .... I've never looked at the DLL side for those tags, they already existed when I started modding FF. :lol:

Can anybody give me a little more detail? If there is a simple trick, I will re-implement it in Dune Wars.
 
It's not in FFH only.
Assets/XML/Civilizations/CIV4UnitArtStyleTypeInfos.xml

There you specify unique art for every civilization you need.

Example:
Code:
<Civ4UnitArtStyleTypeInfos xmlns="x-schema:CIV4CivilizationsSchema.xml">
	<UnitArtStyleTypeInfos>
		<UnitArtStyleTypeInfo>
			<Type>UNIT_ARTSTYLE_AMURITES</Type>
			<StyleUnits>
				<StyleUnit>
					<UnitType>UNIT_ADEPT</UnitType>
					<UnitMeshGroup>
						<EarlyArtDefineTag>ART_DEF_UNIT_ADEPT_AMURITES</EarlyArtDefineTag>
						<LateArtDefineTag>ART_DEF_UNIT_ADEPT_AMURITES</LateArtDefineTag>
						<MiddleArtDefineTag>ART_DEF_UNIT_ADEPT_AMURITES</MiddleArtDefineTag>
					</UnitMeshGroup>
				</StyleUnit>
		</UnitArtStyleTypeInfo>
	</UnitArtStyleTypeInfos>
</Civ4UnitArtStyleTypeInfos>
Here you've basically replaces the art style with a single new unit. If you need more than 1 unit in a group, just make a few "UnitMeshGroup"s.

And then you add
Code:
			<UnitArtStyleType>UNIT_ARTSTYLE_AMURITES</UnitArtStyleType>
to Assets/XML/Civilizations/CIV4CivilizationInfos.xml under the <ArtStyleType> string.
 
You may have missed the point of my request, which is to have one unit which uses one art on land, and a different art on ocean. There is some code inside FFH somewhere which *uses* art styles to perform the swapping, and the swapping is what I hope to understand.
 
Autoacquire promotions, based on the terrain. And you can attach an artstyle change to one of those promotions

the autoaquire system is only here in FF, I think. But it's so riduculously useful that it will blow your mind with it's awesomeness. So you should definitely borrow the code. Perhaps xienwolf can tell you specifics of which parts and where.
 
Autoacquire is a highly useful system, which is tightly wound in with all the other FF changes. I accept its awesomeness, but sadly, Dune Wars is already highly customized and I dread trying to (a) untangle just autoacquire from FF and then (b) successfully merge it into DW.

I had a look through the FF code for setHasPromotion, and found how UnitArtStyleType is used. There seem to be three parts to the task:

1. Move UnitArtStyle from a static UnitInfo member to a dynamic Unit member. This is a fairly standard task of relocating data from one class to another.

2. Make sure that everything retrieving UnitArtStyleType from the UnitInfo retrieves it from the Unit instead. This is the tricky part.

3. Calling CvUnit::reloadEntity as desired by the top level code. This is located in setHasPromotion for FFH, but it could go anywhere. I have to think about this, but it doesn't sound *that* hard.

So it may be doable, but it will take some time to find all the places that were changed for #2.
 
Top Bottom