[GS] Help with Unique Ability

Lord Shadow

General
Joined
Oct 14, 2005
Messages
2,005
Location
Buenos Aires
Hey, guys!

I've spent most of the day working on reshaping Hungary into an entirely different civ, making slow progress.

However, I got ambitious with the unique ability of the civ, and I'm a bit stumped now. I want it to do the following:
  • +1 Production from Rainforest tiles.
  • Rainforest tiles give +1 Appeal instead of -1.*
  • Lumber Mills can be built on Rainforest tiles as soon as they're available.
  • Solar Farms, Wind Farms and Offshore Wind Farms produce +1 Power.
It seems simple, but it really gave me a headache when I tried to follow tutorial videos about creating traits and all the interlocking moving parts. Even though I've been sifting through this sheet, I'm a bit at a loss as to which effects to use and how.

Help would be appreciated.

*This is part of Brazil's UA. Perhaps I could just reference it or something.
 
+1 Production from Rainforest tiles.
This ought to work for the Rainforest extra production:
Code:
<GameData>
	<Types>
		<Row Type="TRAIT_JUNGLE_INCREASED_PRODUCTION" Kind="KIND_TRAIT"/>
	</Types>
	<Traits>
		<Row TraitType="TRAIT_JUNGLE_INCREASED_PRODUCTION" Name="Rainforest Production" Description="Rainforests +1 [ICON_Production] Production"/>
	</Traits>
	<Modifiers>
		<Row>
			<ModifierId>MODIFIER_JUNGLE_INCREASED_PRODUCTION</ModifierId>
			<ModifierType>MODIFIER_PLAYER_ADJUST_PLOT_YIELD</ModifierType>
			<SubjectRequirementSetId>PLOT_HAS_JUNGLE_REQUIRMEMENT_SET</SubjectRequirementSetId>
		</Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>MODIFIER_JUNGLE_INCREASED_PRODUCTION</ModifierId>
			<Name>YieldType</Name>
			<Value>YIELD_PRODUCTION</Value>
		</Row>
		<Row>
			<ModifierId>MODIFIER_JUNGLE_INCREASED_PRODUCTION</ModifierId>
			<Name>Amount</Name>
			<Value>1</Value>
		</Row>
	</ModifierArguments>
	<Requirements>
		<Row>
			<RequirementId>PLOT_HAS_A_JUNGLE_REQUIREMENT</RequirementId>
			<RequirementType>REQUIREMENT_PLOT_FEATURE_TYPE_MATCHES</RequirementType>
		</Row>
	</Requirements>
	<RequirementArguments>
		<Row>
			<RequirementId>PLOT_HAS_A_JUNGLE_REQUIREMENT</RequirementId>
			<Name>FeatureType</Name>
			<Value>FEATURE_JUNGLE</Value>
		</Row>
	</RequirementArguments>
	<RequirementSets>
		<Row>
			<RequirementSetId>PLOT_HAS_JUNGLE_REQUIRMEMENT_SET</RequirementSetId>
			<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
		</Row>
	</RequirementSets>
	<RequirementSetRequirements>
		<Row>
			<RequirementSetId>PLOT_HAS_JUNGLE_REQUIRMEMENT_SET</RequirementSetId>
			<RequirementId>PLOT_HAS_A_JUNGLE_REQUIREMENT</RequirementId>
		</Row>
	</RequirementSetRequirements>
	<TraitModifiers>
		<Row TraitType="TRAIT_JUNGLE_INCREASED_PRODUCTION" ModifierId="MODIFIER_JUNGLE_INCREASED_PRODUCTION"/>
	</TraitModifiers>
	<CivilizationTraits>
		<Row CivilizationType="CIVILIZATION_X" TraitType="TRAIT_JUNGLE_INCREASED_PRODUCTION"/>
	</CivilizationTraits>
</GameData>
Assuming you want it as a Civilization ability. You will need to edit "CIVILIZATION_X" to the correct Civilization Tag-Name.

I haven't really looked into the set-up needed for any of the other stuff tho as I recall adjusting individual plot appeal is not going to be easy as I don't recall there being a direct "ADJUST_PLOT_APPEAL" type of Modifier or Game Effect.
 
