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. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    If someone else knows, I can always fix that problem later. Thanks for posting though, I really appreciate how helpful you've been.

    Gedemon, do we have a quick questions about modding thread? Instead of making a whole thread about this.

    I'll post the question here and can cut/paste it later, if needs be.

    In my scenario, I add several UUs to the civs. At the moment I am working on my map in worldbuilder, placing infrastucture and units. I noticed that my British rifleman units show a settler icon on the map. Is there a way to fix this problem? They should be tagged somehow to a rifleman icon. Thanks for any help.
     
  2. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    is it using the settler icon inthe fxsml file?
     
  3. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Ah that is interesting. It could be. I'll look into it.
     
  4. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,150
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    No, the icon settings aren't stored in the .fxsxml. It's in your SQL or XML files.

    The Unit Portraits and Unit Icons for the regular map view are defined in the last 4 columns of the Units table. For the default Rifleman icon, you want "UnitFlagIconOffset" to be set to 47 (and "UnitFlagAtlas" should be 'UNIT_FLAG_ATLAS').

    For Strategic View, the unit icons are defined in the ArtDefine_StrategicView table. For the default Rifleman icon, you want the "Asset" column to be set to 'SV_Rifleman.dds'
     
  5. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    I got the strategic view straightened out, but not Worldbuilder. No big deal as long as SV has icons that works for me.
     
  6. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,150
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
  7. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Probably where you said, but SV is enough for me. I know some people prefer to play that way.
     
  8. rf900

    rf900 Chieftain

    Joined:
    Jan 31, 2006
    Messages:
    194
    I am hitting a wall :wallbash:

    Added a new slave unit based on the worker, all updates in SQL work fine, I can even add the unit to the game via the LUA tuner, and it works as intended.

    But I cannot produce the unit inside the city, it does not appear in the list. Any ideas?

    Spoiler :

    INSERT INTO UnitClasses (Type, Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, DefaultUnit )
    SELECT ('UNITCLASS_FASTWORKER'), ('Slave'), MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, ('UNIT_ENGINEER')
    FROM UnitClasses WHERE (Type = 'UNITCLASS_WORKER');

    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_FASTWORKER'), ('Slave'), Civilopedia, Strategy, Help, Requirements,
    Combat, RangedCombat, (250), Moves, Immobile, Range, BaseSightRange, ('UNITCLASS_FASTWORKER'), Special, ('UNITCLASS_FASTWORKER'), CombatClass, Domain, CivilianAttackPriority, ('UNITAI_ENGINEER'), Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, PrereqTech, ObsoleteTech, GoodyHutUpgradeUnitClass, HurryCostModifier, AdvancedStartCost, MinAreaSize, AirUnitCap, NukeDamageLevel, (0), NumFreeTechs, RushBuilding, (50), (5), BaseGold, NumGoldPerEra, SpreadReligion, CombatLimit, RangeAttackOnlyInDomain, RangeAttackIgnoreLOS, RangedCombatLimit, XPValueAttack, XPValueDefense, SpecialCargo, DomainCargo, Conscription, ExtraMaintenanceCost, NoMaintenance, Unhappiness,
    ('ART_DEF_UNIT_ENGINEER'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
    UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
    FROM Units WHERE (Type = 'UNIT_WORKER');
    INSERT INTO Unit_AITypes (UnitType, UnitAIType)
    SELECT ('UNIT_FASTWORKER'), UnitAIType
    FROM Unit_AITypes WHERE (UnitAIType = 'UNITAI_ENGINEER');
    INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
    SELECT ('UNIT_FASTWORKER'), FlavorType, Flavor
    FROM Unit_Flavors WHERE (UnitType = 'UNIT_ENGINEER');
     
  9. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,438
    Location:
    France
    can't see what's wrong here.

    did you change something for the original worker unit ?
     
  10. rf900

    rf900 Chieftain

    Joined:
    Jan 31, 2006
    Messages:
    194
    No change to the original worker. I have added to test the PrereqTech Agriculture to the slave, the info appears correctly in the Civipedia, but there is no icon for the Slave in the tech tree (maybe the icon does not exist for the worker).

    I am going to try and copy another unit, maybe the worker has something special to it.

    Edit: Arrgg... Added another warrior and same thing happens, I even tested the sql part separately from the LUA and DLL just in case there was something wrong there. Going to download a unit mod from someone to see what is going on.

    Well finally did it with XML and it works, try and find the differences :$

    Spoiler :
    <?xml version="1.0" encoding="utf-8"?>
    <!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Ed Beach (Firaxis Games) -->
    <GameData>
    <Units>
    <Row>
    <Class>UNITCLASS_FASTWORKER</Class>
    <Type>UNIT_FASTWORKER</Type>
    <Cost>200</Cost>
    <Moves>2</Moves>
    <Capture>UNITCLASS_FASTWORKER</Capture>
    <CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_LOW</CivilianAttackPriority>
    <Domain>DOMAIN_LAND</Domain>
    <DefaultUnitAI>UNITAI_ENGINEER</DefaultUnitAI>
    <Description>Slave</Description>
    <Civilopedia>TXT_KEY_CIV5_ANTIQUITY_WORKER_TEXT</Civilopedia>
    <Strategy>TXT_KEY_UNIT_WORKER_STRATEGY</Strategy>
    <Help>TXT_KEY_UNIT_HELP_WORKER</Help>
    <AdvancedStartCost>20</AdvancedStartCost>
    <WorkRate>100</WorkRate>
    <BaseHurry>50</BaseHurry>
    <HurryMultiplier>5</HurryMultiplier>
    <CombatLimit>0</CombatLimit>
    <UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
    <UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
    <UnitFlagIconOffset>1</UnitFlagIconOffset>
    <PortraitIndex>1</PortraitIndex>
    <IconAtlas>UNIT_ATLAS_1</IconAtlas>
    </Row>
    </Units>
    <Unit_AITypes>
    <Row>
    <UnitType>UNIT_FASTWORKER</UnitType>
    <UnitAIType>UNITAI_ENGINEER</UnitAIType>
    </Row>
    </Unit_AITypes>
    <Unit_Flavors>
    <Row>
    <UnitType>UNIT_FASTWORKER</UnitType>
    <FlavorType>FLAVOR_PRODUCTION</FlavorType>
    <Flavor>1</Flavor>
    </Row>
    </Unit_Flavors>
    <UnitClasses>
    <Row>
    <Type>UNITCLASS_FASTWORKER</Type>
    <Description>TXT_KEY_UNIT_WORKER</Description>
    <DefaultUnit>UNIT_FASTWORKER</DefaultUnit>
    </Row>
    </UnitClasses>
    </GameData>
     
  11. Olleus

    Olleus Warlord

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    I am utterly confused, and just wasted 4 hours of my life. I've added a unit in XML which uses the horseman ART_DEFINE and all worked well. Decided to add a new graphic model for the unit that I found on the website.

    Firstly, I tried to add the xml by copying the relevant parts of Civ5ArtDefines_Units.xml Civ5ArtDefines_UnitMembers.xml into an XML file in modbuddy and changing the ART_DEFINE names and the granny. That didn't work. I then found this tutorial and saw that to add the xml you used a very long winded version, why is that?

    Anyway, I tried to use the SQL method you used here, but it doesn't work, I just get a spearman. The code is:
    Code:
    <!-- skirmish cavalry based on horseman --> 
    INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
    	SELECT	('ART_DEF_UNIT_SKIRMISH_CAVALRY'), DamageStates, Formation
    	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_HORSEMAN');
    
    INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
    	SELECT	('ART_DEF_UNIT_SKIRMISH_CAVALRY'), ('ART_DEF_UNIT_MEMBER_SKIRMISH_CAVALRY'), NumMembers
    	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_HORSEMAN');
    
    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_SKIRMISH_CAVALRY'), 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_HORSEMAN');
    
    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_SKIRMISH_CAVALRY'), "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_HORSEMAN');
    
    INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
    	SELECT	('ART_DEF_UNIT_MEMBER_SKIRMISH_CAVALRY'), Scale, ZOffset, Domain, 
    			('Horseman_England.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
    	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_HORSEMAN');
    
    Any clues? The xml part which creates the new unit stats works fine.
     
  12. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,150
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Your intial questions have already been answered in this thread: In short, the civ5artdefines method doesn't work anymore after the pre-G+K patch. You can't just copy the "relevant" parts from the civ5artdefines because they're not relevant to the SQL database, which is what you're changing whether you use XML or SQL. The XML version is "long-winded" because there's a lot of things to add, where the SQL version makes a copy of an existing unit, so you don't need to create all the entries from scratch. [EDIT: That post, assuming you're talking about #9, was also showing how to piece together where all the parts of an existing unit can be found as a basis of comparison].

    Make sure you are loading the SQL with OnModActivated/UpdateDatabase in the mod properties, and that Add to VFS=true in the file properties for the 4 unit files (the .fxsxml, the .gr2, and the sref/diff .dds's).

    Your SQL looks OK at first glance, but you might check the database.log (assuming you've enabled logging).
     
  13. Olleus

    Olleus Warlord

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    Thanks for the answer, sort of clears it up in my mind.

    Found the bug, it was in the sql code, not anywhere else. Points to anyone who can spot it; rather subtle yet obvious at the same time.

    Spoiler :

    The comment at the top uses XML code, not sql code which would just be -- [comment]
     
  14. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,150
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
  15. cool3a2

    cool3a2 Chieftain

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    I am currently trying to add a unit as well. Actually, it should be a rather easy example as I'd like to add the austrian hussar as hungarian huszár to my Hungary mod. I know I could just refer to the artdefines of the austrian hussar, but I'd like to have the mod compatible with vanilla civ5. Also, I hope that someday someone will mod me a huszár art, that resembles the traditional hungarian huszár better (see unit request thread), so this is some kind of preparation.

    Now, I am not following this tutorial exactly as I can't read out the austrian hussars data as it won't be there for users of vanilla civ5. Also, I'd like to do as much as possible with xml, only the parts that would make my mod non-modular. This ways, all the unit infos are done in xml, while I do the artdefines via SQL. The unit is there in the civilopedia and I can add it via Fire Tuner, but the 3d art is not a hussar, but some tipe of spearman (I don't really play civ5, so I can't say which unit exactly it is). When I started to add the hussar, I did it via xml (non-modular) with the exact same result, so I guess that this issue is not caused by the sql. Also, I couldn't find any error in the logs.

    My sql file, reduced to a minimum of attributes inserted according to the xmls of the austrian hussar:
    Spoiler :
    Code:
    INSERT INTO ArtDefine_UnitMemberCombats (
    		UnitMemberType, HasShortRangedAttack, HasStationaryMelee,
    		ReformBeforeCombat
    	)
    	VALUES (
    		( 'ART_DEF_UNIT_MEMBER_U_HUNGARIAN_HUSZAR' ),
    		( 'ART_DEF_TEMPLATE_MOUNTED_SINGLE' ),
    		1,
    		1,
    		1
    	);
    
    INSERT INTO ArtDefine_UnitMemberCombatWeapons (
    		UnitMemberType, WeaponTypeTag, WeaponTypeSoundOverrideTag
    	)
    	VALUES (
    		( 'ART_DEF_UNIT_MEMBER_U_HUNGARIAN_HUSZAR' ),
    		( 'BULLET' ),
    		( 'BULLET' )
    	);
    
    INSERT INTO ArtDefine_UnitMemberInfos (
    		Type, Scale, Granny, MaterialTypeTag, MaterialTypeSoundOverrideTag
    	)
    	VALUES (
    		( 'ART_DEF_UNIT_MEMBER_U_HUNGARIAN_HUSZAR' ),
    		0.12,
    		( 'u_austrian_hussar.fxsxml' ),
    		( 'CLOTH' ),
    		( 'FLESH' )
    	);
    
    INSERT INTO ArtDefine_UnitInfos (
    		Type, DamageStates, Formation
    	) VALUES (
    		( 'ART_DEF_UNIT_U_HUNGARIAN_HUSZAR' ),
    		1,
    		( 'DefaultCavalry' )
    	);
    
    INSERT INTO ArtDefine_UnitInfoMemberInfos (
    		UnitInfoType,UnitMemberInfoType,NumMembers
    	)
    	VALUES (
    		( 'ART_DEF_UNIT_U_HUNGARIAN_HUSZAR' ),
    		( 'ART_DEF_UNIT_MEMBER_U_HUNGARIAN_HUSZAR' ),
    		5
    	);


    The civ5units_Hungary file which corresponds to the austrian hussars entry:
    Spoiler :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created by ModBuddy on 29.11.2012 14:39:48 -->
    <GameData>
      <!-- TODO: Insert table creation example here. -->
     
      <!-- TODO: Insert table data example here.-->
      
      <!-- Enter your Game Data here. -->
    	<Units>
    		<Row>
    			<Class>UNITCLASS_CAVALRY</Class>
    			<Type>UNIT_HUNGARIAN_HUSZAR</Type>
    			<PrereqTech>TECH_MILITARY_SCIENCE</PrereqTech>
    			<Combat>34</Combat>
    			<Cost>225</Cost>
    			<Moves>5</Moves>
    			<CombatClass>UNITCOMBAT_MOUNTED</CombatClass>
    			<Domain>DOMAIN_LAND</Domain>
    			<DefaultUnitAI>UNITAI_FAST_ATTACK</DefaultUnitAI>
    			<Description>TXT_KEY_UNIT_HUNGARIAN_HUSZAR</Description>
    			<Civilopedia>TXT_KEY_CIV5_HUNGARIAN_HUSZAR_TEXT</Civilopedia>
    			<Strategy>TXT_KEY_UNIT_HUNGARIAN_HUSZAR_STRATEGY</Strategy>
    			<Help>TXT_KEY_UNIT_HELP_HUNGARIAN_HUSZAR</Help>
    			<MilitarySupport>true</MilitarySupport>
    			<MilitaryProduction>true</MilitaryProduction>
    			<Pillage>true</Pillage>
    			<ObsoleteTech>TECH_COMBUSTION</ObsoleteTech>
    			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
    			<GoodyHutUpgradeUnitClass>UNITCLASS_WWI_TANK</GoodyHutUpgradeUnitClass>
    			<AdvancedStartCost>30</AdvancedStartCost>
    			<XPValueAttack>3</XPValueAttack>
    			<XPValueDefense>3</XPValueDefense>
    			<UnitArtInfo>ART_DEF_UNIT_U_HUNGARIAN_HUSZAR</UnitArtInfo>
    			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
    			<UnitFlagIconOffset>8</UnitFlagIconOffset>
    			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
    			<PortraitIndex>8</PortraitIndex>
    			<MoveRate>QUADRUPED</MoveRate>
    		</Row>
    	</Units>
    	<Unit_AITypes>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<UnitAIType>UNITAI_DEFENSE</UnitAIType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<UnitAIType>UNITAI_FAST_ATTACK</UnitAIType>
    		</Row>
    	</Unit_AITypes>
    	<Unit_ClassUpgrades>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<UnitClassType>UNITCLASS_WWI_TANK</UnitClassType>
    		</Row>
    	</Unit_ClassUpgrades>
    	<Unit_Flavors>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<FlavorType>FLAVOR_OFFENSE</FlavorType>
    			<Flavor>20</Flavor>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<FlavorType>FLAVOR_DEFENSE</FlavorType>
    			<Flavor>12</Flavor>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<FlavorType>FLAVOR_MOBILE</FlavorType>
    			<Flavor>14</Flavor>
    		</Row>
    	</Unit_Flavors>
    	<Unit_FreePromotions>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<PromotionType>PROMOTION_CAN_MOVE_AFTER_ATTACKING</PromotionType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<PromotionType>PROMOTION_CITY_PENALTY</PromotionType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<PromotionType>PROMOTION_EXTRA_SIGHT_I</PromotionType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<PromotionType>PROMOTION_FLANK_ATTACK_BONUS</PromotionType>
    		</Row>
    	</Unit_FreePromotions>
    	<Unit_ResourceQuantityRequirements>
    		<Row>
    			<UnitType>UNIT_HUNGARIAN_HUSZAR</UnitType>
    			<ResourceType>RESOURCE_HORSE</ResourceType>
    		</Row>
    	</Unit_ResourceQuantityRequirements>
    </GameData>


    I tried to use the austrian hussars fxsxml as well as using an altered version of that with renamed animation files and textures - no difference. Also, I set the VFS property to true for any artfile and the database is set to be updated with the sql on mod activation.

    Besides of the said issue, I have a couple of questions. Might be noob questions since I just started to mod civ5:
    1. There is no column called Defaults for the Combat table, however, there is the following line in the unitmembers.xml:
    Code:
    <Defaults>ART_DEF_TEMPLATE_MOUNTED_SINGLE</Defaults>
    What does it do and how could I simulate it via sql?
    2. Currently, I am reusing the button of the austrian hussar. For temporary use, I'd like to get the button separated to deliver it with my mod as vanilla civ5 won't have the button. I found the atlas files, but it seems chaotic. I suppose it is encrypted. Is that right or is there some way to get the button separated?
    3. Is it possible to add unique unit art without adding a unique unit? There is cool modern unit art by Danrell, but I don't want to add another unique unit for each of them. -> found it a few pages back in this thread
    4. If I got things right, you encapsulate strings in brackets in the sql file. Is that required or optional`Never seen this style before although I've studied computer sciences.
    5. In terms of sql dialect, what type of sql database is used by civ5? Without being familiar with MySQL, I'd suppose this is one as it would be free to use. -> SQLite
     
  16. cool3a2

    cool3a2 Chieftain

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    Okay, I figured out how to fix my main issue. There was a message in the logs indicating the problem, but as it looked harmless and did not refer to my file, I did not notice it. The reason was, that although I had removed the column name for the Defaults value (ArtDefine_UnitMemberCombats), but left the value to be inserted there. Thus, I tried to insert 5 values into 4 columns which was roughly the error message in the log. Also, I did not provide the Index and SubIndex Columns (ArtDefine_UnitMemberCombatWeapons), which I now do using "Index" and "SubIndex". Finally, I changed the order of the statements a bit, not sure if that plays a role, but I could imagine that.

    2 of the 5 additional questions are also answered for me, now, yet I'd still be curious to now about the others. And I'd like to add that although I was able to find the databases and look them up according to the Modders Guide, I noticed that there are no entries about the data coming with my mod or even Gods and Kings. For example, there are units and also unique units, but there is no hussar, not even the austrian. Couldn't find the Hun units either, actually not even the Civs are there. On the other side, the db files partially seem to get a fresh change date. Are there more files elsewhere for G&K or am I doing something wrong?
     
  17. trystero49

    trystero49 Chieftain

    Joined:
    Apr 30, 2012
    Messages:
    515
    There are separate folders for DLC files. For example, Vanilla xml files are in Assets/Gameplay/XML, DLC files for Vanilla are in Assets/DLC/DLC01 (or 02, 03, etc). Base .xml files for G&K are in Assets/DLC/Expansion/Gameplay/XML, and updated DLC files for G&K can be found in Assets/DLC/Expansion/DLC/DLC01 (or 02, 03, etc).

    In other words, you might as well just look at the db debug file and save yourself the trouble of searching through all the folders trying to find what you want, unless you are looking to copy large amounts of the files, or you are looking for something that hasn't loaded in your db file (for example, you want to find information on a scenario).
     
  18. cool3a2

    cool3a2 Chieftain

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    Ah... I see it's the Civ5DebugDatabase.db file and the screen to view the db tables has more than just one page. Thanks for pointing me in the right direction!
     
  19. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,150
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    @cool3a2:
    I'm not sure what your point is in using XML over SQL for some things and not others; either way, you're making changes to a SQL database. I would find it easier to use SQL to make a copy of a vanilla cavalry unit as a starting point (since you don't want to assume Austria is present).

    If you're trying to maintain compatibility with G+K and vanilla, realize that the columns differ in the Units table.

    1. AFAIK, you can't take advantage of those templates, but for Firaxis they provide default entries for unit types so all entries don't need to be redefined for every unit. Obviously, you're going to have a problem using the files that you posted because you're missing all of the entries that such a template would have provided. As above, I would suggest you copy a vanilla unit (using a INSERT INTO... SELECT) as a starting point and only make the necessary changes.
    2. Use DDS unpacker. It will convert the files (filename.dds and filename-index.dds) to PNG, which can be modified and exported back to a single DDS file for use in your mod.
    3.
    4. It's not required, it just makes it easier to tell which entries are being changed (i.e., where it's not just the name of the column). EDIT: See Gedemon's post #121 below.
    5.
     
  20. cool3a2

    cool3a2 Chieftain

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    I don't see the point either, but it seems to me that I'm somewhat forced to. I don't think that sql is a that clever solution. It's not a problem for me as I am used to work with sql in business live. But for starters, sql will be harder. To use sql, you'll need to have a clue about the tables being used internally and you have to write a lot syntactic suggar. This ways, I did as much as possible with xml, to keep things as easy as possible for others. Yet I was forced to use sql to have the artdefines modular (at least, the tutorial here sounds like those artdefines files are still not modular, which is also supported by the modders guide).

    Hmmm... I was hoping that this would not be the case. Well, maybe I create two separate versions of the mod as I suppose there is no chance to tell the game "use this file if you are vanilla civ5 or this if you are G&K"... I see another possible advantage of xml here as looking them up and comparing them is easier then checking the tables, I'd say, at lost for most people.

    Which is a downside of the sql approach. Well, I figured that out myself meanwhile and looked up the table for the austrian hussar to see which values are set. I'm now setting these values manually as I don't consider the solution of reusing an existing unit that good as you really rely on it. Consider a scenario mod where the cavalry has been removed (maybe even via a new artdefine xml). Don't get me wrong: I don't want to critize you guys for suggesting it here, it may suit a lot of cases. Still, I don't want to restrict myself on this.

    Okay, thank you!

    Okay.
     

Share This Page