Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > Civ5 - Modding Tutorials & Reference

Notices

Reply
 
Thread Tools
Old May 10, 2012, 12:17 PM   #1
Gedemon
Moderator
 
Gedemon's Avatar
 
Join Date: Oct 2004
Location: France
Posts: 3,762
Add a new unit in the game (using SQL)

This tutorial is a step by step to add a new unit in the game, it won't covert the creation of a new unit model, there are other tutorials about that.

It assumes that you know how to create a basic mod, and understand the meaning of "OnModActivated"

It applies for Civilization and G+K post patch .674, since that patch you don't have (and in fact can't) to replace Civ5ArtDefines_UnitMembers.xml and Civ5ArtDefines_Units.xml. The only file related to units which is still not loaded to the Database (and so have to be replaced in a mod using the VFS property) is unitformations.xml. But unless you want to change the default formations, you won't need it.

Note that previous version of the tutorials made a bad use of double-quote in the SQL code, see here why you shouldn't use them and please refer to the now corrected code.

The exception for using double-quote is when a SQL keyword is used as a table of column name, as it is the case with "Index" column in ArtDefine_UnitMemberCombats table (see code in step 4)


Pre-required : Right click your mod project in the Solution explorer windows, select "properties", go in the "Mod Info" panel, and check the "Reload Unit System" in the "Systems" section.


step 1 : For the tutorial, we're taking the example of the biplan from this danrell's units pack, supposing that we want to add a WW1 era fighter to civ5 vanilla.

Here are the files requested by this unit model:

EarlyFighter_Generic_gloss.dds
EarlyFighter_Generic.gr2
EarlyFighter_Generic.fxsxml
EarlyFighter_Generic.dds

All this files must be copied in your project and have the VFS property set to "true". I'll suggest you to organize your project using folders and subfolders if you have to put many files in it, the VFS will not care for the relative path.

Danrell also provide the blend file and a jpg screenshot, those are not needed in your mod, but the blend is a must for those who want to edit the model itself, go and thanks him again for his work


step 2 : create a new sql file in your project (right click the project name or one of it's subfolder in the Solution Explorer windows, select "Add", "New Item..." and Game Rules (SQL)

Rename it, or keep the original Game Rules1.sql. You don't need to set the VFS to true for that file, but you have to add an UpdateDatabase entry for it.


step 3 : For that right click your mod project in the Solution explorer windows, select "properties", go in the "Action" panel, click "Add...", select "OnModActivated" as event, "UpdateDatabase" as Action, and point File to your newly created SQL file.

As this is a step by step mod, I won't detailed the SQL commands used here, just follow the steps and all will goes well (I hope )

An XML tutorial may be more user friendly, but I really found the SQL method more efficient.


step 4 : Now open the sql file and add the following code to it :

Code:
INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
	SELECT	('ART_DEF_UNIT_BIPLAN'), DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_FIGHTER');

INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_BIPLAN'), ('ART_DEF_UNIT_MEMBER_BIPLAN'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_FIGHTER');

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_BIPLAN'), 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_FIGHTER');

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_BIPLAN'), "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_FIGHTER');

INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_BIPLAN'), Scale, ZOffset, Domain, ('EarlyFighter_Generic.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_FIGHTER');

INSERT INTO ArtDefine_StrategicView (StrategicViewType, TileType, Asset )
	SELECT	('ART_DEF_UNIT_BIPLAN'), TileType, Asset
	FROM ArtDefine_StrategicView WHERE (Type = 'ART_DEF_UNIT_FIGHTER');
In red the reference for the new unit, in blue the reference of the unit we use as a template for the new one.

This code define the visual effects for the new unit. I use a "template" unit for reference, so I don't have to manually set each entry, but have the SQL code copy them from the "template" unit (here the normal fighter) and only change those that are needed.

Using a template is much faster, but you have to be sure that no other mods will delete the unit you're using as a template. Mods compatibility depend of the loading order and can sometimes be assured using associations, but that's another subject.

You can still use SQL to add new entries without duplicating another unit's entry using this syntax:

Code:
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...);
Horem has posted a complete SQL template here.

but you may find it easier to use XML in that case, see the second post for an example from whoward69.


step 5 : Below is the code for the new unit statistics, add it after in the sql file :

Code:
INSERT INTO UnitClasses (Type, Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, DefaultUnit )
	SELECT ('UNITCLASS_BIPLAN'), Description, MaxGlobalInstances, MaxTeamInstances, MaxPlayerInstances, InstanceCostModifier, ('UNIT_BIPLAN')
	FROM UnitClasses WHERE (Type = 'UNITCLASS_FIGHTER');

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_BIPLAN'), ('Biplan'), Civilopedia, Strategy, Help, Requirements,
			Combat, (25), (250), Moves, Immobile, (5), BaseSightRange, ('UNITCLASS_BIPLAN'), 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_BIPLAN'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
			UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
	FROM Units WHERE (Type = 'UNIT_FIGHTER');

INSERT INTO Unit_AITypes (UnitType, UnitAIType)
	SELECT ('UNIT_BIPLAN'), UnitAIType
	FROM Unit_AITypes WHERE (UnitType = 'UNIT_FIGHTER');

INSERT INTO Unit_ClassUpgrades (UnitType, UnitClassType)
	SELECT ('UNIT_BIPLAN'), UnitClassType
	FROM Unit_ClassUpgrades WHERE (UnitType = 'UNIT_FIGHTER');

INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
	SELECT ('UNIT_BIPLAN'), FlavorType, Flavor
	FROM Unit_Flavors WHERE (UnitType = 'UNIT_FIGHTER');

INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
	SELECT ('UNIT_BIPLAN'), PromotionType
	FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_FIGHTER');

INSERT INTO Unit_ResourceQuantityRequirements (UnitType, ResourceType, Cost)
	SELECT ('UNIT_BIPLAN'), ResourceType, Cost
	FROM Unit_ResourceQuantityRequirements WHERE (UnitType = 'UNIT_FIGHTER');
That code will copy all the entry of the vanilla civ5 fighter in new entry for our new units. In red the changes that are made:
UNIT_BIPLAN is the type of your new unit
Biplan is the in game name
(25) the ranged attack value
(250) the construction cost
(5) the range
ART_DEF_UNIT_BIPLAN refer to the <Type> of step 4

Fell free to tweak other values, thinking of the requested tech for example...


This should be enough for most your new units to work properly, danrell's units may require an extra step

