Adding combat strength to all units

Zauberfaedenpony

Chieftain
Joined
Oct 10, 2020
Messages
5
Hi all,

I am new to modding and I did not find any references to unit groups (e.g.: military units, raged units etc.)
Is there a way to add e.g. 5 combat strength to all units, or do I need to do it like:

INSERT INTO Modifiers
(ModifierId, ModifierType, RunOnce, Permanent )
VALUES ('MODIFIER_ADDITIONAL_COMBAT_STRENGTH', 'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH', 0, 1 ),

INSERT INTO ModifierArguments
(ModifierId, Name, Value )
('MODIFIER_ADDITIONAL_COMBAT_STRENGTH', 'UnitType', 'UNIT_WARRIOR')
('MODIFIER_ADDITIONAL_COMBAT_STRENGTH', 'ModifierType', 'PLAYER_UNIT_ADJUST_COMBAT_STREGTH')
('MODIFIER_ADDITIONAL_COMBAT_STRENGTH', 'Amount', '5')
('MODIFIER_ADDITIONAL_COMBAT_STRENGTH', 'UnitType', 'UNIT_ARCHER')
...
 
If you want to add combat strength to all Warrior Units of all players, all that is necessary is a simple update to the data of the <Units> table:
Code:
UPDATE Units SET Combat=25 WHERE UnitType='UNIT_WARRIOR';
If you want to raise the Ranged Combat power of all ranged units for all players you can do as
Code:
UPDATE Units SET RangedCombat=RangedCombat+5 WHERE RangedCombat > 0;
If you want to increase the combat strength of all units belonging to a particualar civilization or leader then you need to either use a UnitAbility that gets attached to all the units of that player, or a modifier attached to that leader or civilization that raises the power of the units for that player.
 
Hi again,

thanks for your answers.
... a modifier attached to that leader or civilization that raises the power of the units for that player.

Thisis, what I wanted to do. How do I actually create the modifier?

In the Civilazation_UA.sql I define the Type, Trait, CivilizationTrait, Traitmodifier and Modifier like:

INSERT INTO Types
(Type, Kind )
VALUES ('TRAIT_CIVILIZATION_WITH_MIGHT', 'KIND_TRAIT' );


INSERT INTO Traits
(TraitType, Name, Description )
VALUES ('TRAIT_CIVILIZATION_WITH_MIGHT', 'LOC_TRAIT_CIVILIZATION_WITH_MIGHT_NAME', 'LOC_TRAIT_CIVILIZATION_WITH_MIGHT_DESCRIPTION' );


INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_ZFP_ATLANTIA' 'TRAIT_CIVILIZATION_WITH_MIGHT' );


INSERT INTO TraitModifiers
(TraitType, ModifierId )
VALUES ('TRAIT_CIVILIZATION_WITH_MIGHT', 'MODIFIER_WITH_MIGHT_COMBAT_STRENGTH' );


INSERT INTO Modifiers
(ModifierId, ModifierType, RunOnce, Permanent )
VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH', 0, 1 );


But now I got my problem with the arguments:


INSERT INTO ModifierArguments
(ModifierId, Name, Value )
VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'ModifierType', MODIFIER_PLAYER_UNITS_ADJUST_DAMAGE' ),
('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'Amount', '5' ),

Can I actually start with the MODIFIER_PLAYER_UNITS_ADJUST_DAMAGE Modifier (and is it the correct one I am using), or do I need to start out with a specific player and how do I do that?
 
Code:
INSERT INTO Modifiers
(ModifierId, ModifierType )
VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH' );

INSERT INTO ModifierArguments
(ModifierId, Name, Value )
VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'Amount', '5' );
Essentially the same thing as TRAIT_TOQUI_COMBAT_BONUS_VS_GOLDEN_AGE_CIV just without the opponent golden age requirements.
 
Last edited:
Single quotation mark is a bit confusing.
In the examples above, sometimes single quotation mark is used around number, but sometimes not.

VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'Amount', '5' );
UPDATE Units SET Combat=25 WHERE UnitType='UNIT_WARRIOR';

Also, in my recent work, I found this line doesn't work without single quotation mark.

UPDATE ModifierArguments SET Name = 'BuildingType' WHERE ModifierId='TRAIT_FLOOD_BARRIER_PRODUCTION' AND Name = 'DistrictType';

I heard quotation mark is used for string. But number 5 would be integer or float. Also BuildingType or DistrictType would be Column-name.
What is the rule of single quotation in our Modding?
 
Single quotation mark is a bit confusing.
In the examples above, sometimes single quotation mark is used around number, but sometimes not.

VALUES ('MODIFIER_WITH_MIGHT_COMBAT_STRENGTH', 'Amount', '5' );
UPDATE Units SET Combat=25 WHERE UnitType='UNIT_WARRIOR';

Also, in my recent work, I found this line doesn't work without single quotation mark.

UPDATE ModifierArguments SET Name = 'BuildingType' WHERE ModifierId='TRAIT_FLOOD_BARRIER_PRODUCTION' AND Name = 'DistrictType';

I heard quotation mark is used for string. But number 5 would be integer or float. Also BuildingType or DistrictType would be Column-name.
What is the rule of single quotation in our Modding?
Table ModifierArguments is an odd duck case with the Value column because sometimes you are entering actual text and sometimes actual integer or boolean values. The column however is defined as text so most people tend to input data as text strings rather than integer or boolean 1/0.
Column "Name" is also defined as a text string and even though you are inputting an argument that may look like a Column-Name from another table, you are not entering a column-name, you are entering a text-string.
Column "Combat" in table "Units" is defined as integer so no text-stringing is needed or desired.

The basic rule to use is that if the definition of the column within the table expects to see a text string then you are better off entering argument data as a text-string, even though what you are entering for argument-data may look like an integer or a column-name from another table. Most of the InGame table definitions are found at
C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data\Schema/01_GameplaySchema.sql
Stuff added to to the game by Rise and Fall or Gathering Storm are in a Schema sql file within the data folders of the appropriate expansion. So, for ModifierArguments the definition of the table within the 01_GameplaySchema.sql file is:
Code:
CREATE TABLE "ModifierArguments" (
		"ModifierId" TEXT NOT NULL,
		"Name" TEXT NOT NULL,
		"Type" TEXT NOT NULL DEFAULT "ARGTYPE_IDENTITY",
		"Value" TEXT NOT NULL,
		"Extra" TEXT,
		"SecondExtra" TEXT,
		PRIMARY KEY(ModifierId, Name),
		FOREIGN KEY (ModifierId) REFERENCES Modifiers(ModifierId) ON DELETE CASCADE ON UPDATE CASCADE);
Everything added to the game-table is interpretted as text.

Generally however whether you enter text-string '1' or integer 1 for an argument data, both sql and the game are pretty forgiving and will interpret that as integer value 1. The exception for boots-and-suspenders purposes is that columns defined to be booleans really need integers 1 or 0 rather than text-string '1' or '0' in sql
 
Thanks a lot for your help.
I will try this out.
Just make sure if you copy paste you correct the code to fix where I had "NSERT" instead of "INSERT" in the example code.

typos happen to us all and generally lead to ----> :wallbash: :badcomp:
 
Back
Top Bottom