[MODCOMP] UnitArtStyles

Androrc the Orc

Emperor
Joined
Apr 19, 2004
Messages
1,621
Location
Vienna, Austria
The Beyond the Sword expansion for Civilization IV introduced to the game the possibility to have different unit art styles for the civilizations. Unfortunately, that feature is absent in vanilla Civ4Col. This modcomp brings that feature from BTS to Civ4Col, so that we can make the different civilizations have different unit graphics, without necessarily adding new units in the XML.

In the modcomp, an example is provided: the Dutch have specific graphics for when their units take up the Soldier profession. The graphics used were brought from the Age of Further Discovery modmod for Age of Discovery II.

To make a unit graphic be used for a unit for all professions, unless specified otherwise, use "NONE" instead of the profession tag in the Civ4UnitArtStyleTypeInfos.xml.

The changes in the DLL are marked with "//Androrc UnitArtStyles" and the ones in python with "#Androrc UnitArtStyles".

UPDATE: Version 1.1 uploaded, with a fix that makes the units appear with the correct graphics for their UnitArtStyle in the interface and civilopedia.

UPDATE 2: Version 1.2 uploaded. Following a suggestion by Kailric, now entries for a UnitArtStyle's units can be set with <UnitType> to NONE (a profession necessarily has to be specified in that case, however), and that art tag will be applied for that profession for all units in that UnitArtStyle, excepting the ones that have an art tag specifically for that UnitType and Profession. The only changes from version 1.1 are in Infos.cpp and in the example given in CIV4UnitArtStyleTypeInfos.xml.

Download UnitArtStyles 1.2
 
Dude!!! :goodjob::goodjob:

I have been pouring over ideas for two days on just how to do this and you go and do it for me :) This mod ROCKS!! I'll be adding this to my Medieval mod asap. I been thinking I was going to have to add 500 units to the CivUnitInfos just to get diversity.

OK, I understand the Professions part but let me get the NONE part straight. Say, if I want to add an Arabian Cotton Planter, instead of haveing to add a whole new unit I just add an Arabian art style and then I just put in "Unit_Cotton_Planter" put "NONE" and then add the art style?
 
I just installed this mod into my mod. Took about an hour or so. I added one unit for a Civ and it worked perfectly in the game.

Great work man :D


Edit: How hard would it be to add the ability to like put "<UnitType>NONE</UnitType>" and then have the profession graphic replace all units when they change to that profession? Like in the vanilla game all the units except for the Veteran share the same profession graphic. If this could be changed then you wouldn't have to add xml code for all the units that share the same graphic.
 
Dude!!! :goodjob::goodjob:

I have been pouring over ideas for two days on just how to do this and you go and do it for me :) This mod ROCKS!! I'll be adding this to my Medieval mod asap. I been thinking I was going to have to add 500 units to the CivUnitInfos just to get diversity.

OK, I understand the Professions part but let me get the NONE part straight. Say, if I want to add an Arabian Cotton Planter, instead of haveing to add a whole new unit I just add an Arabian art style and then I just put in "Unit_Cotton_Planter" put "NONE" and then add the art style?

Thanks :D

Yes, if set like this, for example:

Code:
		<UnitArtStyleTypeInfo>
			<Type>UNIT_ARTSTYLE_ARABIAN</Type>
			<StyleUnits>
				<StyleUnit>
					<UnitType>UNIT_COTTON_PLANTER</UnitType>
					<ProfessionType>NONE</ProfessionType>
					<UnitMeshGroup>
						<ArtDefineTag>ART_DEF_UNIT_ARABIAN_COTTON_PLANTER</ArtDefineTag>
					</UnitMeshGroup>
				</StyleUnit>
			</StyleUnits>
		</UnitArtStyleTypeInfo>

Then it will have the Master Cotton Planter unit for civilizations with the Arabian unit art style us the Arabian Cotton Planter art for all professions. Including the Pioneer and Soldier professions, so you need to specify art for those too, or the unit will use the Arabian Cotton Planter art for them.
 
Then it will have the Master Cotton Planter unit for civilizations with the Arabian unit art style us the Arabian Cotton Planter art for all professions. Including the Pioneer and Soldier professions, so you need to specify art for those too, or the unit will use the Arabian Cotton Planter art for them.