Haven't tested it yet, but this is my approach. PLOT_HAS_JUNGLE_REQUIREMENTS already exists in the game, so there was no need to recreate the requirement.
Code:
INSERT INTO    TraitModifiers  
        (TraitType,                                ModifierId                                        )
VALUES    ('TRAIT_CIVILIZATION_EMERALD_PARADISE',    'MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION'    );

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES    ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',        'MODTYPE_WINGARDE_UA_JUNGLE_PRODUCTION',            NULL,        'PLOT_HAS_JUNGLE_REQUIREMENTS',            0,            0            );

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                    )
VALUES    ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',            'YieldType',                    'YIELD_PRODUCTION'                        ),
        ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',            'Amount',                        1                                        );
As far as the extra Appeal is concerned, I'm confident I've been able to reference Brazil's bit correctly, TRAIT_AMAZON_RAINFOREST_EXTRA_APPEAL.

Both the Lumber Mill thing and clean energy farm bonuses are tricky. On the one hand, I can't seem to find a way to clear Rainforests for Lumber Mill building through modifiers like the civic (Mercantilism?) does to enable it in the Renaissance Era. On the other, power production, at least through improvements, is not quite a yield but a modifier itself. So I'd have to figure out how to add another modifier to said improvements, and whether that'd require another requirement.

There might be other ways, but it's weird. As far as I've gathered, for example, yield bonuses to improvements aren't quite given to the improvements themselves, but rather to the plot when said plot contains the improvement in question, heh.
 
I don't see where you've defined 'MODTYPE_WINGARDE_UA_JUNGLE_PRODUCTION'. That's not a standard ModifierType pre-defined in table DynamicModifiers so you would have to define it. There shouldn't really be a need to create a custom dynamic modifier, though, since MODIFIER_PLAYER_ADJUST_PLOT_YIELD is a GS Basegame pre-defined ModifierType and ought to do the job you are looking for. It's collection-type is player plots, so will cover all the plots the player owns.

I missed the TRAIT_AMAZON_RAINFOREST_EXTRA_APPEAL effects because I was looking through the database for direct plot-adjustments whereas the Brazil thing is done by going through the player's cities rather than directly to the player's plots.
 
Last edited:
I don't see where you've defined 'MODTYPE_WINGARDE_UA_JUNGLE_PRODUCTION'. That's not a standard ModifierType pre-defined in table DynamicModifiers so you would have to define it. There shouldn't really be a need to create a custom dynamic modifier, though, since MODIFIER_PLAYER_ADJUST_PLOT_YIELD is a GS Basegame pre-defined ModifierType and ought to do the job you are looking for. It's collection-type is player plots, so will cover all the plots the player owns.
Yeah, you might be right about that. As a baseline, I'm following Keniisu's template, and he created unique MODTYPEs for every trait bonus.

As for the power bonus to Solar/Wind Farms, I managed to create analogues of the base modifiers which produce their intrinsic power, but by applying this new modifier to the improvements themselves after creating them (in the ImprovementModifiers table), I don't think I'm limiting the effect to my civ. There must be some requirement I can use to restrict the bonus modifier to the improvements within my civ's territory.

As for the early jungle Lumber Mill (as of Construction), I'm still rather stuck. At first I thought I could draw from Canada's ability to build Farms on Tundra, but Tundra is terrain and Rainforest is a feature. An unfortunate difference.

Reviewing the wiki, I may check how Spain can produce Fleets and Armadas through earlier techs, for instance. There's a number of civs which can do certain things earlier, which is the general concept I'm going for.
 
Code:
INSERT INTO    TraitModifiers
        (TraitType,                                ModifierId                                        )
VALUES    ('TRAIT_CIVILIZATION_EMERALD_PARADISE',    'MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION'    );

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES    ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',        'MODTYPE_WINGARDE_UA_JUNGLE_PRODUCTION',            NULL,        'PLOT_HAS_JUNGLE_REQUIREMENTS',            0,            0            );

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                    )
VALUES    ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',            'YieldType',                    'YIELD_PRODUCTION'                        ),
        ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION',            'Amount',                        1                                        );

