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

    Numinor1 Chieftain

    Joined:
    Mar 1, 2013
    Messages:
    8
    Location:
    Maryland USA
    I have been trying to add Cavalry to the R.E.D. WWII mod (v39). I can add the units via the g_Reinforcement_OOB but they do not show up in the production list for cities.
     
  2. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    [I haven't tested it, but at least one problem appears to be that] you also need to revise Lua\RedDefinesUnits.lua to allow each civ to build the cavalry.

    EDIT:
    Add ", CAVALRY" to each civ, e.g.:
    Spoiler :
    Code:
    Lg_Major_Units = {
    	[FRANCE] = {
    		FR_INFANTRY, FR_LEGION,
    		FR_R35, FR_R40, FR_H35, FR_H39,
    		FR_S35, FR_B1, FR_ARL_44,
    		FR_MB152, FR_D520, FR_POTEZ630,
    		FR_LN401, FR_AMIOT350,
    		FR_FANTASQUE, FR_GALISSONIERE, FR_SUBMARINE, FR_BATTLESHIP, FR_BATTLESHIP_2,
    		ARTILLERY, AA_GUN, AT_GUN, CAVALRY},
    	[ENGLAND] = {
    		UK_INFANTRY,
    		UK_MATILDA_I, UK_CRUISER_II, UK_CRUISER_III, UK_CRUISER_IV, UK_A10_VALENTINE, UK_A15_CRUSADER,
    		UK_MATILDA_II, UK_M4_FIREFLY,
    		UK_CHURCHILL,
    		UK_SPITFIRE, UK_SPITFIRE_V, UK_SPITFIRE_IX, UK_WHIRLWIND, UK_BEAUFIGHTER,
    		UK_MOSQUITO, UK_WELLINGTON, UK_HALIFAX, UK_LANCASTER,
    		UK_TRIBA, UK_SUBMARINE, UK_DIDO, UK_BATTLESHIP, UK_BATTLESHIP_2,
    		ARTILLERY, AA_GUN, AT_GUN, CAVALRY},
    
     
  3. Numinor1

    Numinor1 Chieftain

    Joined:
    Mar 1, 2013
    Messages:
    8
    Location:
    Maryland USA
    Hi, That fixed it .. Thanks !!!
    :woohoo:
     
  4. Chrisbburn

    Chrisbburn Chieftain

    Joined:
    Aug 9, 2013
    Messages:
    81
    Could someone please help I am having trouble putting the fantastic Cruiser by Lord Tirian unit into the game and getting the icons to work correctly

    Here is my Units SQL:

    Spoiler :
    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_CRUISER'), ('Cruiser'), Civilopedia, Strategy, Help, Requirements, (40), (45), (250), Moves, Immobile, (2), BaseSightRange, ('UNITCLASS_CRUISER'), Special, Capture, CombatClass, Domain, CivilianAttackPriority, DefaultUnitAI, Food, NoBadGoodies, RivalTerritory, MilitarySupport, MilitaryProduction, Pillage, Found, FoundAbroad, CultureBombRadius, GoldenAgeTurns, IgnoreBuildingDefense, PrereqResources, Mechanized, Suicide, CaptureWhileEmbarked, ('TECH_BIOLOGY'), 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_CRUISER'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate, 0, 0, ('UNIT_CRUISER_FLAG_ART'), ('UNIT_CRUISER_PORTRAIT_ART')
    FROM Units WHERE (Type = 'UNIT_FRIGATE');


    AND the UNITSART that I believe is needed

    Spoiler :
    INSERT INTO ArtDefine_UnitInfos (Type,DamageStates,Formation)
    SELECT ('ART_DEF_UNIT_CRUISER'), DamageStates, Formation
    FROM ArtDefine_UnitInfos WHERE (Type = 'ART_DEF_UNIT_FRIGATE');

    INSERT INTO ArtDefine_UnitInfoMemberInfos (UnitInfoType,UnitMemberInfoType,NumMembers)
    SELECT ('ART_DEF_UNIT_CRUISER'), ('ART_DEF_UNIT_MEMBER_CRUISER'), NumMembers
    FROM ArtDefine_UnitInfoMemberInfos WHERE (UnitInfoType = 'ART_DEF_UNIT_FRIGATE');

    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_CRUISER'), 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_FRIGATE');

    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_CRUISER'), "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_FRIGATE');

    INSERT INTO ArtDefine_UnitMemberInfos (Type, Scale, ZOffset, Domain, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
    SELECT ('ART_DEF_UNIT_MEMBER_CRUISER'), ('0.086'), ZOffset, Domain, ('cruiser.fxsxml'), MaterialTypeTag, MaterialTypeSoundOverrideTag
    FROM ArtDefine_UnitMemberInfos WHERE (Type = 'ART_DEF_UNIT_MEMBER_FRIGATE');

    INSERT INTO ArtDefine_StrategicView (StrategicViewType, TileType, Asset )
    SELECT ('ART_DEF_UNIT_CRUISER'), TileType, ('svcruiser.dds')
    FROM ArtDefine_StrategicView WHERE (StrategicViewType = 'ART_DEF_UNIT_FRIGATE');

    INSERT INTO (IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn)
    VALUES ('UNIT_CRUISER_FLAG_ART', 32, 'cruiserflag.dds', 1, 1)
    VALUES ('UNIT_CRUISER_PORTRAIT_ART',32, 'cruiserportrait.dds', 1, 1);


    Everything else is working strategic view graphics animations just I get the settler flag and a blank portrait. PLease help!
     
  5. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    For Scale, you don't want to enclose the number in quotes.

    I'm guessing you forgot to set your svcruiser.dds file to VFS=true [or forgot to include it at all!].

    EDIT: Plus, these are the sizes you need for your [portrait] atlases: 45, 64, 80, 128, 256
     
  6. Chrisbburn

    Chrisbburn Chieftain

    Joined:
    Aug 9, 2013
    Messages:
    81
    I have got the Strategic view to show the icon fine just not the normal world view I get this

    Spoiler :
     
  7. Nutty

    Nutty Deity

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

    Chrisbburn Chieftain

    Joined:
    Aug 9, 2013
    Messages:
    81
    So its the scale and I have added the other sizes in let me try, All the asset have VFS se to true. The file only came with these .dds files

    Spoiler :


    So i used the cruiserportrait.dds as the portrait and the cruiserflag.dds as the flag

    correct?
     
  9. Nutty

    Nutty Deity

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

    Chrisbburn Chieftain

    Joined:
    Aug 9, 2013
    Messages:
    81
    Ok thanks I will try that. What about the UNITFLAG??

    EDIT - Tried that still got the same problem. What numbers should I have for the UnitFlagOffset and PortraitIndex??
     
  11. clone12

    clone12 Chieftain

    Joined:
    Aug 6, 2014
    Messages:
    5
    Hello, i recently started modding CIV 5. I created a working civ with custom leader and trait, but i have trouble adding a Pz IV tank to be used alongside with the regular tank for my civ. Using SQL i added it to my civ, but i can't build it from my cities and when i try to spawn it using IGE the game crashes:confused:

    I am new to and got used to work with XML. So I pretty much have 0 clue where the problem persists.

    Any help would be appreciated.

    Here is the SQL code for the unit

    Spoiler :
    INSERT INTO ArtDefine_UnitInfos(Type, DamageStates, Formation)
    VALUES ('ART_DEF_UNIT_PZIV_H', 1, 'Vehicle');
    INSERT INTO ArtDefine_UnitInfoMemberInfos(UnitInfoType, UnitMemberInfoType, NumMembers)
    VALUES ('ART_DEF_UNIT_PZIV_H', 'ART_DEF_UNIT_MEMBER_PZIV_H', 3);
    INSERT INTO ArtDefine_UnitMemberInfos(Type, Scale, Model, MaterialTypeTag, MaterialTypeSoundOverrideTag)
    VALUES ('ART_DEF_UNIT_MEMBER_PZIV_H', 0.119999997317791, 'PZIV_H.fxsxml', 'METAL', 'METALSM');
    INSERT INTO ArtDefine_UnitMemberCombats(UnitMemberType, EnableActions, HasShortRangedAttack, HasStationaryMelee, HasRefaceAfterCombat, ReformBeforeCombat, HasIndependentWeaponFacing)
    VALUES ('ART_DEF_UNIT_MEMBER_PZIV_H', 'Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady', 1, 1, 0, 1, 1);
    INSERT INTO ArtDefine_UnitMemberCombatWeapons(UnitMemberType, "Index", SubIndex, VisKillStrengthMin, VisKillStrengthMax, HitEffect, WeaponTypeTag, WeaponTypeSoundOverrideTag)
    VALUES ('ART_DEF_UNIT_MEMBER_PZIV_H', 0, 0, 25.0, 50.0, 'ART_DEF_VEFFECT_TANK_IMPACT_$(TERRAIN)', 'EXPLOSIVE', 'EXPLOSION6POUND');
    INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset)
    VALUES ('ART_DEF_UNIT_PZIV_H', 'Unit', 'SV_Tank.dds');

    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_PZIV_H'), ('Pz IV ausf. H'), Civilopedia, Strategy, Help, Requirements,
    Combat, (70), (350), Moves, Immobile, (6), BaseSightRange, ('UNITCLASS_PZIV_H'), 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_PZIV_H'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
    UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
    FROM Units WHERE (Type = 'UNIT_TANK');

    INSERT INTO Unit_AITypes (UnitType, UnitAIType)
    SELECT ('UNIT_PZIV_H'), UnitAIType
    FROM Unit_AITypes WHERE (UnitType = 'UNIT_TANK');

    INSERT INTO Unit_ClassUpgrades (UnitType, UnitClassType)
    SELECT ('UNIT_PZIV_H'), UnitClassType
    FROM Unit_ClassUpgrades WHERE (UnitType = 'UNIT_TANK');

    INSERT INTO Unit_Flavors (UnitType, FlavorType, Flavor)
    SELECT ('UNIT_PZIV_H'), FlavorType, Flavor
    FROM Unit_Flavors WHERE (UnitType = 'UNIT_TANK');

    INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
    SELECT ('UNIT_PZIV_H'), PromotionType
    FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_TANK');

    INSERT INTO Unit_ResourceQuantityRequirements (UnitType, ResourceType, Cost)
    SELECT ('UNIT_PZIV_H'), ResourceType, Cost
    FROM Unit_ResourceQuantityRequirements WHERE (UnitType = 'UNIT_TANK');
     
  12. Liamv3

    Liamv3 Chieftain

    Joined:
    Aug 26, 2014
    Messages:
    29
    Where do I put my files in? Can't believe you didn't make a screenshot. I am starting to get :mad: now.
     
  13. Liamv3

    Liamv3 Chieftain

    Joined:
    Aug 26, 2014
    Messages:
    29
    Uhmm... You made a civ,right? I need some help making a Civilization? Can you help me with the coding?
     
  14. Nutty

    Nutty Deity

    Joined:
    Mar 9, 2011
    Messages:
    3,162
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    @Liamv3: You haven't given anyone any information with which to help you. Post a new thread in the main Creation & Customization subforum, and attach whatever you have so far. There are lots of people that are happy to help, but you have to meet them halfway.

    If you've created a new mod in ModBuddy, it doesn't matter where you put the files. You can create folders, but they're there just to keep things organized.

    If you don't know what I'm talking about or where to start, skim through Kael's Guide, which though outdated is an excellent primer on modding for CiV. Once you've got a grasp of things, whoward69's new civ thread should prove very helpful.
     
  15. Liamv3

    Liamv3 Chieftain

    Joined:
    Aug 26, 2014
    Messages:
    29
    I need The Dawn of Man stuff and animation. I will make a forum..
    That Guide got me to a start. I will try to upload my current building
     
  16. clone12

    clone12 Chieftain

    Joined:
    Aug 6, 2014
    Messages:
    5
    Sorry for the late response, I was away for some time. To anweser you question, yes, i did create my own civ. I used Kael's guide (http://kael.civfanatics.net/files/ModdersGuide.pdf) on how to create a custom civ and came across many problems and errors. In order to solve them, I took many different codes from other custom civs to make it work which resulted into a mess, but its working, well, except adding multiple units.
     
  17. d0minus

    d0minus Chieftain

    Joined:
    Oct 3, 2013
    Messages:
    50
    Hi everyone
    I tried adding promotion to some of my skins and I partially made. Units like swordsman, longswordsman ect. promotion doesnt take effect...
    here 1 my sqls':
    Spoiler :
    UPDATE Units SET UnitArtInfoCulturalVariation = 1 WHERE Type = 'UNIT_GREAT_WAR_INFANTRY';

    -- GREECE WW1 Infantry
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    SELECT ("ART_DEF_UNIT_WW1_INFANTRY_GREECE"), "DamageStates", "Formation"
    FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_INFANTRY");
    INSERT INTO "ArtDefine_UnitInfoMemberInfos" ('UnitInfoType','UnitMemberInfoType','NumMembers')
    SELECT ("ART_DEF_UNIT_WW1_INFANTRY_GREECE"), ("ART_DEF_UNIT_MEMBER_WW1_INFANTRY_GREECE"), "NumMembers"
    FROM "ArtDefine_UnitInfoMemberInfos" WHERE (UnitInfoType = "ART_DEF_UNIT_WW1_INFANTRY");
    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_INFANTRY_GREECE"), "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_INFANTRY");
    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_INFANTRY_GREECE"), "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_INFANTRY");
    INSERT INTO "ArtDefine_UnitMemberInfos" ("Type", "Scale", "ZOffset", "Domain", "Model", "MaterialTypeTag", "MaterialTypeSoundOverrideTag")
    SELECT ("ART_DEF_UNIT_MEMBER_WW1_INFANTRY_GREECE"), "Scale", "ZOffset", "Domain",
    ("gregw1.fxsxml"), "MaterialTypeTag", "MaterialTypeSoundOverrideTag"
    FROM "ArtDefine_UnitMemberInfos" WHERE (Type = "ART_DEF_UNIT_MEMBER_WW1_INFANTRY");
    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_WW1_INFANTRY_GREECE'), Description, Civilopedia, Strategy, Help, Requirements,
    Combat, RangedCombat, Cost, 99, Immobile, Range, BaseSightRange, ('UNITCLASS_ANTI_WW1_INFANTRY'), 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_WW1_INFANTRY'), UnitArtInfoCulturalVariation, UnitArtInfoEraVariation, ProjectPrereq, SpaceshipProject, LeaderPromotion, LeaderExperience, DontShowYields, ShowInPedia, MoveRate,
    UnitFlagIconOffset, PortraitIndex, IconAtlas, UnitFlagAtlas
    FROM Units WHERE (Type = 'UNIT_GREAT_WAR_INFANTRY');
    INSERT INTO Unit_FreePromotions ('UnitType', 'PromotionType')
    SELECT ("UNIT_WW1_INFANTRY_GREECE"), ("PROMOTION_BLITZ")
    FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_GREAT_WAR_INFANTRY');

    any help will be appreciated
    thanx
     
  18. Artisanix

    Artisanix Chieftain

    Joined:
    Oct 6, 2013
    Messages:
    97
    @d0minus
    Code:
    INSERT INTO Unit_FreePromotions ('UnitType', 'PromotionType')
    SELECT ("UNIT_WW1_INFANTRY_GREECE"), ("PROMOTION_BLITZ")
    FROM Unit_FreePromotions WHERE (UnitType = 'UNIT_GREAT_WAR_INFANTRY');
    There's no record with UNIT_GREAT_WAR_INFANTRY value in Unit_FreePromotions table by default, so this query returns nothing. So either you need to have it in your other code elsewhere, or it's simply missing.

    If you work with SQL, you may want to download plugin for Firefox - SQLite Manager - to browse through the game's database, check tables and values, and test your queries there for validity. Otherwise it's like taking a blind guess everytime.
     
  19. d0minus

    d0minus Chieftain

    Joined:
    Oct 3, 2013
    Messages:
    50
    thanx but u mean I have make another .sql adding values on that table?
    Im not sure how... but Im going to check sqlite
     
  20. Artisanix

    Artisanix Chieftain

    Joined:
    Oct 6, 2013
    Messages:
    97
    Not really. Rather you should clearly define what you exactly want to achieve there first ;]

    From your code, I assume that you want to create a special unit for Greece with a free promotion. And this unit is supposed to be based on Great War Infrantry.
    The point is that G.W.I. has no any free promotions as it is a generic unit. So in this case you can't use SELECT statement because there is no any data for this query to copy from.

    And if you want just to assign for your unit the blitz free promotion then this code is enough here:
    Code:
    INSERT INTO Unit_FreePromotions (UnitType, PromotionType)
    VALUES ('UNIT_WW1_INFANTRY_GREECE', 'PROMOTION_BLITZ');

    and btw:
    You don't have a cleanest code there, which makes it hard to read, not only for others but for you as well. For instance don't use quotes of any kind for table and column names - it's uneccessary. Don't put single values in brackets, etc.

    for instance this:
    Code:
    INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
    SELECT ("ART_DEF_UNIT_WW1_INFANTRY_GREECE"), "DamageStates", "Formation"
    FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_WW1_INFANTRY");
    can be replaced with this:
    Code:
    INSERT INTO ArtDefine_UnitInfos (Type, DamageStates, Formation)
    SELECT 'ART_DEF_UNIT_WW1_INFANTRY_GREECE', DamageStates, Formation
    FROM ArtDefine_UnitInfos
    WHERE Type = 'ART_DEF_UNIT_WW1_INFANTRY';
    If you have longer SQL code it makes it easier to read, where single quotes are only reserved for text values inserted to/retrived from database.
     

Share This Page