1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Add a new unit in the game (using SQL)

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Gedemon, May 10, 2012.

  1. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    'IsReligious' column has been removed with pre-G&K patch, your mod should return an error in Database.log if you've activated logging in config.ini.

    Remove both reference to that tag in the INSERT INTO "Units" entry, it should be ok then.

    Just has an added note about your earlier XML code, when in SQL it refer to "ART_DEF_UNIT_MEMBER_WW1_FIGHTER", it's made to duplicate that entry in a new one for "ART_DEF_UNIT_MEMBER_NIEUPORT17".

    In XML you don't have a tag allowing to copy an entry, what you want to do here is a new entry "ART_DEF_UNIT_MEMBER_NIEUPORT17", using the data from "ART_DEF_UNIT_MEMBER_WW1_FIGHTER", but what your code was doing is defining an entry for "ART_DEF_UNIT_MEMBER_WW1_FIGHTER", which would have resulted in an error as this entry already exist.

    Here's what you should have written:
    Code:
    	<ArtDefine_UnitInfoMemberInfos>
    		<Row>
    		 <UnitMemberArt>
    			<UnitInfoType>ART_DEF_UNIT_NIEUPORT17</UnitInfoType>
    			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_NIEUPORT17</UnitMemberInfoType>
    			<NumMembers>3</NumMembers>
    		  </UnitMemberArt>
    		</Row>
    	</ArtDefine_UnitInfoMemberInfos>
    And after that should have replaced ART_DEF_UNIT_MEMBER_WW1_FIGHTER" with ART_DEF_UNIT_MEMBER_NIEUPORT17
     
  2. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    First off, I thought you said steps 3 and 4 were not needed now, due to the fact that you can add a mod via SQL. Is that right? Also, in my mod project, should I have...

    1. ART folder 2. Inside the Art folder, the Nieuport17 folder, and inside that all the dds files etc.?

    Then the other thing is he has a no_gloss.dds with no reference to Nieuport17, like the Nieuport17.dds. So do I just leave no_gloss.dds alone? And it is used right? I have set all of these to VFS true.

    I have added to my XML folder the Civ5ArtDefines_Expansion_UnitMembers.xml and the Civ5ArtDefines_Expansion_Units.xml files. They are set to VFS true as well. Since we are modding the unit via SQL, I do not have to modify these files? Is that true? But they are required to be set at VFS true correct?

    Also, inside danrell's Common folder is the civ5artdefines_viseffects.xml file, this should be set to VFS true too? I have done that just let me know if it is supposed to be.
     
  3. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    The easiest thing would be to send the mod. I'll do a build and send it as it is now.

    Perhaps, you can take a quick look to see what things are not correct. Which I am sure they probably are not, because I am becoming more and more confused. :lol:

    Here it is.
     

    Attached Files:

  4. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    Steps 3 and 4 are not needed, but you can use either XML or SQL for the replacing step I've done in SQL only.

    That code is a conversion of that part of the SQL code
    Code:
    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    	SELECT	("ART_DEF_UNIT_NIEUPORT17"), ("ART_DEF_UNIT_MEMBER_NIEUPORT17"), "NumMembers"
    	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_WW1_FIGHTER");
    
    to XML:
    Code:
    	<ArtDefine_UnitInfoMemberInfos>
    		<Row>
    		 <UnitMemberArt>
    			<UnitInfoType>ART_DEF_UNIT_NIEUPORT17</UnitInfoType>
    			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_NIEUPORT17</UnitMemberInfoType>
    			<NumMembers>3</NumMembers>
    		  </UnitMemberArt>
    		</Row>
    	</ArtDefine_UnitInfoMemberInfos>
    The advantage of SQL, is that if the number of units in the formation is changed for the WWI fighter (by a patch or myself for whatever reason), it will also apply to all units based on it, while in XML I would have to manually change the <NumMembers> tag's value for all ethnic/unique units replacing the WWI fighter.

    The DDS, GR2 and FSXML files can be placed anywhere in your mod project as long as the VFS is set to true for them.

    I prefer to use subfolders (Art, SQL, XML, Lua,..) to keep the mod easy to manage, but you could have it working with everything in the base folder, that what I do for very small mods.

    For no_gloss.dds, as it may be used by different units, I put it in a separate folder for my mods using many units, with VFS to true, this way it will be available to all units models requiring it. Having it multiple time in your mod should not give issues, it's again a matter of organisation/keeping the mod structure "clean".

    But don't rename it, the model's files are referring to it's original name.
     
  5. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Here is the mod. I looked through every step. When I enable the mod and launch it in the game, playing as France, all that is available is the triplane. What am I missing in the mod project? Or what is wrong, is there code missing or something? Is there something deleted that should be there. It's confusing and i cannot figure out what I did wrong. Please let me know and thank you.
     

    Attached Files:

  6. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    see :

    and to activate logging, open the config.ini file that's in "\My Documents\My Games\Sid Meier's Civilization 5" folder and change "LoggingEnabled = 0" to "LoggingEnabled = 1"

    Database.log can be found in the "\My Documents\My Games\Sid Meier's Civilization 5\Logs" folder.

    Also, Civ5ArtDefines_Expansion_UnitMembers.xml and Civ5ArtDefines_Expansion_Units.xml should be removed.
     
  7. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    OK, will do. I have to sleep a bit then, I will do what you say, when I get up. :)
     
  8. Patum333

    Patum333 Chieftain

    Joined:
    Jan 25, 2012
    Messages:
    63
    Location:
    Bremen
    How to use different IconAtlas in SQL?

    I wrote this so far:


    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    SELECT ("UNIT_ATLAS_RIFLEMAN"), (256), ("rifleman256.dds"), (5), (5)
    FROM "IconTextureAtlases";

    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    SELECT ("UNIT_ATLAS_RIFLEMAN"), (128), ("rifleman128.dds"), (5), (5)
    FROM "IconTextureAtlases";

    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    SELECT ("UNIT_ATLAS_RIFLEMAN"), (80), ("rifleman80.dds"), (5), (5)
    FROM "IconTextureAtlases";

    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    SELECT ("UNIT_ATLAS_RIFLEMAN"), (64), ("rifleman64.dds"), (5), (5)
    FROM "IconTextureAtlases";

    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    SELECT ("UNIT_ATLAS_RIFLEMAN"), (45), ("rifleman45.dds"), (5), (5)
    FROM "IconTextureAtlases";

    But I don't know how to fix it with the Cultural Variation type, like here: 'UNIT_RIFLEMAN'?

    Could someone help me please?:religion:
     
  9. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    IsReligious has been removed in the SQL file. "LoggingEnabled = 1" Let me try it now. These are gone now too. 'Also, Civ5ArtDefines_Expansion_UnitMembers.xml and Civ5ArtDefines_Expansion_Units.xml should be removed.'

    Ok, the unit shows up in game, but I cannot see the planes (unit graphics) when the unit is built in the city. When I try to rebase the plane it locks the game up. None of the art files are showing up. How do we fix that? Other than that evrything else checks out. It shows in the techtree, it is a UU for France etc. Just the unit itself is not showing up.

    I think I found problem. Let me check. Indeed, I had to change Nieuport17.fxsxml to Nieuport_17.fxsxml.

    SUCCESS! WHAT A PAIN IN THE, well I won't say, but anyway. :lol: Now adding units with SQL, will be tons easier. What's there, 5 files, 4 unit graphic, 1 SQL, that's it.
     
  10. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    The INSERT INTO ... SELECT ... FROM ... WHERE ... is used to fill rows based on an existing entry in my case.

    For you, you just want to make new entries using a different syntax:

    Code:
    INSERT INTO "IconTextureAtlases" ('Atlas', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn')
    	 VALUES ("UNIT_ATLAS_RIFLEMAN", 45, "rifleman45.dds", 5, 5);
     
  11. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    @Gedemon and Nutty. Thank you for all your help and bearing with me. I also wanted to thank Danrell for his excellent unit graphics.

    I have one question, when I added danrell's common folder into my mod it show an error. It said that it was missing the civ5artdefines_viseffects.xsd file or something like that. Anyone know what that means? Anyway, I took it out.

    Next I was think of adding one of his subs to a mod, so I'd like to know how to fix this 'common' folder issue. Thanks again.
     
  12. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    when do you get the error exactly ?
     
  13. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    These are 2 warnings in the error list box, in the lower left corner, where it tells you if code has errors in it.

    Code:
    Warning	1	Could not find file 'C:\Users\Administrator\Documents\Firaxis ModBuddy\nieuport17\nieuport17\XML\Common\Civ5ArtDefines_VisEffects.xsd'.	C:\Users\Administrator\Documents\Firaxis ModBuddy\nieuport17\nieuport17\XML\Common\civ5artdefines_viseffects.xml	3	105	nieuport17
    
    Code:
    Warning	2	The schema referenced from this location in your document contains errors.	C:\Users\Administrator\Documents\Firaxis ModBuddy\nieuport17\nieuport17\XML\Common\civ5artdefines_viseffects.xml	3	105	nieuport17
    It says this too.
    Code:
    xsi:noNamespaceSchemaLocation="Civ5ArtDefines_VisEffects.xsd">
    Should I put the Common folder in an XML folder, in the mod project. Or, should I just have the Common folder in there by itself?

    I wonder, is adding in the French FT-17 tank easy to do as well? It will need danrells specific combat graphics though. Will merging these mods be easy later? And the other thing, what goes into updating them if there is a patch? I think a WWI mod unit pack and scenario, would go together quite nicely. We need one. I feel the devs may make one with one of the upcoming DLCs.

    I really don't need the Common folder for this little airplane mod, but I may with later ones. If I mod his ships, subs, or tanks. I took it out for now anyway, it really is not needed for the mod to work.
     
  14. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Does this template work for all unit types? It is not just for WWI planes is it?

    It seemed to work. I added an FT17, but it had a ranged attack when I first used the unit. The tank showed up in game really well. I took out the rangedattack value, and will test it later. I also, got the common folder in there correctly. Without that folder and the files within, the tank was shown halfway in the ground. It looked like my dog outside trying to dig a hole. Next I will try a sub. Then I was thinking of making a battle cruiser, whole new class.
     
  15. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Does this SQL code look correct for a WWI tank unit? This is my second unit I just want to make sure, that I am doing things correctly. Thanks.

    Spoiler :
    Code:
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    	SELECT	("ART_DEF_UNIT_FT17"), "DamageStates", "Formation"
    	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_TANK");
    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    	SELECT	("ART_DEF_UNIT_FT17"), ("ART_DEF_UNIT_MEMBER_FT17"), "NumMembers"
    	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_WW1_TANK");
    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_FT17"), "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_WW1_TANK");
    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_FT17"), "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_WW1_TANK");
    INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
    	SELECT	("ART_DEF_UNIT_MEMBER_FT17"), "Scale", "ZOffset", "Domain", 
    			("Renault_FT-17.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
    	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_TANK");
    INSERT INTO "Units" ('Type', 'Description', 'Civilopedia', 'Strategy', 'Help', 'Requirements', 'Combat', 'RangedCombat', 'Cost', 'Moves', 'Immobile', 'Range', 'BaseSightRange', 'Class', 'Special', 'Capture', 'CombatClass', 'Domain', 'CivilianAttackPriority', 'DefaultUnitAI', 'Food', 'NoBadGoodies', 'RivalTerritory', 'MilitarySupport', 'MilitaryProduction', 'Pillage', 'Found', 'FoundAbroad', 'CultureBombRadius', 'GoldenAgeTurns', 'IgnoreBuildingDefense', 'PrereqResources', 'Mechanized', 'Suicide', 'CaptureWhileEmbarked', 'PrereqTech', 'ObsoleteTech', 'GoodyHutUpgradeUnitClass', 'HurryCostModifier', 'AdvancedStartCost', 'MinAreaSize', 'AirUnitCap', 'NukeDamageLevel', 'WorkRate', 'NumFreeTechs', 'RushBuilding', 'BaseHurry', 'HurryMultiplier', 'BaseGold', 'NumGoldPerEra', 'SpreadReligion', 'CombatLimit', 'RangeAttackOnlyInDomain', 'RangeAttackIgnoreLOS', 'RangedCombatLimit', 'XPValueAttack', 'XPValueDefense', 'SpecialCargo', 'DomainCargo', 'Conscription', 'ExtraMaintenanceCost', 'NoMaintenance', 'Unhappiness', 'UnitArtInfo', 'UnitArtInfoCulturalVariation', 'UnitArtInfoEraVariation', 'ProjectPrereq', 'SpaceshipProject', 'LeaderPromotion', 'LeaderExperience', 'DontShowYields', 'ShowInPedia', 'MoveRate', 'UnitFlagIconOffset', 'PortraitIndex', 'IconAtlas', 'UnitFlagAtlas')
    	SELECT	("UNIT_FT17"), ("FT17 Tank"), "Civilopedia", "Strategy", "Help", "Requirements",
    			"Combat", "RangedCombat", "Cost", "Moves", "Immobile", "Range", "BaseSightRange", ("UNITCLASS_WWI_TANK"), "Special", "Capture", "CombatClass", "Domain", "CivilianAttackPriority", "DefaultUnitAI", "Food", "NoBadGoodies", "RivalTerritory", "MilitarySupport", "MilitaryProduction", "Pillage", "Found", "FoundAbroad", "CultureBombRadius", "GoldenAgeTurns", "IgnoreBuildingDefense", "PrereqResources", "Mechanized", "Suicide", "CaptureWhileEmbarked", "PrereqTech", "ObsoleteTech", "GoodyHutUpgradeUnitClass", "HurryCostModifier", "AdvancedStartCost", "MinAreaSize", "AirUnitCap", "NukeDamageLevel", "WorkRate", "NumFreeTechs", "RushBuilding", "BaseHurry", "HurryMultiplier", "BaseGold", "NumGoldPerEra", "SpreadReligion", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
    			("ART_DEF_UNIT_FT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
    			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
    	FROM "Units" WHERE (Type = "UNIT_WWI_TANK");
    INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
    	SELECT ("UNIT_FT17"), "UnitAIType"
    	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_WWI_TANK");
    INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
    	SELECT ("UNIT_FT17"), "UnitClassType"
    	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_WWI_TANK");
    INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
    	SELECT ("UNIT_FT17"), "FlavorType", "Flavor"
    	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_WWI_TANK");
    INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
    	SELECT ("UNIT_FT17"), "PromotionType"
    	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_WWI_TANK");
    INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
    	SELECT ("UNIT_FT17"), "ResourceType", "Cost"
    	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_WWI_TANK");
    INSERT INTO "Civilization_UnitClassOverrides" ( 'CivilizationType', 'UnitClassType', 'UnitType' )
    	VALUES ( 'CIVILIZATION_FRANCE', 'UNITCLASS_WWI_TANK', 'UNIT_FT17' ); 
     
  16. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    seems correct on quick view and sqlite report no error executing the query... something wrong ingame ?
     
  17. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    No, it works beautiful. This is going to be a lot of fun.

    I remember in CiIV, at first we did all the xml changes to add units. Then I started just changing the artdefines. You know for unit ethnic diversity. This made it so much easier to add units. Of course, saying that the XML was still needed to make new unit classes, obviously. Common units were a breeze to add.

    Spoiler :
    Code:
    <UnitArtStyleTypeInfos>
     <UnitArtStyleTypeInfo>
      <Type>UNIT_ARTSTYLE_ASIAN</Type>
      <StyleUnits>
       <StyleUnit>
        <UnitType>UNIT_ARCHER</UnitType>
        <UnitMeshGroup>
         <EarlyArtDefineTag>ART_DEF_UNIT_ARCHER_ASIAN</EarlyArtDefineTag>
         <LateArtDefineTag>ART_DEF_UNIT_ARCHER_ASIAN</LateArtDefineTag>
         <MiddleArtDefineTag>ART_DEF_UNIT_ARCHER_ASIAN</MiddleArtDefineTag>
        </UnitMeshGroup>
       </StyleUnit>
       <StyleUnit>
        <UnitType>UNIT_CARAVEL</UnitType>
        <UnitMeshGroup>
         <EarlyArtDefineTag>ART_DEF_UNIT_ASIAN_WAR_GALLEY</EarlyArtDefineTag>
         <LateArtDefineTag>ART_DEF_UNIT_ASIAN_WAR_GALLEY</LateArtDefineTag>
         <MiddleArtDefineTag>ART_DEF_UNIT_ASIAN_WAR_GALLEY</MiddleArtDefineTag>
        </UnitMeshGroup>
       </StyleUnit>
       <StyleUnit>
        <UnitType>UNIT_CHARIOT</UnitType>
        <UnitMeshGroup>
         <EarlyArtDefineTag>ART_DEF_UNIT_CHARIOT_CHINESE</EarlyArtDefineTag>
         <LateArtDefineTag>ART_DEF_UNIT_CHARIOT_CHINESE</LateArtDefineTag>
         <MiddleArtDefineTag>ART_DEF_UNIT_CHARIOT_CHINESE</MiddleArtDefineTag>
        </UnitMeshGroup>
       </StyleUnit>
     </UnitArtStyleTypeInfo>
    </UnitArtStyleTypeInfos>
    


    Basically, we would just change the art defines, based on ethnic region, for individual civilization. I remember it being much easier. All of the rest of the unit xml stayed the same. So, for instance, you have one UNIT_RIFLEMAN in XML, but he can have a hundred different looks. I think my mod at the time had 50 civs if I am not exaggerating, most had a rifle that looked the part for the civ they represented.

    My point is that the SQL way of adding units, is about as easy. I like that.
     
  18. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,668
    Location:
    France
    If your going for ethnic diversity instead of unique units, there is a faster way, used in R.E.D. post patch .674

    The settler use something like late Civ4 ethnic modding, with a suffix ("ART_DEF_UNIT__SETTLER_ASIA" for example) used for all civilization having that ArtStyle suffix (Japan, China, etc...)

    What I've done in R.E.D. modpack is giving every civ it's own artstyle suffix...

    example for China:
    Code:
    UPDATE Civilizations SET ArtStyleSuffix = "_CHINA" WHERE Type = 'CIVILIZATION_CHINA';
    ... and then set an unit type to use cultural variation like the settler...

    example for Composite Bowman:
    Code:
    UPDATE Units SET UnitArtInfoCulturalVariation = 1 WHERE Type = 'UNIT_COMPOSITE_BOWMAN';
    ... and finally I only need the art code to add an ethnic unit:
    Code:
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    	SELECT	("ART_DEF_UNIT_COMPOSITE_BOWMAN_CHINA"), "DamageStates", "Formation"
    	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_COMPOSITE_BOWMAN");
    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    	SELECT	("ART_DEF_UNIT_COMPOSITE_BOWMAN_CHINA"), ("ART_DEF_UNIT_MEMBER_COMPOSITE_BOWMAN_CHINA"), "NumMembers"
    	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_COMPOSITE_BOWMAN");
    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_COMPOSITE_BOWMAN_CHINA"), "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_COMPOSITE_BOWMAN");
    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_COMPOSITE_BOWMAN_CHINA"), "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_COMPOSITE_BOWMAN");
    INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
    	SELECT	("ART_DEF_UNIT_MEMBER_COMPOSITE_BOWMAN_CHINA"), "Scale", "ZOffset", "Domain", 
    			("Composite_Bowman_China_v2.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
    	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_COMPOSITE_BOWMAN");
     
  19. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    This is great! What does this Chinese composite bowman look like? What does it do add elements of the Asian settler art defines, to make the composite bowman look more like an Asian unit?
     
  20. Patum333

    Patum333 Chieftain

    Joined:
    Jan 25, 2012
    Messages:
    63
    Location:
    Bremen
    Thanks a lot! :thumbsup:

    But how to wrote the path (<PortraitIndex> 1 or 2 or 3 or 4... </PortraitIndex>
    ) for using each unique rifleman icon in the "UNIT_ATLAS_RIFLEMAN"? The <PortraitIndex> is a part of "civ5units".:confused:
     

Share This Page