Your entry into the ModifierArguments table is slightly wrong.
('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION', 'Amount', 1 ) should be ('MODIFIER_WINGARDE_UA_JUNGLE_PRODUCTION', 'Amount', '1' )

Keep in mind that whenever using SQL, if you're entering an integer value it must be in single quotation marks. Only null and boolean values are not kept in single quotations.
 
Integer values entered into columns defined as integers never need text-delimiters. It is better to add the text-delimiters for columns defined as text even when the argument-value being provided is to be used as an integer, as in the case you noted. But in a case such as the following no text-delimiters are needed or really desired:
Code:
UPDATE Boosts SET Boost= 30 WHERE TechnologyType IS NOT NULL;
Column "Boost" in table "Boosts" is defined as being integer
Code:
"Boost" INTEGER NOT NULL,
therefore actual integer values (as opposed to text-strings) are better.

Column "Value" in tables ModifierArguments and RequirementArguments are defined as Text:
Code:
"Value" TEXT NOT NULL,
----------------------

The game and its database is fairly friendly with direct data entry via SQL statements, however: if it looks like a 1 it is generally treated as a 1 regardless of whether it was entered as a text-string or a direct integer. The issues only seem to arise when using text-strings with Boolean columns or when attempting to do mathematical operations within an SQL chunk wherein something like ColumnName = '2' + '2' is attempted.
 
Last edited:
Still stuck as far as finding a requirement to limit the Solar/Wind Farms power bonus to the Civ/territory owning the main trait.

This is what I have so far in that regard:
Code:
-----------------------------------------------
-- TraitModifiers
-----------------------------------------------

INSERT INTO    TraitModifiers  
        (TraitType,                                ModifierId                                        )
VALUES    ('TRAIT_CIVILIZATION_EMERALD_PARADISE',    'MODIFIER_WINGARDE_UA_SOLAR_FARM_BONUS'        ),
        ('TRAIT_CIVILIZATION_EMERALD_PARADISE',    'MODIFIER_WINGARDE_UA_LAND_WIND_FARM_BONUS'    ),
        ('TRAIT_CIVILIZATION_EMERALD_PARADISE',    'MODIFIER_WINGARDE_UA_SEA_WIND_FARM_BONUS'    );

-----------------------------------------------
-- Modifiers
-----------------------------------------------

INSERT INTO    Modifiers
        (ModifierId,                                        ModifierType,                                    OwnerRequirementSetId,                SubjectRequirementSetId,            RunOnce,    Permanent    )
VALUES    ('MODIFIER_WINGARDE_UA_SOLAR_FARM_BONUS',        'MODIFIER_SINGLE_CITY_ADJUST_FREE_POWER',            NULL,                            'REQSET_CVS_PLAYER_IS_WINGARDIAN',        0,            0            ), -- Req OK?
        ('MODIFIER_WINGARDE_UA_LAND_WIND_FARM_BONUS',    'MODIFIER_SINGLE_CITY_ADJUST_FREE_POWER',            NULL,                            'REQSET_CVS_PLAYER_IS_WINGARDIAN',        0,            0            ), -- Req OK?
        ('MODIFIER_WINGARDE_UA_SEA_WIND_FARM_BONUS',    'MODIFIER_SINGLE_CITY_ADJUST_FREE_POWER',            NULL,                            'REQSET_CVS_PLAYER_IS_WINGARDIAN',        0,            0            ); -- Req OK?

-----------------------------------------------
-- ModifierArguments
-----------------------------------------------

INSERT INTO    ModifierArguments
        (ModifierId,                                            Name,                            Value                                )
VALUES    ('MODIFIER_WINGARDE_UA_SOLAR_FARM_BONUS',            'SourceType',                    'FREE_POWER_SOURCE_SOLAR'                ),
        ('MODIFIER_WINGARDE_UA_SOLAR_FARM_BONUS',            'Amount',                        1                                        ),
        ('MODIFIER_WINGARDE_UA_LAND_WIND_FARM_BONUS',        'SourceType',                    'FREE_POWER_SOURCE_WIND'                ),
        ('MODIFIER_WINGARDE_UA_LAND_WIND_FARM_BONUS',        'Amount',                        1                                        ),
        ('MODIFIER_WINGARDE_UA_SEA_WIND_FARM_BONUS',        'SourceType',                    'FREE_POWER_SOURCE_WIND'                ),
        ('MODIFIER_WINGARDE_UA_SEA_WIND_FARM_BONUS',        'Amount',                        1                                        );

