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,649
    Location:
    France
    yes, here's another example from my WWII mod :

    Code:
    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	[COLOR="red"]("UNIT_LIGHT_TANK")[/COLOR], [COLOR="red"]("TXT_KEY_UNIT_LIGHT_TANK")[/COLOR], "Civilopedia", "Strategy", [COLOR="Red"]("TXT_KEY_UNIT_HELP_LIGHT_TANK")[/COLOR], "Requirements",
    			[COLOR="red"](40)[/COLOR], "RangedCombat", [COLOR="red"](300)[/COLOR], [COLOR="red"](5)[/COLOR], "Immobile", "Range", "BaseSightRange", [COLOR="red"]("UNITCLASS_LIGHT_TANK")[/COLOR], "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",
    			[COLOR="red"]("ART_DEF_UNIT_LIGHT_TANK")[/COLOR], "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
    			[COLOR="Red"]("1")[/COLOR], [COLOR="red"]("7")[/COLOR], [COLOR="red"]("WW2_UNIT_ICONS")[/COLOR], [COLOR="red"]("WW2_UNIT_FLAGS")[/COLOR]
    	FROM "Units" WHERE (Type = "UNIT_TANK");
    Here I'm defining a light tank unit, based on the tank unit, but with some value changed (in red).

    INSERT INTO "Units" (...) list the column that will be filled, SELECT ... FROM "Units" WHERE (Type = "UNIT_TANK") is getting the tank values for those columns, except the entries in parenthesis like ("UNIT_LIGHT_TANK") which are changed values, and you'll see that the last 4 entries corresponding to the 'UnitFlagIconOffset', 'PortraitIndex', 'IconAtlas', 'UnitFlagAtlas' from the insert statement are ("1"), ("7"), ("WW2_UNIT_ICONS"), ("WW2_UNIT_FLAGS"), which are the new unit icon and flags index/atlases from the mod.
     
  2. Patum333

    Patum333 Chieftain

    Joined:
    Jan 25, 2012
    Messages:
    63
    Location:
    Bremen
    Yeah, but this creates a new unit. Look at this: Clipboard01.jpg

    I tryed to find out a way of using unit-icons with a simple ethnic diversity. I believe it's not possible to use ethnic diversity unit-icons without to change the unit entries.

    You still have to use overrides like this,
    HTML:
    - <Civilization_UnitClassOverrides>
    - <Row>
      <CivilizationType>CIVILIZATION_GERMANY</CivilizationType> 
      <UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType> 
      <UnitType>UNIT_GERMAN_RIFLEMAN</UnitType> 
      </Row>
    if you want to use your own.:(
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,649
    Location:
    France
    ok, I understand now, but AFAIK ethnic icons can't be used the same way.
     
  4. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Gedemon can you help me learn how to add a unit icon for my units? One for the Nieuport 17 and one for the FT-17 light tank. I put both units in a French WWI unit pack, but I probably should have icons for them before posting on Steam Workshop. I used to make icons for CiIV, I just don't remember how.

    I know these two units are not much, but I can add to the pack as time goes on. I want to do a Napoleonic infantry pack as well.

    I think with that I will replace the musketman with a standard or generic musket infantry. Or, I could add a unit class. Then I will add UUs to the major powers, France, Prussia, Russia, Austria, and whatever other UUs they have made. Oh Great Britain and America, has some nice ones made for them. I have studied the Napoleonic wars most of my life. I certainly should make a scenario for that. First though, I want to learn more about modding things properly.
     
  5. Karantaner

    Karantaner Chieftain

    Joined:
    May 8, 2011
    Messages:
    165
    Location:
    London
    I have a silly question, but I cannot figure out the solution. I'm using in my mod for Austria-Hungaria a Hussar unit which has an fscale size of 1.5 - and not like the Cavlary of 0.12 I cannot figure it out how to use the required size for the Hussar in the new system with the sql file. The system always uses the size of the Cavalry and the Hussar is then sooo tiny, you cannot see it. Where can I put the correct fscale size of 1.5 in the sql file????

    Here is my sql file

    Spoiler :

    ----Hussar------------------------------------------------------------------
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    SELECT ("ART_DEF_UNIT_HUSSAR"), "DamageStates", "Formation"
    FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_CAVALRY");

    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    SELECT ("ART_DEF_UNIT_HUSSAR"), ("ART_DEF_UNIT_MEMBER_HUSSAR"), 5
    FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_CAVALRY");

    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_HUSSAR"), "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_CAVALRY");
    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_HUSSAR"), "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_CAVALRY");
    INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
    SELECT ("ART_DEF_UNIT_MEMBER_HUSSAR"), "Scale", "ZOffset", "Domain",
    ("Hussar_idle.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
    FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_CAVALRY");
     
  6. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,156
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Here you go:
    Code:
    UPDATE ArtDefine_UnitMemberInfos SET Scale = 1.5 WHERE Type = 'ART_DEF_UNIT_MEMBER_HUSSAR';
     
  7. Karantaner

    Karantaner Chieftain

    Joined:
    May 8, 2011
    Messages:
    165
    Location:
    London
    great!!! thanks a lot - you saved me!!!
     
  8. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Code:
    <Row>
    			<Type>PROMOTION_FIRE_SUPPORT</Type>
    			<Description>TXT_KEY_PROMOTION_FIRE_SUPPORT</Description>
    			<Help>TXT_KEY_PROMOTION_FIRE_SUPPORT</Help>
    			<Sound>AS2D_IF_LEVELUP</Sound>
    			<CityAttack>33</CityAttack>
    			<PortraitIndex>59</PortraitIndex>
    			<IconAtlas>PROMOTION_ATLAS</IconAtlas>
    			<PediaType>PEDIA_ATTRIBUTES</PediaType>
    			<PediaEntry>TXT_KEY_PROMOTION_FIRE_SUPPORT</PediaEntry>
    		</Row>
    If I wanted to update this promotion in SQL. To change the <CityAttack>33</CityAttack> to <CityAttack>10</CityAttack>, what would the update code be?

    I want to reduce this for my dreadnought. It seems a bit overpowered in game anyway, it makes it way too easy to take a coastal city.
     
  9. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Also, is Battleship the proper template for danrells generic Dreadnought unit. Here is the code. I want this unit to be available to all civs. Is there anty code I am missing here?

    Spoiler :
    Code:
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    	SELECT	("ART_DEF_UNIT_DREADNOUGHT"), "DamageStates", "Formation"
    	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_BATTLESHIP");
    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    	SELECT	("ART_DEF_UNIT_DREADNOUGHT"), ("ART_DEF_UNIT_MEMBER_DREADNOUGHT"), "NumMembers"
    	FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_BATTLESHIP");
    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_DREADNOUGHT"), "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_BATTLESHIP");
    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_DREADNOUGHT"), "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_BATTLESHIP");
    INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
    	SELECT	("ART_DEF_UNIT_MEMBER_DREADNOUGHT"), "Scale", "ZOffset", "Domain", 
    			("Dreadnought_Generic.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
    	FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_BATTLESHIP");
    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_DREADNOUGHT"), ("Dreadnought"), "Civilopedia", "Strategy", "Help", "Requirements",
    			"Combat", "RangedCombat", "Cost", "Moves", "Immobile", "Range", "BaseSightRange", ("UNITCLASS_BATTLESHIP"), "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_DREADNOUGHT"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
    			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
    	FROM "Units" WHERE (Type = "UNIT_BATTLESHIP");
    INSERT INTO "Unit_AITypes" ('UnitType', 'UnitAIType')
    	SELECT ("UNIT_DREADNOUGHT"), "UnitAIType"
    	FROM "Unit_AITypes" WHERE (UnitType = "UNIT_BATTLESHIP");
    INSERT INTO "Unit_ClassUpgrades" ('UnitType', 'UnitClassType')
    	SELECT ("UNIT_DREADNOUGHT"), "UnitClassType"
    	FROM "Unit_ClassUpgrades" WHERE (UnitType = "UNIT_BATTLESHIP");
    INSERT INTO "Unit_Flavors" ('UnitType', 'FlavorType', 'Flavor')
    	SELECT ("UNIT_DREADNOUGHT"), "FlavorType", "Flavor"
    	FROM "Unit_Flavors" WHERE (UnitType = "UNIT_BATTLESHIP");
    INSERT INTO "Unit_FreePromotions" ('UnitType', 'PromotionType')
    	SELECT ("UNIT_DREADNOUGHT"), "PromotionType"
    	FROM "Unit_FreePromotions" WHERE (UnitType = "UNIT_BATTLESHIP");
    INSERT INTO "Unit_ResourceQuantityRequirements" ('UnitType', 'ResourceType', 'Cost')
    	SELECT ("UNIT_DREADNOUGHT"), "ResourceType", "Cost"
    	FROM "Unit_ResourceQuantityRequirements" WHERE (UnitType = "UNIT_BATTLESHIP");
     


    I tried to add code it did not work. Both units are displayed in the civilopedia in game, but the battleship is the only unit in the techtree.

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


    What I need to do is replace the Unitclass Battleship, with Unitclass Dreadnought. Is there a way to do this?
     
  10. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,649
    Location:
    France
    You need the INSERT INTO UnitClasses ... code, yes, and also change the unitclass entry (in red) in the INSERT INTO Units ... statement, like that:

    Code:
    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_DREADNOUGHT"), ("Dreadnought"), "Civilopedia", "Strategy", "Help", "Requirements",
    			"Combat", "RangedCombat", "Cost", "Moves", "Immobile", "Range", "BaseSightRange", [COLOR="Red"]("UNITCLASS_DREADNOUGHT")[/COLOR], "Special", "Capture", "CombatClass", "Domain", "CivilianAttackPriority", "DefaultUnitAI", "Food", "NoBadGoodies", "RivalTerritory", "MilitarySupport", "MilitaryProduction", "Pillage", "Found", "FoundAbroad", "CultureBombRadius", "GoldenAgeTurns", "IgnoreBuildingDefense", "PrereqResources", "Mechanized", "Suicide", "CaptureWhileEmbarked",  [COLOR="SeaGreen"]("TECH_REPLACEABLE_PARTS")[/COLOR], "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_DREADNOUGHT"), "UnitArtInfoCulturalVariation", "UnitArtInfoEraVariation", "ProjectPrereq", "SpaceshipProject", "LeaderPromotion", "LeaderExperience", "DontShowYields", "ShowInPedia", "MoveRate",
    			"UnitFlagIconOffset", "PortraitIndex", "IconAtlas", "UnitFlagAtlas"
    	FROM "Units" WHERE (Type = "UNIT_BATTLESHIP");
    And if you want to change the requested tech, I've put it in Replaceable part as an example (in green).
     
  11. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Thank you Gedemon, but there is still something strange going on. The Battleship still shows up in the techtree, and is the unit available for construction in the city build panel. The Dreadnought shows up in the units civilopedia, as an unlocked unit for the replaceable parts tech, but does not show up in the techtree, like Great War Infantry does. I must be crazy or there is some small overlooked mistake someplace. The SQL code checks out as far as typo mistakes.

    We need to completely override the battleship unit from tech electronics, which is where I want the dreadnought unit to be, for the end in 1918 mod.
     
  12. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,649
    Location:
    France
    Change replaceable parts with electronics for the dreadnought and change electronic to future tech for the battleship, the second one will be coded like that:

    UPDATE Units SET PrereqTech = 'TECH_FUTURE_TECH' WHERE Type = 'UNIT_BATTLESHIP';

    Still, I don't know why it does not appears in the tech tree with your change... I haven't modded that part of the game yet, so maybe there's something else to do.
     
  13. nokmirt

    nokmirt Emperor

    Joined:
    Feb 14, 2009
    Messages:
    5,087
    Location:
    Iowa USA
    Ok the unit works if it I use the
    Code:
    INSERT INTO "Civilization_UnitClassOverrides" ( 'CivilizationType', 'UnitClassType', 'UnitType' )
    	VALUES ( 'CIVILIZATION_FRANCE', 'UNITCLASS_BATTLESHIP', 'UNIT_DREADNOUGHT' );
    I just can't make it a unit all civs can use. Of course, I could use the code for every single civ in the game. :lol: Am I that ambitious though? NO! :lol:

    I'll try your suggestion though. Thanks, I really appreciate your help.
     
  14. xxhe

    xxhe Chieftain

    Joined:
    Mar 10, 2008
    Messages:
    356
    Location:
    IN.
    Hello Gedemon:
    1) In post .674 patch and G&K, the original steps 3,4 are still valid or is totally invalid? You said "not needed" and I'm not quite sure if I understand it right: I think we can still use the original way, it's just not as efficient as what you showed in post #6.

    2) For the step 7, can I replace the ("Biplan") with "TXT_KEY_BIPLANE_DESC" to make my mod multi-language compatible?

    Thank you!
    xxhe
     
  15. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,649
    Location:
    France
    1/ You can't use steps 3 and 4 anymore, the new system doesn't allow the complete replacement of the artdefines XML for units.

    2/ Yes, you can replace it with a text key, same for the "help" column in unit or "description" in unitclass. Remember the () for column you're replacing with new value:
    ("TXT_KEY_BIPLANE_DESC")
     
  16. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Super Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,785
    Location:
    Leeds (UK)
    I appreciate the work that's been put in here, but to be honest, I'm still puzzled. I sincerely hope you'll get an opportunity to re-write the first post soon and feel that once I've worked out how to get one unit in-game, the rest will be quite easy.
     
  17. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,156
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    The confusion comes from the fact that there are various concepts that can be covered by "adding a unit." What kind of unit do you want to add?

    Are you going to use unit art from the vanilla game (or even one of the scenarios) or are you adding custom models and/or textures? Is this a new kind of unit for all civs to build, or a unique unit for specific civ(s)? Or are you just creating ethnic versions of units that are straight copies of a vanilla unit for specific civ(s)?
     
  18. Rob (R8XFT)

    Rob (R8XFT) Ancient Briton Super Moderator

    Joined:
    Aug 11, 2002
    Messages:
    10,785
    Location:
    Leeds (UK)
    My mod contains several units, all of which work; however, for example, the unique unit for Mycenae is a spearman who has a different icon to the regular spearman and a different flag icon, but the actual unit graphics are the same as the regular spearman. I therefore would like to use one of Dandrell's units to make it so it's different.
     
  19. xxhe

    xxhe Chieftain

    Joined:
    Mar 10, 2008
    Messages:
    356
    Location:
    IN.
    Thank you Gedemon:goodjob:

    One more question: Is there any XML way to do step 3&4 in G&K expansion? I prefer using XML since it reads easier. Anyway, I can try to use SQL if it's required.

    xxhe
     
  20. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,649
    Location:
    France
    yes, the Tiny Death Robots (v 1) mod is available on the steam workshop as an example for adding new units in XML.
     

Share This Page