extra step : copy the "Common" folder from danrell's pack in your project folder, and set the VFS property to true for all it's files. Needed especially for his tanks and ships.


edit : finally converted to post-patch .674 method.

Last edited by Gedemon; May 04, 2013 at 09:29 AM. Reason: I forgot something rather important...
Gedemon is offline   Reply With Quote
Old May 10, 2012, 12:17 PM   #2
Gedemon
Moderator
 
Gedemon's Avatar
 
Join Date: Oct 2004
Location: France
Posts: 3,762
XML example

Example of XML file for ArtDefines and unit stats based on whoward69' Units - Galleon (GK) v.2

edit: thanks to him, you can now found XML template for all existing units here.

Art defines:

Code:
<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 unit statistics:

Code:
<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>
	</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>
	</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>
	</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>
	</Unit_ClassUpgrades>

	<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_GALLEON</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>
	</Language_en_US>
</GameData>

<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>
Note that whoward69's galleon use specific icons and texts that are defined here while the BIPLAN unit from my SQL example re-use the fighter icons and texts.

Last edited by Gedemon; Mar 09, 2013 at 04:12 AM.
Gedemon is offline   Reply With Quote
Old May 10, 2012, 03:03 PM   #3
ww2commander
Proud father and civ-nut!
 
ww2commander's Avatar
 
Join Date: Aug 2003
Location: Eastern Front
Posts: 1,023
This should assist more people to get active in modding.

I remember how painful it was to make my first few units work, but with this guide and Kael's combined we have a good source of info.
__________________
“The Pope? How many divisions has he got?”
Josef Stalin

Current Project: The Great Patriotic War - WWII on the Eastern Front
ww2commander is offline   Reply With Quote
Old May 10, 2012, 11:56 PM   #4
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Thanks a million for this Gedemon. This is going to help new modders a great deal. I have some real good ideas, involving a World War One mod.

This is going to be great! I am going to learn this, it will give me something to do while waiting for GnK.
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; May 11, 2012 at 12:03 AM.
nokmirt is offline   Reply With Quote
Old May 29, 2012, 05:32 PM   #5
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
New Unit Template

Apparently this tutorial wasn't quite enough for some, so I zipped up a small ModBuddy project to use as a template, and have attached it here. [EDIT: Removed because it was no longer valid after the changes from pre-G+K patch and later.]

The template copies the stats of a vanilla unit, and makes a new unique "ethnic" unit with new art for a specific Civ. (Vivastpauli requested a Portuguese knight reskin but then disappeared, so this adds the mostly-finished unit to the game and gives it to Greece to replace their knight.)

Note that this template isn't compatible with any other mod that adds units with new art. Remember, the last activated version of the civ5artdefines_* files must include all changes from all such mods.

From a recent thread:

Quote:
Originally Posted by Nutty View Post
Quote:
Originally Posted by TheManFromMars View Post
If you can think of any other reasons that'd be great in the meantime, a checklist of 'files needed' and so on might be helpful.
...

Checklist:
  • You need the 2 civ5artdefines files, the entire contents copied with your additions added (both VFS true).
  • You'll need the 4 art files (all VFS true):
  • the gr2 (for a reskin, you would have just copied the vanilla one, renamed it, and revised it with IndieStone Nexus Buddy to point to the new dds files)
  • the fxsxml, also pointing to the new dds files
  • your edited dds's (diff and sref)
  • Finally, the XML or SQL file that adds the new unit (VFS false, but set to OnModActivated/ImportDatabase).

I prefer Gedemon's method using SQL rather than XML, because you can easily just copy all the rows from an existing unit and make your changes without worrying about missing anything.

If you aren't making a new unique/ethnic unit, and just want to change the default for everyone, you can skip the XML/SQL file and not worry about adding any new entries to the civ5artdefines. You just edit the civ5artdefines_unitmembers.xml and change the fxsxml reference for, e.g., UNIT_KNIGHT to your new fxsxml. Don't include a path, only "<Granny>knight_camelot.fxsxml</Granny>" (or whatever you called it).
Also note that "Reload Unit System" must be checked on the Mod Info tab of your mod properties.

Last edited by Nutty; Jul 07, 2012 at 02:42 PM.
Nutty is online now   Reply With Quote
Old Jul 07, 2012, 06:15 AM   #6
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
So, how do you mod in units post .674 patch? Let me know I want to learn.
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead
nokmirt is offline   Reply With Quote
Old Jul 07, 2012, 06:46 AM   #7
Gedemon
Moderator
 
Gedemon's Avatar
 
Join Date: Oct 2004
Location: France
Posts: 3,762
The following is the SQL code that I use to replace step 3 and step 4 now that Civ5ArtDefines_UnitMembers.xml and Civ5ArtDefines_Units.xml are no longer needed to mod in new units (which is a very good thing, but has broken a lot of mods)

You can put that code in the file created in step 5.

The rest of the steps are still valid I think.

Code:
INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
	SELECT	('ART_DEF_UNIT_WW1_FIGHTER_GERMANY'), DamageStates, Formation
	FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_WW1_FIGHTER');
INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
	SELECT	('ART_DEF_UNIT_WW1_FIGHTER_GERMANY'), ('ART_DEF_UNIT_MEMBER_WW1_FIGHTER_GERMANY'), NumMembers
	FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_WW1_FIGHTER');
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_WW1_FIGHTER_GERMANY'), 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_FIGHTER');
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_WW1_FIGHTER_GERMANY'), "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_FIGHTER');
INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
	SELECT	('ART_DEF_UNIT_MEMBER_WW1_FIGHTER_GERMANY'), Scale, ZOffset, Domain, 
			('Fokker_Dr.1.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
	FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_WW1_FIGHTER');
In red the reference for the new unit, in green the reference of the unit we use as a template for the new one.

I'll do a clean update of first post when I have the time for it (which may not be *soon*, but I'll try to prioritize it)

Last edited by Gedemon; Sep 01, 2012 at 04:09 AM. Reason: get ride of badly used double-quotes
Gedemon is offline   Reply With Quote
Old Jul 07, 2012, 06:54 AM   #8
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Don't worry It will take me some time to learn this. I will be patient and do it step by step. Thank you very much for the update, and for your help.

Ok, I am starting with adding a Nieuport 17 mod. Now...

I don't need the Nieuport_17.blend file, or do I? I also changed the no_gloss.dds to Nieuport_17_no_gloss.dds is that the way? Both .dds files need to be used right? So, I do not have to do step 3 or 4? Because the new SQL code takes care of those two steps. I just have to edit the code, correct?