Ok, so in other words if you want to add an Arabian Veteran put NONE in the xml and
the game will use all the default Arabian Veteran profession art? Guess I am still a little confused. I will just go test things in my mod now then I will know for sure.

Anyway, I asked a question above and I'll repost it incase you missed it...

How hard would it be to add the ability to like put "<UnitType>NONE</UnitType>" and then have the profession graphic replace all units when they change to that profession? Like in the vanilla game all the units except for the Veteran share the same profession graphic. If this could be changed then you wouldn't have to add xml code for all the units that share the same graphic.
 
Ok, so in other words if you want to add an Arabian Veteran put NONE in the xml and
the game will use all the default Arabian Veteran profession art? Guess I am still a little confused. I will just go test things in my mod now then I will know for sure.

It works exactly like setting the profession to NONE does while setting the unit graphics normally.

Anyway, I asked a question above and I'll repost it incase you missed it...

How hard would it be to add the ability to like put "<UnitType>NONE</UnitType>" and then have the profession graphic replace all units when they change to that profession? Like in the vanilla game all the units except for the Veteran share the same profession graphic. If this could be changed then you wouldn't have to add xml code for all the units that share the same graphic.

Did it :D Check the first post of the thread.

This greatly reduces the XML work even for adding default graphics for new professions, so having a UNIT_ARTSTYLE_DEFAULT just for that in an interesting option.
 
It works exactly like setting the profession to NONE does while setting the unit graphics normally.



Did it :D Check the first post of the thread.

This greatly reduces the XML work even for adding default graphics for new professions, so having a UNIT_ARTSTYLE_DEFAULT just for that in an interesting option.

Excellent!! I can go to sleep now :) I was up trying to figure this out on my own. Not haveing worked with any of the art coding I of course had no idea what was going on. I still haven't figured out what exactly you did. I didn't notice the change as it must have been very subtile or I am really sleepy. So just wondering what did you change in the CvInfos ?

Just another suggestion to help modders in the future. If you make updates to your mod add a new tag like //Androrc UnitArtStyles 1.2 so we can easly find the updates. I couldn't find it so I just redid all the CvInfos :D and it works perfectly in my testing so far.

Like you say this will greatly reduce the amount of work modders will have to do now. You saved me a ton of work!

:c5capital::c5capital::c5capital::c5capital:5 stars all day!:c5capital:
 
Hey, there could also be some kind of override added for Units like Great Generals and Veterans. So for those units it does not use Civilization art but the units own art styles. Right now Great Generals unit art is the same as the unit it is leading if that unit has a Profession.

A new tag like <bUseDefaultArtStyle>1<bUseDefaultArtStyle>, then for that unit it will use the CvUnitInfos art style.

I guess to fix this I will have to add Great General art style for every Profession, for ever Civilization.
 
Hey, there could also be some kind of override added for Units like Great Generals and Veterans. So for those units it does not use Civilization art but the units own art styles. Right now Great Generals unit art is the same as the unit it is leading if that unit has a Profession.

A new tag like <bUseDefaultArtStyle>1<bUseDefaultArtStyle>, then for that unit it will use the CvUnitInfos art style.

That seems like a simple fix, I'll get on to it.

I guess to fix this I will have to add Great General art style for every Profession, for ever Civilization.

No, you just need to add for each UnitArtStyle with profession as "NONE", that should work.
 
That seems like a simple fix, I'll get on to it.
No, you just need to add for each UnitArtStyle with profession as "NONE", that should work.

Ok, that would be great if you could fix that. I have like 20 Professions in my mod now that can potentialy change the art style of the Great General so thats a lot of XML additions.
 
If you specify the unit (the great general) and set the profession as NONE, the great general should use those graphics for all professions.

I added the below code for the Anglo-Saxon Civ but still when the General is attached to a unit and the unit changes professions the Generals art changes as well.

