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,666
    Location:
    France
    I've finally taken the time to update the first post to the post-patch .674 method. :D

    XML can be used to update the tables of course, but then you can't use a template unit for reference.

    The bracket syntax is required for the code using a template like

    Code:
    INSERT INTO table_name (column1, column2, column3,...)
    	SELECT ('newValue'), value2, value3,...
    	FROM table_name WHERE (column1= 'templateName');
    it's not needed for "manual" entries like

    Code:
    INSERT INTO table_name (column1, column2, column3,...)
    	VALUES (value1, value2, value3,...);
     
  2. cool3a2

    cool3a2 Deity

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    I know that xml can be used, but will the artdefines files be modular? According to the modders guide, they can't be made modular. Well, the modders guide may be obsolete. Although it is helpful, it should be made clear if it contains information that are incorrect now...

    As of sql vs. xml, I don't see the big advantage. If you prefer to use sql, it is of course your decision. But practically, using the sql approach makes you rely on another unit. Even if the artdefines files should be modular now, it would likely be possible to delete entries from there as well. As said before, if there is a mod that removes your template unit, your mod won't work anymore as the select will fail or deliver an empty result (null). And as I said before, sql will be harder for absolute beginners to mod as the internal tables are harder to look up and understand (not to mention sql itself). With xml, however, you can simply copy defines from a different unit (there's your template) and likely even reuse the templates that Firaxis provided with the Defaults entry (even another template you could reuse). Also, you'll have to write less code as most of the xml will be copied, only a few values will be altered. In contrast to that, one will have to write a lot of sql to mod in a unit that should not reuse another unit to not rely on it. And the sql will be 'error-friendly', just consider one accidently swaps two columns. So, my opinion is, that xml would be the better and cleaner solution and I'd switch to it if the artdefines should be modular now. Also, if they should be now, I'd be happy if you could describe both ways as alternative approaches, mentioning their pros and cons.

    Having checked the austrian hussar and whether there are entries in its xmls that have been introduced with G&K, there does not some to be any new entry. The only two differences are that the flanking promotion wasn't there before G&K and the cavalry was upgraded to tank, not wwi_tank. So, if there are differences between the db tables (which I didn't check), they are handled by some code, which would be another advantage of xml. On the other side, the hussar might be a special case if it does not use any of the new entries.

    EDIT: and thanks for explaining the brackets. I'll remove them then.
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,666
    Location:
    France
    Thanks, I've edited the first post here to reflect the change from patch .674 : the artdefine files are now "modular" (read: they are loaded in the database) and you can't override the 2 original files anymore.

    Adding new entries is done using the SQL or XML syntax used to modify tables.

    Right for some points, I have also edited the first post to add a warning about the use of template in case the unit we copy data from is deleted by another mod.

    I disagree on the "less code" and "cleaner" parts.

    About "less code" the point of the template being to copy all the values, and, when fully optimized like in R.E.D. Modpack it saves a lot of time when you deal with a lot of units. For that mod, I just need one line of code to add a new unit. Yes, a single line.

    About cleaner, it's also about optimization and formatting, see here.

    About easier, that's true I suppose, especially when coming from Civ4 modding, once the concept of updating the database using the XML file instead of replacing (or adding code to) another one is grasped. Note that it's slightly different from modular loading (IIRC modular XML from civ4).

    The new entries are in CIV5Units_Expansion.xml (search in assets\DLC\Expansion folder)

    edit:

    And the art defines files are in \Assets\DLC\Expansion\Units folder.

    Note that DLC' XML files (and G+K) are not loaded the same way as mod's XML files. They are loaded during the game initialization, before the main menu is visible, and using a truly modular method I suppose.
     
  4. cool3a2

    cool3a2 Deity

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    Thanks, then I'll switch back to xml.

    As of pros and cons, I suppose it is a matter of what the modder wants to do and of course, of personal taste. I am working on a mod adding a single civ that should be as compatible as possible as it is likely to be combined with others. Thus, relying on other units should be limited. Having said this, adding the huszár via sql felt rather unhandy. R.E.D. is a modpack used for larger mods where people know what they do anyways and that introduces some kind of standard that makes sure that certain units are there. In this case, I can imagine that sql might be handier. Well, at least the two approaches don't seem to be incompatible per-se, so everyone can use what he prefers.

    As of the changes regarding the entries introduced with G&K, I was refering to Nuttys post. I know where to find the files, I meant that I couldn't find so much differences between the old and the new xmls structures. Promotions and units, as well as some other definitions are missing, yet I didn't spot any structural differences, at least as far as it touchs my mod.
    However, I have problems like the hussar should upgrade to tank for vanilla civ5, but to wwi_tank for G&K. I was able to solve this certain issue by using a short sql script to dynamically correct the upgrade definitions, but it's rather ugly. It would be cool if the version / DLC used could be determined somehow via sql to make a few manual corrections. Unfortunately, I could not find any table providing the necessary information. Also, some kind of script lanugae wourd be required. Kaels modders Guide suggests that loops can be used in the sql files, but they produced errors for me. I suppose something got mixed up with the lua part of the tutorial. So, I guess I have to create to separate mods for vanilla and G&K.
     
  5. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,666
    Location:
    France
    exactly.

    it's because of this:
    More precisely, for unit stats the XML syntax is the same to what you'll use to add a new unit, but for artdefine they use a parser that is not the one used for mods.

    example, in Civ5ArtDefines_Expansion_Units.xml you have entry like that:
    Code:
    <UnitArtInfos>
     <!-- UNIT_GREAT_ADMIRAL ************************************************ -->
      <UnitArtInfo>
        <Type>ART_DEF_UNIT_GREAT_ADMIRAL</Type>
        <Formation>DefaultCavalry</Formation>
        <DamageStates>1</DamageStates>
        <UnitMemberArt>
          <MemberType>ART_DEF_UNIT_MEMBER_GREAT_ADMIRAL</MemberType>
          <MemberCount>1</MemberCount>
        </UnitMemberArt>
      </UnitArtInfo>
    
    [...]
    
    </UnitArtInfos>
    But this code used in a mod will fail.

    First it doesn't tell the parser to update a table by starting with

    Code:
    <GameData>
    	<TableName>
    		<Row>
    And if you add the correct code note that the table a mod must update is not UnitArtInfos or UnitArtInfo but ArtDefine_UnitInfo and then that there is no Type column in that table, but UnitInfoType, there is no Formation column in that table (it's in another one), UnitMemberArt is unknown for the database, and the 2 sub-tags MemberType and MemberCount are respectively UnitMemberInfoType and NumMembers in the DB...
     
  6. cool3a2

    cool3a2 Deity

    Joined:
    Mar 30, 2007
    Messages:
    2,177
    Yeah, just figured that out myself... It seems like not even the templates work exactly like one would expect. I looked up the template the austrian hussar uses, which uses another template, which then again uses a template. If I merge all the attributes from all three templates, the EnableActions column will differ from what the austrian hussar actually has in the db. Also, the templates contain a DeathRotationAmount, which is nowhere in the db, it seems. Well, if a db could be maintained that contains all the artdefines in a clean - e.g. translated - form, things would be easier via xml, I believe. Requiring beginners to translate the templates and the column and table names will be over the top for much of them. This ways, your method gains some attraction although I still prefer it the xml way as it is independent and will be a bit easier to read if modmodded. Hell, they truely didn't make it really beginner friendly.
     
  7. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    It's not really that hard; I think it's only hard for those coming from Civ4 modding. The trick is to completely ignore the game's XML files, and just look at the database itself with a db viewer (e.g., SQLite Manager for Firefox or SQLite Administrator or SQLite Browser or SQLiteSpy).

    From there you can use either SQL or XML to make changes.
     
  8. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    Yeeesh... as a total newbie to Civ modding, I've finally gotten to the point where I want to try to start adding some of the unique unit art people have developed to make UU's for some of my new civilizations and mods... but the hurdle looks intimidatingly high. D:

    So far I've been using XML to make my UUs and the like, and I've been able to port over units that other people have used in their mods and get them working (finally! It took me forever to figure out which files need VFS set to true and such...), but the next step of adding new art defines to my own units is rather confusing. Since my current plans do rely on existing units (typically tanks and infantry) I should be able to use the SQL method for that, and just rely on my XML code to refer to those artdefines...?

    I think I'll need to reread Gedemon's post to figure out which parts I need to add to set up the artdefines, and which parts I don't (since I'm using XML for the unit statistics and such)...
     
  9. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,666
    Location:
    France
    in the updated OP, step 4 is for the art defines, step 5 is for the stats.

    if you already have the stats working in XML, skip step 5, just make sure you've set the <UnitArtInfo> tag of your unit's XML definition to point to the art define type you're using in step 4 (ART_DEF_UNIT_BIPLAN in the OP example).
     
  10. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    Ahhh, I see! I wasn't sure how dependent it was on having part 5 in SQL. Thinking about it, though, some of the units I ported over did do the same thing -- stats in XML with the artdefines in SQL -- so it does make sense that it'd work that way.

    Now I just need to figure out which units some models use as a base -- I want to try adding new units using the British Whippet and the Railroad Artillery models, but I'm not sure if they're based on Tanks or one of the other units...

    Thanks for the help, Gedemon!
     
  11. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    @Gedemon,

    You can do the Step 4 SQL in a more elegant way without listing all the column names that you aren't changing anyway. Here's how I did it for my new Druid unit, which is based on the barb euro alpha (the guy with the deer horns) model:

    Code:
    INSERT INTO ArtDefine_UnitInfos (Type,	DamageStates,	Formation)
    SELECT 'ART_DEF_UNIT_EA_DRUID',		1,		''	;
    
    INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,	UnitMemberInfoType,		NumMembers)
    SELECT 'ART_DEF_UNIT_EA_DRUID',					'ART_DEF_UNIT_MEMBER_EA_DRUID',	1	;
    
    
    CREATE TABLE ArtDefine_UnitMemberInfos_Temp AS SELECT * FROM ArtDefine_UnitMemberInfos WHERE Type IN ('ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA');[COLOR="lime"]	--add any other members in the parentheses separated by commas[/COLOR]
    UPDATE ArtDefine_UnitMemberInfos_Temp SET Type = 'ART_DEF_UNIT_MEMBER_EA_DRUID', Scale = 0.25[COLOR="DeepSkyBlue"], Model = 'your_new_model.fxsxml'[/COLOR] WHERE Type = 'ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA';
    [COLOR="Lime"]--update additional members here[/COLOR]
    INSERT INTO ArtDefine_UnitMemberInfos SELECT * FROM ArtDefine_UnitMemberInfos_Temp;
    DROP TABLE ArtDefine_UnitMemberInfos_Temp;
    
    CREATE TABLE ArtDefine_UnitMemberCombats_Temp AS SELECT * FROM ArtDefine_UnitMemberCombats WHERE UnitMemberType IN ('ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA');
    UPDATE ArtDefine_UnitMemberCombats_Temp SET UnitMemberType = 'ART_DEF_UNIT_MEMBER_EA_DRUID' WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA';
    INSERT INTO ArtDefine_UnitMemberCombats SELECT * FROM ArtDefine_UnitMemberCombats_Temp;
    DROP TABLE ArtDefine_UnitMemberCombats_Temp;
    
    CREATE TABLE ArtDefine_UnitMemberCombatWeapons_Temp AS SELECT * FROM ArtDefine_UnitMemberCombatWeapons WHERE UnitMemberType IN ('ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA');
    UPDATE ArtDefine_UnitMemberCombatWeapons_Temp SET UnitMemberType = 'ART_DEF_UNIT_MEMBER_EA_DRUID' WHERE UnitMemberType = 'ART_DEF_UNIT_MEMBER_BARBARIAN_EURO_ALPHA';
    INSERT INTO ArtDefine_UnitMemberCombatWeapons SELECT * FROM ArtDefine_UnitMemberCombatWeapons_Temp;
    DROP TABLE ArtDefine_UnitMemberCombatWeapons_Temp;
    I was using existing unit art in the above code, but the blue text shows where the model would be updated. The first line of each of the last three sections creates a temp table with the exact structure of the base table (without enumerating columns yourself). Perhaps it's unlikely, but if Firaxis ever changes a column name or adds a column with some essential data (say in the next expansion) then you would need to update your columns if you list them. This method will not need an update.

    One thing I'm not sure is correct is my use of an empty string for Formation. I did that because a lot of these appear to be blank but not NULL in the existing database (and it worked for my single unit graphic here).
     
  12. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Hm. Something similar should probably be the method for the Units table as well, to allow compatibility with both vanilla and G+K (assuming G+K specific columns aren't required for the unit in question).
     
  13. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,666
    Location:
    France
    More elegant, yes, but more difficult to grasp for a beginner maybe :think:

    I like it anyway, I'll add a second post with your method when I got some time :D

    And if someone has a XML template for the ArtDefines, I'll add it to the thread too.
     
  14. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    From whoward69's "Units - Galleon (GK) (v 2)":
    Spoiler UnitsGalleonArt.xml :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
      <ArtDefine_UnitInfos>
        <Row>
          <Type>ART_DEF_UNIT_MOD_GALLEON</Type>
          <DamageStates>1</DamageStates>
          <Formation>TwoBigGuns</Formation>
        </Row>
      </ArtDefine_UnitInfos>
    
      <ArtDefine_UnitInfoMemberInfos>
        <Row>
          <UnitInfoType>ART_DEF_UNIT_MOD_GALLEON</UnitInfoType>
          <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_MOD_GALLEON</UnitMemberInfoType>
          <NumMembers>1</NumMembers>
        </Row>
      </ArtDefine_UnitInfoMemberInfos>
    
      <ArtDefine_UnitMemberInfos>
        <Row>
          <Type>ART_DEF_UNIT_MEMBER_MOD_GALLEON</Type>
          <Scale>0.14</Scale>
          <Domain>Sea</Domain>
          <Model>Assets/Units/Galleon/Galleon.fxsxml</Model>
          <MaterialTypeTag>WOOD</MaterialTypeTag>
          <MaterialTypeSoundOverrideTag>WOODLRG</MaterialTypeSoundOverrideTag>
        </Row>
      </ArtDefine_UnitMemberInfos>
    
      <ArtDefine_UnitMemberCombats>
        <Row>
          <UnitMemberType>ART_DEF_UNIT_MEMBER_MOD_GALLEON</UnitMemberType>
          <EnableActions>Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady AttackSurfaceToAir</EnableActions>
          <DisableActions></DisableActions>
          <HasShortRangedAttack>1</HasShortRangedAttack>
          <HasLeftRightAttack>1</HasLeftRightAttack>
          <HasRefaceAfterCombat>0</HasRefaceAfterCombat>
          <HasIndependentWeaponFacing>1</HasIndependentWeaponFacing>
        </Row>
      </ArtDefine_UnitMemberCombats>
    
      <ArtDefine_UnitMemberCombatWeapons>
        <Row>
          <UnitMemberType>ART_DEF_UNIT_MEMBER_MOD_GALLEON</UnitMemberType>
          <Index>0</Index>
          <SubIndex>0</SubIndex>
          <VisKillStrengthMin>10</VisKillStrengthMin>
          <VisKillStrengthMax>20</VisKillStrengthMax>
          <HitEffect>ART_DEF_VEFFECT_CANNON_IMPACT_$(TERRAIN)</HitEffect>
          <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
          <WeaponTypeSoundOverrideTag>EXPLOSION6POUND</WeaponTypeSoundOverrideTag>
        </Row>
      </ArtDefine_UnitMemberCombatWeapons>
    
      <ArtDefine_StrategicView>
        <Row>
          <StrategicViewType>ART_DEF_UNIT_MOD_GALLEON</StrategicViewType>
          <TileType>Unit</TileType>
          <Asset>SV_ModGalleon.dds</Asset>
        </Row>
      </ArtDefine_StrategicView>
    </GameData>


    And while I'm at it...
    Spoiler UnitsGalleon.xml :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
    	<UnitClasses>
    		<Row>
    			<Type>UNITCLASS_GALLEON</Type>
    			<Description>TXT_KEY_UNIT_GALLEON</Description>
    			<DefaultUnit>UNIT_GALLEON</DefaultUnit>
    		</Row>
    	</UnitClasses>
    
    	<Units>
    		<Row>
    			<Class>UNITCLASS_GALLEON</Class>
    			<Type>UNIT_GALLEON</Type>
    			<PrereqTech>TECH_STEAM_POWER</PrereqTech>
    			<Combat>40</Combat>
    			<Cost>250</Cost>
    			<Moves>4</Moves>
    			<HurryCostModifier>20</HurryCostModifier>
    			<CombatClass>UNITCOMBAT_NAVALMELEE</CombatClass>
    			<Domain>DOMAIN_SEA</Domain>
    			<DefaultUnitAI>UNITAI_ATTACK_SEA</DefaultUnitAI>
    			<Description>TXT_KEY_UNIT_GALLEON</Description>
    			<Civilopedia>TXT_KEY_UNIT_GALLEON_TEXT</Civilopedia>
    			<Strategy>TXT_KEY_UNIT_GALLEON_STRATEGY</Strategy>
    			<Help>TXT_KEY_UNIT_GALLEON_HELP</Help>
    			<MilitarySupport>true</MilitarySupport>
    			<MilitaryProduction>true</MilitaryProduction>
    			<Pillage>true</Pillage>
    			<Mechanized>true</Mechanized>
    			<ObsoleteTech>TECH_COMBUSTION</ObsoleteTech>
    			<AdvancedStartCost>50</AdvancedStartCost>
    			<MinAreaSize>20</MinAreaSize>
    			<XPValueAttack>3</XPValueAttack>
    			<XPValueDefense>3</XPValueDefense>
          <UnitArtInfo>ART_DEF_UNIT_MOD_GALLEON</UnitArtInfo>
          <UnitFlagAtlas>UNITS_GALLEON_FLAG_ATLAS</UnitFlagAtlas>
          <UnitFlagIconOffset>0</UnitFlagIconOffset>
          <IconAtlas>UNITS_GALLEON_ICON_ATLAS</IconAtlas>
          <PortraitIndex>0</PortraitIndex>
          <MoveRate>BOAT</MoveRate>
    		</Row>
    
        <Update>
          <Where Class="UNITCLASS_FRIGATE"/>
          <Set ObsoleteTech="TECH_STEAM_POWER"/>
        </Update>
    
        <Update>
          <Where Type="UNIT_IRONCLAD"/>
          <Set>
            <CombatClass>UNITCOMBAT_NAVALRANGED</CombatClass>
            <Cost>300</Cost>
            <Combat>45</Combat>
            <RangedCombat>50</RangedCombat>
            <Range>2</Range>
            <ObsoleteTech>TECH_ELECTRONICS</ObsoleteTech>
          </Set>
        </Update>
      </Units>
    
    	<Unit_AITypes>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<UnitAIType>UNITAI_ATTACK_SEA</UnitAIType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<UnitAIType>UNITAI_RESERVE_SEA</UnitAIType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<UnitAIType>UNITAI_ESCORT_SEA</UnitAIType>
    		</Row>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<UnitAIType>UNITAI_EXPLORE_SEA</UnitAIType>
    		</Row>
    
        <Delete UnitType="UNIT_IRONCLAD" UnitAIType="UNITAI_ATTACK_SEA"/>
        <Row>
          <UnitType>UNIT_IRONCLAD</UnitType>
          <UnitAIType>UNITAI_ASSAULT_SEA</UnitAIType>
        </Row>
      </Unit_AITypes>
    
    	<Unit_Flavors>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<FlavorType>FLAVOR_NAVAL</FlavorType>
    			<Flavor>5</Flavor>
    		</Row>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<FlavorType>FLAVOR_NAVAL_RECON</FlavorType>
    			<Flavor>6</Flavor>
    		</Row>
    	</Unit_Flavors>
    
    	<Unit_FreePromotions>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<PromotionType>PROMOTION_EXTRA_SIGHT_I</PromotionType>
    		</Row>
    
        <Row>
          <UnitType>UNIT_IRONCLAD</UnitType>
          <PromotionType>PROMOTION_ONLY_DEFENSIVE</PromotionType>
        </Row>
      </Unit_FreePromotions>
    
    	<Unit_ClassUpgrades>
    		<Row>
    			<UnitType>UNIT_GALLEON</UnitType>
    			<UnitClassType>UNITCLASS_DESTROYER</UnitClassType>
    		</Row>
    
    		<Update>
    			<Where UnitType="UNIT_CARAVEL"/>
    			<Set UnitClassType="UNITCLASS_GALLEON"/>
    		</Update>
        <Update>
          <Where UnitType="UNIT_KOREAN_TURTLE_SHIP"/>
          <Set UnitClassType="UNITCLASS_GALLEON"/>
        </Update>
    
        <Update>
          <Where UnitType="UNIT_FRIGATE"/>
          <Set UnitClassType="UNITCLASS_IRONCLAD"/>
        </Update>
        <Update>
          <Where UnitType="UNIT_ENGLISH_SHIPOFTHELINE"/>
          <Set UnitClassType="UNITCLASS_IRONCLAD"/>
        </Update>
    
        <Update>
          <Where UnitType="UNIT_IRONCLAD"/>
          <Set UnitClassType="UNITCLASS_BATTLESHIP"/>
        </Update>
      </Unit_ClassUpgrades>
    
      <Unit_ResourceQuantityRequirements>
        <Row>
          <UnitType>UNIT_GALLEON</UnitType>
          <ResourceType>RESOURCE_IRON</ResourceType>
        </Row>
        <Row>
          <UnitType>UNIT_DESTROYER</UnitType>
          <ResourceType>RESOURCE_IRON</ResourceType>
        </Row>
      </Unit_ResourceQuantityRequirements>
      
      <Language_en_US>
    		<Row Tag="TXT_KEY_UNIT_GALLEON">
    			<Text>Galleon</Text>
    		</Row>
    		<Row Tag="TXT_KEY_UNIT_GALLEON_HELP">
    			<Text>Fast Renaissance exploration Unit with a large sight radius.</Text>
    		</Row>
    		<Row Tag="TXT_KEY_UNIT_GALLEON_STRATEGY">
    			<Text>The Galleon is a major upgrade to a civilization's naval power. A Ranged unit, it is stronger and faster than a Caravel, and it can enter Deep Ocean hexes. The Galleon has a large sight radius, making it the eyes and ears of the mid-game navy.</Text>
    		</Row>
    		<Row Tag="TXT_KEY_UNIT_GALLEON_TEXT">
    			<Text>The gallen was a mid-size, seagoing vessel used in the 17th century to exploit the world, being an upgrade of the earlier Caravel.</Text>
    		</Row>
    
    		<Update>
    			<Where Tag="TXT_KEY_UNIT_HELP_CARAVEL"/>
    			<Set Text="Fast Medieval exploration Unit with a large sight radius."/>
        </Update>
    
        <Update>
          <Where Tag="TXT_KEY_UNIT_IRONCLAD_STRATEGY"/>
          <Set>
            <Text>Ironclads are the first steam-powered warships available. Fighting as a naval ranged unit, they are harder to kill than any sailing vessel, and their Combat strength is higher. Use them primarily for in-shore defense and to assault cities.</Text>
          </Set>
        </Update>
        <Update>
          <Where Tag="TXT_KEY_UNIT_HELP_IRONCLAD"/>
          <Set>
            <Text>A very powerful naval ranged unit, the Ironclad pays for its strength by being slower in ocean tiles.</Text>
          </Set>
        </Update>
      </Language_en_US>
    </GameData>

    Spoiler UnitsGalleonIcons.xml :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
      <IconTextureAtlases>
        <Row>
          <Atlas>UNITS_GALLEON_ICON_ATLAS</Atlas>
          <IconSize>256</IconSize>
          <Filename>ART/Galleon256.dds</Filename>
          <IconsPerRow>8</IconsPerRow>
          <IconsPerColumn>6</IconsPerColumn>
        </Row>
        <Row>
          <Atlas>UNITS_GALLEON_ICON_ATLAS</Atlas>
          <IconSize>128</IconSize>
          <Filename>ART/Galleon128.dds</Filename>
          <IconsPerRow>8</IconsPerRow>
          <IconsPerColumn>6</IconsPerColumn>
        </Row>
        <Row>
          <Atlas>UNITS_GALLEON_ICON_ATLAS</Atlas>
          <IconSize>80</IconSize>
          <Filename>ART/Galleon80.dds</Filename>
          <IconsPerRow>8</IconsPerRow>
          <IconsPerColumn>6</IconsPerColumn>
        </Row>
        <Row>
          <Atlas>UNITS_GALLEON_ICON_ATLAS</Atlas>
          <IconSize>64</IconSize>
          <Filename>ART/Galleon64.dds</Filename>
          <IconsPerRow>8</IconsPerRow>
          <IconsPerColumn>6</IconsPerColumn>
        </Row>
        <Row>
          <Atlas>UNITS_GALLEON_ICON_ATLAS</Atlas>
          <IconSize>45</IconSize>
          <Filename>ART/Galleon45.dds</Filename>
          <IconsPerRow>8</IconsPerRow>
          <IconsPerColumn>6</IconsPerColumn>
        </Row>
    
        <Row>
          <Atlas>UNITS_GALLEON_FLAG_ATLAS</Atlas>
          <IconSize>32</IconSize>
          <Filename>ART/GalleonFlag.dds</Filename>
          <IconsPerRow>1</IconsPerRow>
          <IconsPerColumn>1</IconsPerColumn>
        </Row>
      </IconTextureAtlases>
    </GameData>
     
  15. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    Hrm.... so, not sure if I should ask some more specific questions here or not!

    So I've been looking over the art files from the Tiny Death Robots mod, which has the same entries as Gedemon's SQL file but in XML format. However, I can't really copy over the appropriate information for a Tank since the data in the Civ 5 artdefines is all arranged differently. (I think one of the earlier posts discussed this, saying that Civ V goes and rearranges the artdefines data while its loading the game...) Still, it's helping me figure out some of the data I want to change in the SQL, such as the number of members in the unit.

    The big question currently on my mind, though, is what happens if I change the attack data? I'm currently trying to add the Railroad Artillery to my game, which is apparently designed to use the Tank data. That's fine, I can just use the SQL code to copy of the data... however, I designed my Railroad Artillery as an artillery unit, giving it a ranged attack. Units like Artillery and the Anti-Tank Gun have "<HasLongRangedAttack>1</HasLongRangedAttack>", but the Tank doesn't. Is the code going to break if I try to make an artillery attack with my Railroad Artillery if it doesn't have the HasLongRangedAttack tag? If I add the tag, is the model going to break if I try to make a ranged attack with it? Or does it really matter, since the Anti-Tank Gun is a melee unit, and still has the tag...?
     
  16. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,350
    Location:
    Near Portsmouth, UK
    Beat me to it :)
     
  17. fuzzy_bunnies

    fuzzy_bunnies Prince

    Joined:
    May 28, 2004
    Messages:
    325
    I'm trying to follow along here and having a hard time... I'm adding about 10 new units into a stand-alone mod. I have all the abilities, tech requirements, stats etc all set in XML but when using another existing unit's <UnitArtInfo> line in civ5units, the unit doesn't show up. If I create a unitartinfo entry in xml, then the unit shows up but everything looks like spearmen.

    I would really prefer to use XML if at all possible. I don't have a TON of units to add in but XML makes a lot more sense to me.

    So with the current patch and G&K, after creating the unitinfo files and the unitclass, can I create a new unitartinfo file with just my addition or no? Or can I not do it with XML? Alternately, is there an XML version of this tutorial thats up to date?
     
  18. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
  19. fuzzy_bunnies

    fuzzy_bunnies Prince

    Joined:
    May 28, 2004
    Messages:
    325
    Thanks, I'll take a closer look though that seems to imply you need new info in all of those tables but I'm not sure thats the case?

    Second question: I understand its possible to mix units via unitartinfos but does anyone know if you can assign normally non-combat models that way? For example, I want to make some civilian militia, I want to use the worker model and the combat animations... is that possible? OR mix some riflemen and some workers etc.

    I'm trying to figure out if that's one of the reasons for the spearmen? Or possibly cause the custom units file to not load at all? Currently I'm trying to track down something thats causing none of my units to load by eliminating entries. I've narrowed it down to a couple that seem to break the mod.
     
  20. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,666
    Location:
    France
    I think that you can't use combat animation on a civilian models without exporting/editing the .gr2 file, but you can mix civilian and military models in the same unit.

    Edit: I've added Whoward69' Galleon XML code to the second post, thanks !
     

Share This Page