Now when this mod is done it will add the Nieuport 17 to the game, and I can make it just be available to France. Just like I tweaked the longboat UU to be available to Sweden as well as the Danes.

Code:
<Civilization_UnitClassOverrides>
    <Row>
      <CivilizationType>CIVILIZATION_SWEDEN</CivilizationType>
      <UnitClassType>UNITCLASS_TRIREME</UnitClassType>
      <UnitType>UNIT_VIKING_LONGBOAT</UnitType>
    </Row>
  </Civilization_UnitClassOverrides>
I will ask you a few more questions later, but I feel I will get the hang of this quite quickly. So far it seems far easier than modding CiIV.

I could also pick apart WHoward's longboat UU mod. I hope he does not mind. Now I can open files in modbuddy properly. I see how he changed the unit stats. I see how the modinfo file is set up. It is a summary. XML is straight forward, just like in CiIV. Let me continue...

So, what I am doing is simply adding the Nierport 17 as a UU for France, as a replacement for the triplane. I figured this kind of project is perfect for getting my feet wet as far as modding goes. The plan is to copy what WHoward did, except I am not going to change unit stats. It will have the same stats as the WWI fighter. Just to learn for the moment.

Ok, SQL folder is in, and code. Changes just need to be made. I do not have to set VFS file to true. check!

Now let's add files to the XML folder.

These two I don't need in the mod file. WHoward does not use them and you said they are not needed for modding in a unit. Civ5ArtDefines_UnitMembers.xml and Civ5ArtDefines_Units.xml so bye bye to them.

I found everything but this.

Code:
<Row Tag="TXT_KEY_UNIT_VIKING_LONGBOAT_TEXT">
			<Text>Longboats (or Longships) were sea vessels made and used by the Vikings from the Nordic countries for trade, commerce, exploration, and warfare during the Viking Age.[NEWLINE][NEWLINE]The longship is characterized as a graceful, long, narrow, light, wooden boat with a shallow-draft hull designed for speed. The ship's shallow draft allowed navigation in waters only one metre deep and permitted beach landings. Longships were fitted with oars along almost the entire length of the boat itself. Later versions sported a rectangular sail on a single mast which was used to replace or augment the effort of the rowers.</Text>
		</Row>
I cannot find any UNIT_TEXT so, I am just going to replace it with my own changes.

Code:
<Row Tag="TXT_KEY_UNIT_NIEUPORT17_TEXT">
			<Text>The Nieuport 17 was a French biplane fighter aircraft of World War I, manufactured by the Nieuport company. It had outstanding maneuverability, and an excellent rate of climb. Initially, the Nieuport 17 retained the above wing mounted Lewis gun of the Nieuport 11, but in French service this was soon replaced by a synchronised Vickers gun. The Nieuport 17 became obsolescent in 1917, and was replaced by the SPAD S.VII.</Text>
		</Row>
That should do, so far so good.
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; Jul 07, 2012 at 01:54 PM.
nokmirt is offline   Reply With Quote
Old Jul 07, 2012, 02:28 PM   #9
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
I cannot find these for triplane. The <IconTextureAtlases> can you send me the path to these. I have to change all of the <Atlas>UNITS_VIKING_LONGBOAT_ICON_ATLAS</Atlas> to NIEUPORT17 correct? So, I have to locate the path to for those dealing with the Triplane <IconTextureAtlases>.

Or will my unit, just by default use the triplane icons? I am about this.

I am guessing that because my Nieuport 17 is under UNITCLASS_TRIPLANE, then it should use the triplane icons by default. The unit I am adding does not have it's own unique icons. So, am I right in this assumption?
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; Jul 07, 2012 at 02:32 PM.
nokmirt is offline   Reply With Quote
Old Jul 07, 2012, 04:49 PM   #10
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
Quote:
Originally Posted by nokmirt View Post
I cannot find these for triplane. The <IconTextureAtlases> can you send me the path to these. I have to change all of the <Atlas>UNITS_VIKING_LONGBOAT_ICON_ATLAS</Atlas> to NIEUPORT17 correct? So, I have to locate the path to for those dealing with the Triplane <IconTextureAtlases>.
See the first spoiler below. However, the way you're going about it, you won't have a proper air unit.

Quote:
Originally Posted by nokmirt View Post
Or will my unit, just by default use the triplane icons?
No, if you don't use SQL (much easier, IMHO--you can just copy most of the entries, and change the ones you need), then you will need to specify everything.

If you still want to use XML, then there's no need to guess about any of this. Just take a look at the pertinent section of the game XML. Everything is there, you just have to piece it together from the various files (or learn to go through the database [Documents\My Games\Sid Meier's Civilization V\cache\Civ5DebugDatabase.db] using SQLite Manager for Firefox, or a similar program).

It is a little confusing here because Firaxis has 2 different names they use internally for "Triplanes" or "WWI Fighters."

