Changing values in promotions via SQL question.

nokmirt

Emperor
Joined
Feb 14, 2009
Messages
5,088
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.
 
Code:
UPDATE UnitPromotions
SET CityAttack = 10
WHERE Type = "PROMOTION_FIRE_SUPPORT";
 
Code:
UPDATE UnitPromotions
SET CityAttack = 10
WHERE Type = "PROMOTION_FIRE_SUPPORT";

Thank you PawelS.

Would you know this?

Is the 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 code I am missing here? Because in game the unit does not show up in the techtree.

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? Something is confusing me here with SQL. I need a UnitClassOverride for all civs in one, instead of just one civ, as in a UU.
 
Is the Battleship the proper template for danrells generic Dreadnought unit.

I have no idea. But you can check it by placing the unit on the map using the FireTuner (it should be on the list of units even if it doesn't show on the tech tree).


I'm doing such things as adding new units in XML instead of SQL, so I can't really tell if your code is correct. But it seems to me that the reason why the Dreadnought doesn't appear in the tech tree is because you copy the default unit from the Battleship class to the Dreadnought class, so the default unit for UNITCLASS_DREADNOUGHT is UNIT_BATTLESHIP (DefaultUnit is the "UnitClassOverride for all civs" that you speak of). So in the second piece of code that you posted, you should replace
Code:
"DefaultUnit"
with
Code:
("UNIT_DREADNOUGHT")
(assuming that you use quotation marks and parentheses properly, of which I'm not sure because of my limited knowledge of SQL). Also the description should probably be changed, but I don't know where it's used for Unit Classes.

What I need to do is replace the Unitclass Battleship, with Unitclass Dreadnought. Is there a way to do this? Something is confusing me here with SQL. I need a UnitClassOverride for all civs in one, instead of just one civ, as in a UU.

You mean that the Battleship shouldn't be in the game, and should be replaced with the Dreadnought? Then you can use UPDATE instead of INSERT INTO, it simplifies the code compared to the one you posted, because you don't need to copy all the columns, just update the ones that should be changed. So, instead of:

Code:
INSERT INTO "ArtDefine_UnitInfos" ('Type','DamageStates','Formation')
	SELECT	("ART_DEF_UNIT_DREADNOUGHT"), "DamageStates", "Formation"
	FROM "ArtDefine_UnitInfos" WHERE (Type = "ART_DEF_UNIT_BATTLESHIP");

You can use
Code:
UPDATE ArtDefine_UnitInfos
SET Type = "ART_DEF_UNIT_DREADNOUGHT"
WHERE Type = "ART_DEF_UNIT_BATTLESHIP";

And so on.
 
I have the unit working, but only through a Civilization_UnitClassOverrides. As a civ specific UU. I am not sure yet, how to make it available to all civs. There must be a way. Gedemon should get back to me soon, he may not know either though.

What I figured was if there is a code that allows the units to be available to one civ, there must be code, that makes the unit available to all civs. Right? :(
 
Yes, if you set default unit of a class to a unit, that unit is available for all civs by default:

Code:
UPDATE UnitClasses
SET DefaultUnit = "UNIT_DREADNOUGHT"
WHERE Type = "UNITCLASS_DREADNOUGHT";

(Or when constructing the class using INSERT INTO, insert the default unit in the right place, as I wrote in my previous post.)
 
Yep and thank you. Except
Code:
UPDATE UnitClasses
SET DefaultUnit = "UNIT_DREADNOUGHT"
WHERE Type = "UNITCLASS_BATTLESHIP";

Works great now I just have to reduce the fire support promotion.
 
Back
Top Bottom