Code:
<Type>UNIT_ARTSTYLE_ANGLO</Type>
      <StyleUnits>
        <StyleUnit>
          <UnitType>UNIT_GREAT_GENERAL</UnitType>
          <ProfessionType>NONE</ProfessionType>
          <UnitMeshGroup>
            <ArtDefineTag>ART_DEF_UNIT_GREAT_GENERAL</ArtDefineTag>
          </UnitMeshGroup>
        </StyleUnit>
 
Hey, I finally got around to seeing what could be done to make it easier to override the new Artstyles for units like Great Generals. I changed the below code and all seems to work now. I simply added a check to see if the UnitType had a leader promotion. If it does then it reverts back to default artstyle which is defined in the Civ4UnitInfos.xml.

Also, I haven't done it yet but if we added a new tag to the Civ4UnitInfos and call it "bOverRideCivArtStyle" and then do a check for that tag as well then we can set it up so that some units willl use their own are styles instead of the Civs. This would be useful for Units such as Veterans that have their own art style and do not follow the basic Civs artstyle.

Code:
//Androrc UnitArtStyles
//const char* CvUnitInfo::getArtDefineTag(int index, int iProfession) const
const char* CvUnitInfo::getArtDefineTag(int index, int iProfession, int iStyle) const
//Androrc End
{
	//Androrc UnitArtStyles
	UnitArtStyleTypes eStyle = (UnitArtStyleTypes) iStyle;

	if (NO_UNIT_ARTSTYLE != eStyle)
	{
		int iUnit = GC.getInfoTypeForString(getType());
		if (-1 != iUnit)
		{
		    ///TKs Med
                  [COLOR="Red"]if (GC.getUnitInfo((UnitTypes)iUnit).getLeaderPromotion() == NO_PROMOTION)[/COLOR]
	    {
                const char* pcTag = GC.getUnitArtStyleTypeInfo(eStyle).getArtDefineTag(index, iUnit, iProfession);
                if (NULL != pcTag)
                {
                    return pcTag;
                }
                else //retrieve the unit art style tag for no profession if the one for the desired profession is missing
                {
                    pcTag = GC.getUnitArtStyleTypeInfo(eStyle).getArtDefineTag(index, iUnit, -1);
                    if (NULL != pcTag)
                    {
                        return pcTag;
                    }
                }
		    }
		    ///TKe
		}
	}
	//Androrc End

	return getProfessionMeshGroup(iProfession).getMeshGroup(index).getArtDefineTag();
}
 
Hey, I finally got around to seeing what could be done to make it easier to override the new Artstyles for units like Great Generals. I changed the below code and all seems to work now. I simply added a check to see if the UnitType had a leader promotion. If it does then it reverts back to default artstyle which is defined in the Civ4UnitInfos.xml.

Hello Kailric. Great, glad it worked!

Also, I haven't done it yet but if we added a new tag to the Civ4UnitInfos and call it "bOverRideCivArtStyle" and then do a check for that tag as well then we can set it up so that some units willl use their own are styles instead of the Civs. This would be useful for Units such as Veterans that have their own art style and do not follow the basic Civs artstyle.

Well, that could make things a bit easier to do in the xml, but I'm not sure if it's worth it in the end, since you'll be doing less xml work in the unitartstyles xml, but will be doing more in the unitinfos xml.
 
@Androrc the Orc

I seem to have missed something in your description.

Do you need to modify the DLL in order to add units or new units using original base models?

I am familiar with .xml programming, 3-D graphics, animations and textures, (kfm, nif and .dds). I was asked to look at 4Col to see if I would have any interest in working on a "Project". So I am trying to study the code and relationships between the various files.

The Project, as described to me, would add additonal Nations with unique units and skills. But without a full understanding of how these would be added, I am learning on a curve.

I am familiar with the original Col from the '90s and did some mod work back then. But I just played 4Col for the first time today. I have been looking at the game files for about a week.

Any assistance you might wish to provide would be helpful.

Thanks

The Major
 
@Androrc

Let me ask this...

Which is the cleanest way to add a nation-specific unit?

Do you add the unit with parameters in the xml, then make the unit unavailable in each nation's line up...

or is there a better way?

I am not quite following your 'schema' method.


Thanks

The Major
 
Both. I am working on a few new models that will be nation specific as well as a couple of textures that are nation specific.

1M
 
Top Bottom