* See Assets\DLC\Expansion\Gameplay\XML\Units\CIV5Units_ Expansion.xml (I've bolded <Icon_Atlas> and <PortraitIndex>, which should be the one you were asking about):
Spoiler:
Code:
<GameData>
	<Units>
		<Row>
			<Class>UNITCLASS_TRIPLANE</Class>
			<Type>UNIT_TRIPLANE</Type>
			<PrereqTech>TECH_FLIGHT</PrereqTech>
			<RangedCombat>35</RangedCombat>
			<Cost>325</Cost>
			<Moves>2</Moves>
			<Special>SPECIALUNIT_FIGHTER</Special>
			<Immobile>true</Immobile>
			<Range>5</Range>
			<AirInterceptRange>5</AirInterceptRange>
			<CombatClass>UNITCOMBAT_FIGHTER</CombatClass>
			<Domain>DOMAIN_AIR</Domain>
			<DefaultUnitAI>UNITAI_DEFENSE_AIR</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_TRIPLANE</Description>
			<Civilopedia>TXT_KEY_CIV5_TRIPLANE_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_TRIPLANE_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_TRIPLANE</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Mechanized>true</Mechanized>
			<ObsoleteTech>TECH_RADAR</ObsoleteTech>
			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
			<AdvancedStartCost>30</AdvancedStartCost>
			<AirUnitCap>1</AirUnitCap>
			<RangedCombatLimit>100</RangedCombatLimit>
			<CombatLimit>0</CombatLimit>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>2</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_WW1_FIGHTER</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>24</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>24</PortraitIndex>
			<MoveRate>AIR_REBASE</MoveRate>
		</Row>
	</Units>
</GameData>


* The Art Defines are in Assets\DLC\Expansion\Units\Civ5ArtDefines_Expansio n_Units.xml [note, though, that they need to be rewritten; tag names are different in the database, so if you have to do it from scratch you'll want to check the database--but I've done this for you below; hopefully I haven't made any mistakes/typos] [EDIT: I apparently made lots, but I've tried to fix them]:
Spoiler:
Code:
<GameData>

<ArtDefine_UnitInfos>
  <Row>
    <Type>ART_DEF_UNIT_WW1_FIGHTER</Type>
    <DamageStates>1</DamageStates>
    <Formation>FighterWing</Formation>
  </Row>
</ArtDefine_UnitInfos>

<ArtDefine_UnitInfoMemberInfos>
  <Row>
      <UnitInfoType>ART_DEF_UNIT_WW1_FIGHTER</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberInfoType>
      <NumMembers>3</NumMembers>
  </Row>
</ArtDefine_UnitInfoMemberInfos>

</GameData>


...and Assets\DLC\Expansion\Units\Civ5ArtDefines_Expansio n_UnitMembers.xml [same for this one, needed to be rewritten]:
Spoiler:
Code:
<GameData>

<ArtDefine_UnitMemberInfos>
  <Row>
    <Type>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</Type>
    <Scale>0.09</Scale>
    <ZOffset />
    <Domain>Air</Domain>
    <Model>WW1_Fighter.fxsxml</Model>
    <MaterialTypeTag>METAL</MaterialTypeTag>
    <MaterialTypeSoundOverrideTag>METALLRG</MaterialTypeSoundOverrideTag>
  </Row>
</ArtDefine_UnitMemberInfos>

<ArtDefine_UnitMemberCombats>
  <Row>
    <UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
      <EnableActions>Idle Attack Bombard Death Run</EnableActions>
      <DisableActions />
      <AttackRadius>45.0</AttackRadius>
      <MoveRate>1.6</MoveRate>
      <TurnRateMin>0.25</TurnRateMin>
      <TurnRateMax>0.5</TurnRateMax>
      <HasRefaceAfterCombat>0</HasRefaceAfterCombat>
      <RushAttackFormation />
  </Row>
</ArtDefine_UnitMemberCombats>

<ArtDefine_UnitMemberCombatWeapons>
  <Row>
    <UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
      <Index>0</Index>
      <SubIndex>0</SubIndex>
      <ID />
        <VisKillStrengthMin>10.0</VisKillStrengthMin>
        <VisKillStrengthMax>20.0</VisKillStrengthMax>
        <ProjectileSpeed>1.3</ProjectileSpeed>
        <HitEffect>ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_HIT_$(TERRAIN)</HitEffect>
        <HitRadius>20.0</HitRadius>
        <WeaponTypeTag>BULLETHC</WeaponTypeTag>
        <WeaponTypeSoundOverrideTag>BULLETHC</WeaponTypeSoundOverrideTag>
  </Row>
  <Row>
    <UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
      <Index>1</Index>
      <SubIndex>0</SubIndex>
      <ID />
          <VisKillStrengthMin>1.0</VisKillStrengthMin>
          <VisKillStrengthMax>1.0</VisKillStrengthMax>
          <HitEffect>ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_HIT_$(TERRAIN)</HitEffect>
          <HitRadius>30.0</HitRadius>
          <WeaponTypeTag>BULLETHC</WeaponTypeTag>
          <WeaponTypeSoundOverrideTag>BULLETHC</WeaponTypeSoundOverrideTag>
  </Row>
  <Row>
    <UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
      <Index>1</Index>
      <SubIndex>1</SubIndex>
          <ID>PROJECTILE</ID>
          <VisKillStrengthMin>25.0</VisKillStrengthMin>
          <VisKillStrengthMax>50.0</VisKillStrengthMax>
          <ProjectileSpeed>1.3</ProjectileSpeed>
          <HitEffect />
          <TargetGround>1</bTargetGround>
          <IsDropped>1</bIsDropped>
          <WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
          <WeaponTypeSoundOverrideTag>EXPLOSION200POUND</WeaponTypeSoundOverrideTag>
  </Row>
</ArtDefine_UnitMemberCombatWeapons>
</GameData>


...and Assets\DLC\Expansion\StrategicView\Civ5ArtDefines_ SV_Expansion_Units.xml [which doesn't need rewriting, thankfully]:
Spoiler:
Code:
<GameData>
	<ArtDefine_StrategicView>
		<Row>
			<StrategicViewType>ART_DEF_UNIT_WW1_FIGHTER</StrategicViewType>
			<TileType>Unit</TileType>
			<Asset>SV_WWI_Triplane.dds</Asset>
		</Row>
	</ArtDefine_StrategicView>
</GameData>


* The text descriptions are in Assets\DLC\Expansion\Gameplay\XML\Text\en_US\CIV5G ameTextInfos2_Expansion.xml:
Spoiler:
Code:
<GameData>
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_HELP_TRIPLANE">
			<Text>Early Air Unit designed to intercept incoming enemy aircraft.</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_TRIPLANE_STRATEGY">
			<Text>The Triplane is an early air unit. It can be based in any city you own or aboard an aircraft carrier. It can move from city to city (or carrier) and can perform "missions" within its range of 5 tiles. Use triplanes to attack enemy aircraft and ground units, to scout enemy positions, and to defend against enemy air attacks. See the rules on Aircraft for more information.</Text>
		</Row>
	</Language_en_US>
</GameData>


...and Assets\DLC\Expansion\Gameplay\XML\Text\en_US\CIV5G ameTextInfos_Civilopedia_Expansion.xml:
Spoiler:
Code:
<GameData>
	<Language_en_US>
		<Row Tag="TXT_KEY_CIV5_TRIPLANE_TEXT">
			<Text>Deriving its name from the unique three-tiered wing system utilized in its design, the triplane was used with varying degrees of success during World War I.  The most famous triplane of the war, the Fokker Dr.I, was used extensively by the German air force, gaining particular notoriety as the legendary Red Baron's craft of choice. Although engineers developed many variations on the triplane design, advancements in the traditional biplane rendered the triplane obsolete within a decade of its introduction.</Text>
		</Row>
	</Language_en_US>
</GameData>


Now copy all this mess into your mod, and go through and make your changes. One file or multiple, doesn't matter. You can leave stuff out if you're going to use the references to the original (e.g., I might use the original TXT_KEY_UNIT_HELP_TRIPLANE then leave out the <Row Tag="TXT_KEY_UNIT_HELP_TRIPLANE"> entry).

Last edited by Nutty; Jul 08, 2012 at 04:18 AM.
Nutty is online now   Reply With Quote
Old Jul 07, 2012, 10:36 PM   #11
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Ok, let's do this one step at a time so I don't get confused. This is my Nieuport17.xml code. Is anything missing in this file that needs to be added? I am basically copying how WHoward did it.

Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
	<Units>
		<Row>
			<Class>UNITCLASS_TRIPLANE</Class>
			<Type>UNIT_NIEUPORT17</Type>
			<PrereqTech>TECH_FLIGHT</PrereqTech>
			<RangedCombat>35</RangedCombat>
			<Cost>325</Cost>
			<Moves>2</Moves>
			<Special>SPECIALUNIT_FIGHTER</Special>
			<Immobile>true</Immobile>
			<Range>5</Range>
			<AirInterceptRange>5</AirInterceptRange>
			<CombatClass>UNITCOMBAT_FIGHTER</CombatClass>
			<Domain>DOMAIN_AIR</Domain>
			<DefaultUnitAI>UNITAI_DEFENSE_AIR</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_NIEUPORT17</Description>
			<Civilopedia>TXT_KEY_CIV5_NIEUPORT17_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_NIEUPORT17_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_NIEUPORT17</Help>
			<MilitarySupport>true</MilitarySupport>
			<MilitaryProduction>true</MilitaryProduction>
			<Mechanized>true</Mechanized>
			<ObsoleteTech>TECH_RADAR</ObsoleteTech>
			<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
			<AdvancedStartCost>30</AdvancedStartCost>
			<AirUnitCap>1</AirUnitCap>
			<RangedCombatLimit>100</RangedCombatLimit>
			<CombatLimit>0</CombatLimit>
			<XPValueAttack>3</XPValueAttack>
			<XPValueDefense>2</XPValueDefense>
			<UnitArtInfo>ART_DEF_UNIT_NIEUPORT17</UnitArtInfo>
			<UnitFlagAtlas>EXPANSION_UNIT_FLAG_ATLAS</UnitFlagAtlas>
			<UnitFlagIconOffset>24</UnitFlagIconOffset>
			<IconAtlas>EXPANSION_UNIT_ATLAS_1</IconAtlas>
			<PortraitIndex>24</PortraitIndex>
			<MoveRate>AIR_REBASE</MoveRate>
		</Row>
	</Units>

	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<UnitAIType>UNITAI_DEFENSE_AIR</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<UnitAIType>UNITAI_CARRIER_AIR</UnitAIType>
		</Row>
	</Unit_AITypes>

	<Unit_ClassUpgrades>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<UnitClassType>UNITCLASS_FIGHTER</UnitClassType>
		</Row>
	</Unit_ClassUpgrades>

	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<FlavorType>FLAVOR_OFFENSE</FlavorType>
			<Flavor>5</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<FlavorType>FLAVOR_DEFENSE</FlavorType>
			<Flavor>5</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<FlavorType>FLAVOR_AIR</FlavorType>
			<Flavor>10</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<FlavorType>FLAVOR_ANTIAIR</FlavorType>
			<Flavor>12</Flavor>
		</Row>
	</Unit_Flavors>

	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<PromotionType>PROMOTION_INTERCEPTION_III</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<PromotionType>PROMOTION_AIR_SWEEP</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<PromotionType>PROMOTION_AIR_RECON</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<PromotionType>PROMOTION_ANTI_AIR_II</PromotionType>
		</Row>
	</Unit_FreePromotions>

	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_FRANCE</CivilizationType>
			<UnitClassType>UNITCLASS_FIGHTER</UnitClassType>
			<UnitType>UNIT_NIEUPORT17</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>

	<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_NIEUPORT17</UnitType>
			<ResourceType>RESOURCE_OIL</ResourceType>
		</Row>
	</Unit_ResourceQuantityRequirements>

	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_NIEUPORT17">
			<Text>Nieuport 17</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_NIEUPORT17_TEXT">
			<Text>The Nieuport 17 was a French biplane fighter aircraft of World War I, manufactured by the Nieuport company. It had outstanding maneuverability, and an excellent rate of climb. Initially, the Nieuport 17 retained the above wing mounted Lewis gun of the Nieuport 11, but in French service this was soon replaced by a synchronised Vickers gun. The Nieuport 17 became obsolescent in 1917, and was replaced by the SPAD S.VII.</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_NIEUPORT17_STRATEGY">
			<Text>The Triplane is an early air unit. It can be based in any city you own or aboard an aircraft carrier. It can move from city to city (or carrier) and can perform "missions" within its range of 5 tiles. Use triplanes to attack enemy aircraft and ground units, to scout enemy positions, and to defend against enemy air attacks. See the rules on Aircraft for more information.</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HELP_NIEUPORT17">
			<Text>Early Air Unit designed to intercept incoming enemy aircraft.</Text>
		</Row>
	</Language_en_US>
</GameData>


Nieuport17Art.xml

Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 7/7/2012 1:47:03 PM -->
<GameData>
	<ArtDefine_UnitInfos>
		<Row>
			<Type>ART_DEF_UNIT_NIEUPORT17</Type>
			<DamageStates>1</DamageStates>
			<Formation>FighterWing</Formation>
		</Row>
	</ArtDefine_UnitInfos>

	<ArtDefine_UnitInfoMemberInfos>
		<Row>
		 <UnitMemberArt>
			<UnitInfoType>ART_DEF_UNIT_NIEUPORT17</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberInfoType>
			<NumMembers>3</NumMembers>
		  </UnitMemberArt>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>

    <ArtDefine_UnitMemberInfos>
		<Row>
		 <Type>ART_DEF_UNIT_MEMBER_WW1_Fighter</Type>
			<Scale>0.09</Scale>
			  <ZOffset/>
				<Domain>Air</Domain>
				<Model>
				  <Granny>Nieuport17.fxsxml</Granny>
				  <MaterialTypeTag>METAL</MaterialTypeTag>
				  <MaterialTypeSoundOverrideTag>METALLRG</MaterialTypeSoundOverrideTag>
				</Model>
		</Row>
	</ArtDefine_UnitMemberInfos>

	<ArtDefine_UnitMemberCombats>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
			<EnableActions>Idle Attack Bombard Death Run</EnableActions>
			<DisableActions />
			<AttackRadius>45.0</AttackRadius>
			<MoveRate>1.6</MoveRate>
			<TurnRateMin>0.25</TurnRateMin>
			<TurnRateMax>0.5</TurnRateMax>
			<HasRefaceAfterCombat>0</HasRefaceAfterCombat>
			<RushAttackFormation />
		</Row>
	</ArtDefine_UnitMemberCombats>

	<Usage>Vs_Air</Usage>

	<ArtDefine_UnitMemberCombatWeapons>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
			<Index>0</Index>
			<SubIndex>0</SubIndex>
			<ID />
			<VisKillStrengthMin>10.0</VisKillStrengthMin>
			<VisKillStrengthMax>20.0</VisKillStrengthMax>
			<ProjectileSpeed>1.3</ProjectileSpeed>
			<HitEffect>ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_HIT_$(TERRAIN)</HitEffect>
			<HitRadius>20.0</HitRadius>
			<WeaponTypeTag>BULLETHC</WeaponTypeTag>
			<WeaponTypeSoundOverrideTag>BULLETHC</WeaponTypeSoundOverrideTag>
		</Row>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
			<Index>1</Index>
			<SubIndex>0</SubIndex>
			<ID />
			 <Weapon>
				<VisKillStrengthMin>1.0</VisKillStrengthMin>
				<VisKillStrengthMax>1.0</VisKillStrengthMax>
				<HitEffect>ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_HIT_$(TERRAIN)</HitEffect>
				<HitRadius>30.0</HitRadius>
				<WeaponTypeTag>BULLETHC</WeaponTypeTag>
				<WeaponTypeSoundOverrideTag>BULLETHC</WeaponTypeSoundOverrideTag>
			  </Weapon>
		</Row>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
			<Index>1</Index>
			<SubIndex>1</SubIndex>
			<ID>PROJECTILE</ID>
			<VisKillStrengthMin>25.0</VisKillStrengthMin>
			<VisKillStrengthMax>50.0</VisKillStrengthMax>
			<ProjectileSpeed>1.3</ProjectileSpeed>
			<HitEffect />
			<TargetGround>1</TargetGround>
				<IsDropped>1</IsDropped>
					<WeaponTypeTag>EXPLOSIVE</WeaponTypeTag>
					<WeaponTypeSoundOverrideTag>EXPLOSION200POUND</WeaponTypeSoundOverrideTag>
				</Row>
	</ArtDefine_UnitMemberCombatWeapons>

    <ArtDefine_StrategicView>
		<Row>
			<StrategicViewType>ART_DEF_UNIT_NIEUPORT17</StrategicViewType>
			<TileType>Unit</TileType>
			<Asset>SV_WWI_Triplane.dds</Asset>
		</Row>
	</ArtDefine_StrategicView>
</GameData>


A couple small xml typos. It's ok it keeps me on my toes.

All of this look ok? According to modbuddy there are no xml errors. SV_WWI_Triplane.dds the unit from Danrell does not have a version of this. And most of the animations will be for WW1_FIGHTER is that ok?
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; Jul 07, 2012 at 11:36 PM.
nokmirt is offline   Reply With Quote
Old Jul 08, 2012, 03:04 AM   #12
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
@Gedemon or Nutty, or anyone else that knows.

I am just going to do the SQL way and see how that goes.

This is what my Nieuport17.sql code looks like, in my mod project. Is this ok? I just changed unit stats to match the triplane. Where it says this in the code, WHERE (UnitType = "UNIT_FIGHTER"), shouldn't I change that to

WHERE (UnitType = "UNIT_TRIPLANE")? And will this be a UU for France or is there more steps to get that done? Let me know.

Spoiler:
Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_NIEUPORT17_FRANCE"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_FIGHTER");
INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
	SELECT	("ART_DEF_UNIT_NIEUPORT17_FRANCE"), ("ART_DEF_UNIT_MEMBER_NIEUPORT17_FRANCE"), "NumMembers"
	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_WW1_FIGHTER");
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_NIEUPORT17_FRANCE"), "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_FIGHTER");
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_NIEUPORT17_FRANCE"), "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_FIGHTER");
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
	SELECT	("ART_DEF_UNIT_MEMBER_NIEUPORT17_FRANCE"), "Scale", "ZOffset", "Domain", 
			("Nieuport17.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_FIGHTER"); 

	-- NIEUPORT17
INSERT INTO "UnitClasses" ('Type', 'Description', 'MaxGlobalInstances', 'MaxTeamInstances', 'MaxPlayerInstances', 'InstanceCostModifier', 'DefaultUnit' )
	SELECT ("UNITCLASS_NIEUPORT17"), "Description", "MaxGlobalInstances", "MaxTeamInstances", "MaxPlayerInstances", "InstanceCostModifier", "DefaultUnit"
	FROM "UnitClasses" WHERE (Type = "UNITCLASS_FIGHTER");

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', 'IsReligious', '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_NIEUPORT17"), ("Nieuport 17"), "Civilopedia", "Strategy", "Help", "Requirements",
			"Combat", (35), (325), "Moves", "Immobile", (5), "BaseSightRange", ("UNITCLASS_NIEUPORT17"), "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", "IsReligious", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
			("ART_DEF_UNIT_NIEUPORT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
	FROM "Units" WHERE (Type = "UNIT_FIGHTER");
INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
	SELECT ("UNIT_NIEUPORT17"), "UnitAIType"
	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
	SELECT ("UNIT_NIEUPORT17"), "UnitClassType"
	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
	SELECT ("UNIT_NIEUPORT17"), "FlavorType", "Flavor"
	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
	SELECT ("UNIT_NIEUPORT17"), "PromotionType"
	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
	SELECT ("UNIT_NIEUPORT17"), "ResourceType", "Cost"
	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_FIGHTER");
----
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; Jul 08, 2012 at 04:00 AM.
nokmirt is offline   Reply With Quote
Old Jul 08, 2012, 04:07 AM   #13
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
I'm going to respond to the XML question anyway because I botched the job so horribly.

Note, these are SQL rows you're adding with XML, so you're not going to have any nesting within the <Row> tags.

Quote:
Originally Posted by nokmirt View Post
<ArtDefine_UnitInfoMemberInfos>
<Row>
<UnitMemberArt>
<UnitInfoType>ART_DEF_UNIT_NIEUPORT17</UnitInfoType>
<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WW1_FIGHTE R</UnitMemberInfoType>
<NumMembers>3</NumMembers>
</UnitMemberArt>
</Row>
</ArtDefine_UnitInfoMemberInfos>
You don't want a <UnitMemberArt></UnitMemberArt> tag in there.

Quote:
Originally Posted by nokmirt View Post
<ArtDefine_UnitMemberInfos>
<Row>
<Type>ART_DEF_UNIT_MEMBER_WW1_Fighter</Type>
<Scale>0.09</Scale>
<ZOffset/>
<Domain>Air</Domain>
<Model>
<Granny>Nieuport17.fxsxml</Granny>
<MaterialTypeTag>METAL</MaterialTypeTag>
<MaterialTypeSoundOverrideTag>METALLRG</MaterialTypeSoundOverrideTag>
</Model>
</Row>
</ArtDefine_UnitMemberInfos>
You don't want <Granny></Granny> in there either, it should be
Code:
<Model>Nieuport17.fxsxml</Model>
<MaterialTypeTag>METAL</MaterialTypeTag>
Quote:
Originally Posted by nokmirt View Post
<Usage>Vs_Air</Usage>
That needs to be deleted.

Quote:
Originally Posted by nokmirt View Post
<Row>
<UnitMemberType>ART_DEF_UNIT_MEMBER_WW1_FIGHTER</UnitMemberType>
<Index>1</Index>
<SubIndex>0</SubIndex>
<ID />
<Weapon>
<VisKillStrengthMin>1.0</VisKillStrengthMin>
<VisKillStrengthMax>1.0</VisKillStrengthMax>
<HitEffect>ART_DEF_VEFFECT_FIGHTER_MACHINE_GUN_HIT _$(TERRAIN)</HitEffect>
<HitRadius>30.0</HitRadius>
<WeaponTypeTag>BULLETHC</WeaponTypeTag>
<WeaponTypeSoundOverrideTag>BULLETHC</WeaponTypeSoundOverrideTag>
</Weapon>
</Row>
There shouldn't be a <Weapon></Weapon> tag.

Quote:
Originally Posted by nokmirt View Post
SV_WWI_Triplane.dds the unit from Danrell does not have a version of this.
That's the vanilla one, which should be fine.

Quote:
Originally Posted by nokmirt View Post
And most of the animations will be for WW1_FIGHTER is that ok?
What do you mean? You shouldn't need to change the fxsxml or the gr2.

Now I'll take a look at the SQL...

Last edited by Nutty; Jul 08, 2012 at 04:11 AM.
Nutty is online now   Reply With Quote
Old Jul 08, 2012, 04:16 AM   #14
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
Quote:
Originally Posted by nokmirt View Post
Is this ok?
Just glancing at it, it looks fine.

Quote:
Originally Posted by nokmirt View Post
shouldn't I change that to WHERE (UnitType = "UNIT_TRIPLANE")?
Yes.

Quote:
Originally Posted by nokmirt View Post
And will this be a UU for France or is there more steps to get that done?
To make a UU, you need:
Code:
INSERT INTO "Civilization_UnitClassOverrides" ( 'CivilizationType', 'UnitClassType', 'UnitType' )
	VALUES ( 'CIVILIZATION_FRANCE', 'UNITCLASS_TRIPLANE', 'UNIT_NIEUPORT17' );
Nutty is online now   Reply With Quote
Old Jul 08, 2012, 04:18 AM   #15
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
I am doing it the shorter way via SQL. Steps 3 and 4, the xml steps are not needed to add units to a mod anymore.

This is my current SQL code.

Nieuport17.sql

Spoiler:
Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_NIEUPORT17"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_FIGHTER");
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");
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_NIEUPORT17"), "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_FIGHTER");
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_NIEUPORT17"), "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_FIGHTER");
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
	SELECT	("ART_DEF_UNIT_MEMBER_NIEUPORT17"), "Scale", "ZOffset", "Domain", 
			("Nieuport17.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_FIGHTER"); 

	-- NIEUPORT17
INSERT INTO "UnitClasses" ('Type', 'Description', 'MaxGlobalInstances', 'MaxTeamInstances', 'MaxPlayerInstances', 'InstanceCostModifier', 'DefaultUnit' )
	SELECT ("UNITCLASS_NIEUPORT17"), "Description", "MaxGlobalInstances", "MaxTeamInstances", "MaxPlayerInstances", "InstanceCostModifier", "DefaultUnit"
	FROM "UnitClasses" WHERE (Type = "UNITCLASS_FIGHTER");

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', 'IsReligious', '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_NIEUPORT17"), ("Nieuport 17"), "Civilopedia", "Strategy", "Help", "Requirements",
			"Combat", (35), (325), "Moves", "Immobile", (5), "BaseSightRange", ("UNITCLASS_NIEUPORT17"), "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", "IsReligious", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
			("ART_DEF_UNIT_NIEUPORT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
	FROM "Units" WHERE (Type = "UNIT_FIGHTER");
INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
	SELECT ("UNIT_NIEUPORT17"), "UnitAIType"
	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
	SELECT ("UNIT_NIEUPORT17"), "UnitClassType"
	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
	SELECT ("UNIT_NIEUPORT17"), "FlavorType", "Flavor"
	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
	SELECT ("UNIT_NIEUPORT17"), "PromotionType"
	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_FIGHTER");
INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
	SELECT ("UNIT_NIEUPORT17"), "ResourceType", "Cost"
	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_FIGHTER");
----


Check this and let me know if it is correct. Thanks Nutty
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead
nokmirt is offline   Reply With Quote
Old Jul 08, 2012, 04:21 AM   #16
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Quote:
Originally Posted by Nutty View Post
To make a UU, you need:
Code:
INSERT INTO "Civilization_UnitClassOverrides" ( 'CivilizationType', 'UnitClassType', 'UnitType' )
	VALUES ( 'CIVILIZATION_FRANCE', 'UNITCLASS_TRIPLANE', 'UNIT_NIEUPORT17' );
This I added in an XML folder.

Nieuport17.xml

Spoiler:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 7/8/2012 5:08:15 AM -->
<Civilization_UnitClassOverrides>
	<Row>
		<CivilizationType>CIVILIZATION_FRANCE</CivilizationType>
		<UnitClassType>UNITCLASS_NIEUPORT17</UnitClassType>
		<UnitType>UNIT_NIEUPORT17</UnitType>
	</Row>
</Civilization_UnitClassOverrides>


Correct?

Finished SQL.

Spoiler:
Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_NIEUPORT17"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_FIGHTER");
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");
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_NIEUPORT17"), "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_FIGHTER");
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_NIEUPORT17"), "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_FIGHTER");
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
	SELECT	("ART_DEF_UNIT_MEMBER_NIEUPORT17"), "Scale", "ZOffset", "Domain", 
			("Nieuport17.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_FIGHTER"); 

	-- NIEUPORT17
INSERT INTO "UnitClasses" ('Type', 'Description', 'MaxGlobalInstances', 'MaxTeamInstances', 'MaxPlayerInstances', 'InstanceCostModifier', 'DefaultUnit' )
	SELECT ("UNITCLASS_NIEUPORT17"), "Description", "MaxGlobalInstances", "MaxTeamInstances", "MaxPlayerInstances", "InstanceCostModifier", "DefaultUnit"
	FROM "UnitClasses" WHERE (Type = "UNITCLASS_TRIPLANE");

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', 'IsReligious', '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_NIEUPORT17"), ("Nieuport 17"), "Civilopedia", "Strategy", "Help", "Requirements",
			"Combat", (35), (325), "Moves", "Immobile", (5), "BaseSightRange", ("UNITCLASS_NIEUPORT17"), "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", "IsReligious", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
			("ART_DEF_UNIT_NIEUPORT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
	FROM "Units" WHERE (Type = "UNIT_TRIPLANE");
INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
	SELECT ("UNIT_NIEUPORT17"), "UnitAIType"
	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
	SELECT ("UNIT_NIEUPORT17"), "UnitClassType"
	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
	SELECT ("UNIT_NIEUPORT17"), "FlavorType", "Flavor"
	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
	SELECT ("UNIT_NIEUPORT17"), "PromotionType"
	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
	SELECT ("UNIT_NIEUPORT17"), "ResourceType", "Cost"
	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_TRIPLANE");
----
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead

Last edited by nokmirt; Jul 08, 2012 at 04:29 AM.
nokmirt is offline   Reply With Quote
Old Jul 08, 2012, 04:32 AM   #17
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
The XML to make it a UU is fine [though why not leave it in SQL?], but looking at your SQL again, I notice you're making a new unit class. You should just be using UNITCLASS_TRIPLANE.
(i.e., delete the inserts to the UnitClasses and Unit_ClassUpgrades tables)

EDIT: And you still want to change references to UNIT_FIGHTER to UNIT_TRIPLANE.

Last edited by Nutty; Jul 08, 2012 at 04:43 AM.
Nutty is online now   Reply With Quote
Old Jul 08, 2012, 04:38 AM   #18
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Ok like this

Spoiler:
Code:
-- NIEUPORT17
INSERT INTO "UnitClasses" ('Type', 'Description', 'MaxGlobalInstances', 'MaxTeamInstances', 'MaxPlayerInstances', 'InstanceCostModifier', 'DefaultUnit' )
	SELECT ("UNITCLASS_TRIPLANE"), "Description", "MaxGlobalInstances", "MaxTeamInstances", "MaxPlayerInstances", "InstanceCostModifier", "DefaultUnit"
	FROM "UnitClasses" WHERE (Type = "UNITCLASS_TRIPLANE");

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', 'IsReligious', '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_NIEUPORT17"), ("Nieuport 17"), "Civilopedia", "Strategy", "Help", "Requirements",
			"Combat", (35), (325), "Moves", "Immobile", (5), "BaseSightRange", ("UNITCLASS_TRIPLANE"), "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", "IsReligious", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
			("ART_DEF_UNIT_NIEUPORT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
	FROM "Units" WHERE (Type = "UNIT_TRIPLANE");
INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
	SELECT ("UNIT_NIEUPORT17"), "UnitAIType"
	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_TRIPLANE");
etc etc.
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead
nokmirt is offline   Reply With Quote
Old Jul 08, 2012, 04:51 AM   #19
Nutty
King
 
Nutty's Avatar
 
Join Date: Mar 2011
Location: Orange County, California, U.S.A.
Posts: 659
Delete the first insert, because you don't want to change that table. (Note that what that would have done is make a duplicate of the UNITCLASS_TRIPLANE row.)
Nutty is online now   Reply With Quote
Old Jul 08, 2012, 05:03 AM   #20
nokmirt
Emperor
 
nokmirt's Avatar
 
Join Date: Feb 2009
Location: Iowa USA
Posts: 4,266
Ok, finally the SQL is done.

Spoiler:
Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_NIEUPORT17"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_FIGHTER");
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");
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_NIEUPORT17"), "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_FIGHTER");
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_NIEUPORT17"), "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_FIGHTER");
INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
	SELECT	("ART_DEF_UNIT_MEMBER_NIEUPORT17"), "Scale", "ZOffset", "Domain", 
			("Nieuport17.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_FIGHTER");
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', 'IsReligious', '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_NIEUPORT17"), ("Nieuport 17"), "Civilopedia", "Strategy", "Help", "Requirements",
			"Combat", (35), (325), "Moves", "Immobile", (5), "BaseSightRange", ("UNITCLASS_TRIPLANE"), "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", "IsReligious", "CombatLimit", "RangeAttackOnlyInDomain", "RangeAttackIgnoreLOS", "RangedCombatLimit", "XPValueAttack", "XPValueDefense", "SpecialCargo", "DomainCargo", "Conscription", "ExtraMaintenanceCost", "NoMaintenance", "Unhappiness",
			("ART_DEF_UNIT_NIEUPORT17"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
	FROM "Units" WHERE (Type = "UNIT_TRIPLANE");
INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
	SELECT ("UNIT_NIEUPORT17"), "UnitAIType"
	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
	SELECT ("UNIT_NIEUPORT17"), "UnitClassType"
	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
	SELECT ("UNIT_NIEUPORT17"), "FlavorType", "Flavor"
	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
	SELECT ("UNIT_NIEUPORT17"), "PromotionType"
	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
	SELECT ("UNIT_NIEUPORT17"), "ResourceType", "Cost"
	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_TRIPLANE");
INSERT INTO "Civilization_UnitClassOverrides" ( 'CivilizationType', 'UnitClassType', 'UnitType' )
	VALUES ( 'CIVILIZATION_FRANCE', 'UNITCLASS_TRIPLANE', 'UNIT_NIEUPORT17' );


This is the dreaded thread of code. Doing it until I get it right is the only way I'll learn.
__________________
"All science trembles at the searing logic of your fiery intellect. "

Brig. Gen. Lewis A. Armistead
nokmirt is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION V > Civ5 - Creation & Customization > Civ5 - Modding Tutorials & Reference > [TUTORIAL] Add a new unit in the game (using SQL)

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 01:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR