Modifiers HELP

gelodgreat

Prince
Joined
Oct 23, 2015
Messages
465
Location
Manila, Philippines
Please help me to better understand on how to use the modifiers. I want to make conquistador ability to all my units but it wont work.

this is my code

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


INSERT INTO Modifiers (ModifierId,ModifierType) VALUES
('TRAIT_GDG_IRON_CRUSADE','MODIFIER_ALL_UNITS_GRANT_ABILITY');

INSERT INTO ModifierArguments (ModifierId,Name,Value) VALUES
('TRAIT_GDG_IRON_CRUSADE','UnitAbilityType','ABILITY_CONQUISTADOR');


INSERT INTO Traits (TraitType,Name,Description) VALUES
('TRAIT_GDG_IRON_SOLDIERS','LOC_TRAIT_GDG_IRON_SOLDIERS_NAME','LOC_TRAIT_GDG_IRON_SOLDIERS_DESCRIPTION');

INSERT INTO TraitModifiers (TraitType,ModifierId) VALUES
('TRAIT_GDG_IRON_SOLDIERS','TRAIT_GDG_IRON_CRUSADE'),
 
I don't know anything about this specific ability, but looking at what you posted, I'm unsure what you're trying to do. Can you clarify?

In general, the TraitModifiers table is used to tie a Modifier to a Trait. But from what I can see, the Trait you created is never assigned to either a Leader or a Civilization (via LeaderTraits or CivilizationTraits tables respectively). Right now, you're creating the Trait and linking a Modifier to it, but it never gets assigned to anyone.


If you want to make this new ability apply to every major civ, you could bypass the tables above and use:

INSERT INTO TraitModifiers (TraitType,ModifierId) VALUES
('TRAIT_LEADER_MAJOR_CIV','TRAIT_GDG_IRON_CRUSADE') ;

Note that if you did it this way, you don't need to create a new Trait at all anymore. You just assign the Modifier to the existing TRAIT_LEADER_MAJOR_CIV trait.


Also, in general as a naming convention, I avoid creating Modifiers with the name "TRAIT" in them. I know Firaxis did this with their modifiers. But it all becomes very confusing to me when you start linking the Modifier to actual Trait objects.


Also, when inserting the Modifier itself, I recommend including the additional fields and explicitly declaring them 0 or NULL, just for ensuring you know exactly what is happening. I always use this base:

Code:
INSERT INTO Modifiers
    (ModifierID,             ModifierType,                     RunOnce,     Permanent,     OwnerRequirementSetId,     SubjectRequirementSetId)
VALUES    ('',     '',     0,         0,         NULL,            NULL) ;
 
I don't know anything about this specific ability, but looking at what you posted, I'm unsure what you're trying to do. Can you clarify?

In general, the TraitModifiers table is used to tie a Modifier to a Trait. But from what I can see, the Trait you created is never assigned to either a Leader or a Civilization (via LeaderTraits or CivilizationTraits tables respectively). Right now, you're creating the Trait and linking a Modifier to it, but it never gets assigned to anyone.


If you want to make this new ability apply to every major civ, you could bypass the tables above and use:

INSERT INTO TraitModifiers (TraitType,ModifierId) VALUES
('TRAIT_LEADER_MAJOR_CIV','TRAIT_GDG_IRON_CRUSADE') ;

Note that if you did it this way, you don't need to create a new Trait at all anymore. You just assign the Modifier to the existing TRAIT_LEADER_MAJOR_CIV trait.


Also, in general as a naming convention, I avoid creating Modifiers with the name "TRAIT" in them. I know Firaxis did this with their modifiers. But it all becomes very confusing to me when you start linking the Modifier to actual Trait objects.


Also, when inserting the Modifier itself, I recommend including the additional fields and explicitly declaring them 0 or NULL, just for ensuring you know exactly what is happening. I always use this base:

Code:
INSERT INTO Modifiers
    (ModifierID,             ModifierType,                     RunOnce,     Permanent,     OwnerRequirementSetId,     SubjectRequirementSetId)
VALUES    ('',     '',     0,         0,         NULL,            NULL) ;

INSERT INTO LeaderTraits (LeaderType,TraitType) VALUES
('LEADER_HOJO','TRAIT_GDG_IRON_SOLDIERS');

i've been trying to use this modifier MODIFIER_ALL_UNITS_GRANT_ABILITY but when i test and play it the game it doesnt work. so i dont know how. im copying the Ability of Conquistador and grant it all on my civilizations units
 
There are only two places where Firaxis used MODIFIER_ALL_UNITS_GRANT_ABILITY for the DLC I have: for the Mt Everest effect and for the Giant's Causeway effect from the Viking Scenario. Both use <Name>AbilityType</Name> instead of UnitAbilityType, and both are granting an Ability to a Unit. I have granted an ability via a new type of Building in a mod and I also used Name="AbilityType".