-----------------------------------------------
-- ImprovementModifiers
-----------------------------------------------

INSERT INTO    ImprovementModifiers
        (ImprovementType,                        ModifierId                                         )
VALUES    ('IMPROVEMENT_SOLAR_FARM',                'MODIFIER_WINGARDE_UA_SOLAR_FARM_BONUS'            ),
        ('IMPROVEMENT_WIND_FARM',                'MODIFIER_WINGARDE_UA_LAND_WIND_FARM_BONUS'        ),
        ('IMPROVEMENT_OFFSHORE_WIND_FARM',        'MODIFIER_WINGARDE_UA_SEA_WIND_FARM_BONUS'        );
The RequirementSet REQSET_CVS_PLAYER_IS_WINGARDIAN I got from Keniisu's template as well. It's set in the Civilization's file, but I'm not sure how it's actually doing what it's supposed to do (check if the Civ in question is Wingarde).

Here's how that's supposedly configured:
Code:
-----------------------------------------------
-- RequirementSets
-----------------------------------------------

INSERT INTO RequirementSets
        (RequirementSetId,                    RequirementSetType            )
VALUES    ('REQSET_CVS_PLAYER_IS_WINGARDIAN',    'REQUIREMENTSET_TEST_ALL'    ),
        ('REQSET_CVS_LEADER_IS_WINGARDIAN',    'REQUIREMENTSET_TEST_ANY'    );

-----------------------------------------------
-- RequirementSetRequirements
-----------------------------------------------

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                    RequirementId                    )
VALUES    ('REQSET_CVS_PLAYER_IS_WINGARDIAN',    'REQ_CVS_PLAYER_IS_WINGARDIAN'    );

-----------------------------------------------
-- Requirements
-----------------------------------------------

INSERT INTO Requirements
        (RequirementId,                    RequirementType                        )
VALUES    ('REQ_CVS_PLAYER_IS_WINGARDIAN',    'REQUIREMENT_REQUIREMENTSET_IS_MET'    );

-----------------------------------------------
-- RequirementArguments
-----------------------------------------------

INSERT INTO RequirementArguments
        (RequirementId,                    Name,                Value                            )
VALUES    ('REQ_CVS_PLAYER_IS_WINGARDIAN',    'RequirementSetId', 'REQSET_CVS_LEADER_IS_WINGARDIAN'    );


Same deal with the Lumber Mill: can't seem to find a way to allow them on Rainforest tiles ahead of the original Renaissance tech.
Reviewing the wiki, I may check how Spain can produce Fleets and Armadas through earlier techs, for instance. There's a number of civs which can do certain things earlier, which is the general concept I'm going for.
No joy with this. There appears to be a very precise effect which pushes Corps/Army production to an earlier point. There doesn't appear to be an analogue for improvements and valid features. :sad:

As for the integers, I'll keep the suggestion in mind in case I run into problems.
 
Hmm. Had an idea and need some confirmation.

This is the bit which allows the construction of Lumber Mills in jungles. It appears to be XML-only and can't be made part of traits/modifiers/effects/requirements.
Code:
<Improvement_ValidFeatures>
        <Row ImprovementType="IMPROVEMENT_LUMBER_MILL" FeatureType="FEATURE_JUNGLE" PrereqCivic="CIVIC_MERCANTILISM"/>
    </Improvement_ValidFeatures>
So my idea involves some exotic civic/technology modding, adding a specific civic/tech, ideally disconnected from the tree and invisible from the Civilopedia and UI in general. I'd add a row to the aforementioned table to do the exact same thing as Mercantilism, and through a modifier freely grant this flag-like civic/tech to this custom civ once Construction's researched and Lumber Mills are unlocked.

How viable is this? Or is it doomed from the start since I'd need Mercantilism anyway to meet the full requirement to build jungle mills?
 
Top Bottom