For reference this is everything I could find related to the ability "Alpine Training" as given by Mt Everest.
Spoiler :
Code:
	<Types>
		<Row Type="MODIFIER_ALL_UNITS_GRANT_ABILITY" Kind="KIND_MODIFIER"/>
	</Types>
	<DynamicModifiers>
		<Row>
			<ModifierType>MODIFIER_ALL_UNITS_GRANT_ABILITY</ModifierType>
			<CollectionType>COLLECTION_ALL_UNITS</CollectionType>
			<EffectType>EFFECT_GRANT_ABILITY</EffectType>
		</Row>
	</DynamicModifiers>
	<Requirements>
		<Row>
			<RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
			<RequirementType>REQUIREMENT_PLOT_ADJACENT_FEATURE_TYPE_MATCHES</RequirementType>
		</Row>
	</Requirements>
	<RequirementArguments>
		<Row>
			<RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
			<Name>FeatureType</Name>
			<Value>FEATURE_EVEREST</Value>
		</Row>
	</RequirementArguments>
	<RequirementSets>
		<Row>
			<RequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</RequirementSetId>
			<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
		</Row>
	</RequirementSets>
	<RequirementSetRequirements>
		<Row>
			<RequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</RequirementSetId>
			<RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
		</Row>
	</RequirementSetRequirements>
	<Modifiers>
		<Row>
			<ModifierId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY</ModifierId>
			<ModifierType>MODIFIER_ALL_UNITS_GRANT_ABILITY</ModifierType>
			<Permanent>true</Permanent>
			<SubjectRequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</SubjectRequirementSetId>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY</ModifierId>
			<Name>AbilityType</Name>
			<Value>ABILITY_ALTITUDE_TRAINING</Value>
		</Row>
	</ModifierArguments>
	<GameModifiers>
		<Row ModifierId="EVEREST_ADJACENT_UNITS_GRANT_ABILITY"/>
	</GameModifiers>
 
There are only two places where Firaxis used MODIFIER_ALL_UNITS_GRANT_ABILITY for the DLC I have: for the Mt Everest effect and for the Giant's Causeway effect from the Viking Scenario. Both use <Name>AbilityType</Name> instead of UnitAbilityType, and both are granting an Ability to a Unit. I have granted an ability via a new type of Building in a mod and I also used Name="AbilityType".

For reference this is everything I could find related to the ability "Alpine Training" as given by Mt Everest.
Spoiler :
Code:
    <Types>
        <Row Type="MODIFIER_ALL_UNITS_GRANT_ABILITY" Kind="KIND_MODIFIER"/>
    </Types>
    <DynamicModifiers>
        <Row>
            <ModifierType>MODIFIER_ALL_UNITS_GRANT_ABILITY</ModifierType>
            <CollectionType>COLLECTION_ALL_UNITS</CollectionType>
            <EffectType>EFFECT_GRANT_ABILITY</EffectType>
        </Row>
    </DynamicModifiers>
    <Requirements>
        <Row>
            <RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
            <RequirementType>REQUIREMENT_PLOT_ADJACENT_FEATURE_TYPE_MATCHES</RequirementType>
        </Row>
    </Requirements>
    <RequirementArguments>
        <Row>
            <RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
            <Name>FeatureType</Name>
            <Value>FEATURE_EVEREST</Value>
        </Row>
    </RequirementArguments>
    <RequirementSets>
        <Row>
            <RequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
        </Row>
    </RequirementSets>
    <RequirementSetRequirements>
        <Row>
            <RequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</RequirementSetId>
            <RequirementId>EVEREST_REQUIRES_ADJACENT_UNIT</RequirementId>
        </Row>
    </RequirementSetRequirements>
    <Modifiers>
        <Row>
            <ModifierId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY</ModifierId>
            <ModifierType>MODIFIER_ALL_UNITS_GRANT_ABILITY</ModifierType>
            <Permanent>true</Permanent>
            <SubjectRequirementSetId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY_REQUIREMENTS</SubjectRequirementSetId>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>EVEREST_ADJACENT_UNITS_GRANT_ABILITY</ModifierId>
            <Name>AbilityType</Name>
            <Value>ABILITY_ALTITUDE_TRAINING</Value>
        </Row>
    </ModifierArguments>
    <GameModifiers>
        <Row ModifierId="EVEREST_ADJACENT_UNITS_GRANT_ABILITY"/>
    </GameModifiers>


so my only wrong is the unitabilitytype?
 
You also need to attach the trait to a leader or a civilization, you would need to state in <Modifiers> that the effect is permanent, and in <Modifiers> I would have thought you would need some form of <SubjectRequirementSetId> and you would need to define the requirements and the test-type.
 
Hmmm. ok, a similar modifier type is used here. I think your basic problem is attempting to use a <ModifierType> that requires substantially more set-up in the Requirements and RequirementSets and so on.
Code:
	<Types>
		<Row Type="TRAIT_LEADER_MELEE_COASTAL_RAIDS" Kind="KIND_TRAIT"/>
	</Types>
	<LeaderTraits>
		<Row LeaderType="LEADER_HARDRADA" TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS"/>
	</LeaderTraits>
	<Traits>
		<Row TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS" Name="LOC_TRAIT_LEADER_THUNDERBOLT_NAME" Description="LOC_TRAIT_LEADER_THUNDERBOLT_DESCRIPTION"/>
	</Traits>
	<TraitModifiers>
		<Row TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS" ModifierId="TRAIT_GRANT_COASTAL_RAID_ABILITY"/>
	</TraitModifiers>
	<Modifiers>
		<Row>
			<ModifierId>TRAIT_GRANT_COASTAL_RAID_ABILITY</ModifierId>
			<ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
			<Permanent>true</Permanent>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_GRANT_COASTAL_RAID_ABILITY</ModifierId>
			<Name>AbilityType</Name>
			<Value>ABILITY_MELEE_COASTAL_RAID</Value>
		</Row>
	</ModifierArguments>
the type of modifier for Hardrata is
Code:
		<Row>
			<ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
			<CollectionType>COLLECTION_PLAYER_UNITS</CollectionType>
			<EffectType>EFFECT_GRANT_ABILITY</EffectType>
		</Row>
It therefore automatically applies to all the appropriate units for the player without the need for all the SubjectSetRequirementID and so on.
 
Last edited:
Hmmm. ok, a similar modifier type is used here. I think your basic problem is attempting to use a <ModifierType> that requires substantially more set-up in the Requirements and RequirementSets and so on.
Code:
    <Types>
        <Row Type="TRAIT_LEADER_MELEE_COASTAL_RAIDS" Kind="KIND_TRAIT"/>
    </Types>
    <LeaderTraits>
        <Row LeaderType="LEADER_HARDRADA" TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS"/>
    </LeaderTraits>
    <Traits>
        <Row TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS" Name="LOC_TRAIT_LEADER_THUNDERBOLT_NAME" Description="LOC_TRAIT_LEADER_THUNDERBOLT_DESCRIPTION"/>
    </Traits>
    <TraitModifiers>
        <Row TraitType="TRAIT_LEADER_MELEE_COASTAL_RAIDS" ModifierId="TRAIT_GRANT_COASTAL_RAID_ABILITY"/>
    </TraitModifiers>
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_GRANT_COASTAL_RAID_ABILITY</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
            <Permanent>true</Permanent>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_GRANT_COASTAL_RAID_ABILITY</ModifierId>
            <Name>AbilityType</Name>
            <Value>ABILITY_MELEE_COASTAL_RAID</Value>
        </Row>
    </ModifierArguments>
the type of modifier for Hardrata is
Code:
        <Row>
            <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
            <CollectionType>COLLECTION_PLAYER_UNITS</CollectionType>
            <EffectType>EFFECT_GRANT_ABILITY</EffectType>
        </Row>
It therefore automatically applies to all the appropriate units for the player without the need for all the SubjectSetRequirementID and so on.

This is my test code
still it doesnt work


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


INSERT INTO Modifiers (ModifierId,ModifierType) VALUES
('TRAIT_GDG_CIVILIZATION_HEAL','MODIFIER_PLAYER_UNITS_ADJUST_HEAL_FROM_COMBAT');

INSERT INTO Modifiers (ModifierId,ModifierType,Permanent) VALUES
('TRAIT_GDG_IRON_CRUSADE','MODIFIER_ALL_UNITS_GRANT_ABILITY',1);

INSERT INTO Modifiers (ModifierId,ModifierType,SubjectRequirementSetId) VALUES
('TRAIT_GDG_DAMAGED_WOUNDED','MODIFIER_PLAYER_UNITS_ADJUST_COMBAT_STRENGTH','REQUIREMENTS_OPPONENT_IS_WOUNDED');

INSERT INTO ModifierArguments (ModifierId,Name,Value) VALUES
('TRAIT_GDG_CIVILIZATION_HEAL','Amount',60),
('TRAIT_GDG_DAMAGED_WOUNDED','Amount',7),
('TRAIT_GDG_IRON_CRUSADE','AbilityType','ABILITY_CONQUISTADOR');


INSERT INTO Traits (TraitType,Name,Description) VALUES
('TRAIT_GDG_IRON_SOLDIERS','LOC_TRAIT_GDG_IRON_SOLDIERS_NAME','LOC_TRAIT_GDG_IRON_SOLDIERS_DESCRIPTION');

INSERT INTO TraitModifiers (TraitType,ModifierId) VALUES
('TRAIT_GDG_IRON_SOLDIERS','TRAIT_GDG_CIVILIZATION_HEAL'),
('TRAIT_GDG_IRON_SOLDIERS','TRAIT_GDG_IRON_CRUSADE'),
('TRAIT_GDG_IRON_SOLDIERS','TRAIT_GDG_DAMAGED_WOUNDED');

INSERT INTO LeaderTraits (LeaderType,TraitType) VALUES
('LEADER_HOJO','TRAIT_GDG_IRON_SOLDIERS');
 
Top Bottom