Hello, I am new to modding Civ. I would like to enable the ability to plant jungle for my personalized civ.
I tried using the modifier MODIFIER_PLAYER_ADJUST_FEATURE_UNLOCK, similar to the one used by Vietnam to enable its builders to plant forests. It works if you want to redefine a modifier to enable planting forests before Conservation (I included the corresponding code at the end).
I noticed that forests have the attribute "AddCivic" in Features.xml with the value "CIVIC_CONSERVATION". So, I chose a civic for jungle in the same way, but it does not work either.
I found that there is a UnitOperations linked to planting forests, so I created a UnitOperations based on that and also created the corresponding UnitOperations.artdef. It is supposed to be the same with FOREST resplace by JUNGLE even if I used the Asset Editor. However, this approach did not give satisfaction.
Does anyone have an idea about how to proceed?
I tried using the modifier MODIFIER_PLAYER_ADJUST_FEATURE_UNLOCK, similar to the one used by Vietnam to enable its builders to plant forests. It works if you want to redefine a modifier to enable planting forests before Conservation (I included the corresponding code at the end).
I noticed that forests have the attribute "AddCivic" in Features.xml with the value "CIVIC_CONSERVATION". So, I chose a civic for jungle in the same way, but it does not work either.
I found that there is a UnitOperations linked to planting forests, so I created a UnitOperations based on that and also created the corresponding UnitOperations.artdef. It is supposed to be the same with FOREST resplace by JUNGLE even if I used the Asset Editor. However, this approach did not give satisfaction.
Does anyone have an idea about how to proceed?
Spoiler code :
SQL:
-- GameData1
-- Author: louis
-- DateCreated: 4/16/2024 9:35:32 PM
--------------------------------------------------------------
INSERT INTO Types
(Type, Kind )
VALUES ('TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS', 'KIND_TRAIT' ),
('UNITOPERATION_MTGLL_PLANT_JUNGLE', 'KIND_UNITOPERATION' );
INSERT INTO Traits
(TraitType, Name, Description )
VALUES ('TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS', 'LOC_TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS_NAME', 'LOC_TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS_DESCRIPTION' );
INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_MTGLL_MONO_GREEN', 'TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS' );
INSERT INTO UnitOperations
(OperationType, VisibleInUI, HoldCycling, CategoryInUI, Icon, Description )
VALUES ('UNITOPERATION_MTGLL_PLANT_JUNGLE', 1, 1, 'BUILD', 'ICON_UNITOPERATION_PLANT_FOREST', 'LOC_UNITOPERATION_MTGLL_PLANT_JUNGLE_DESCRIPTION' );
INSERT INTO TraitModifiers
(TraitType, ModifierId )
VALUES ('TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS', 'MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_JUNGLE_MEDIEVAL_FAIRES' );
INSERT INTO Modifiers
(ModifierId, ModifierType )
VALUES ('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_JUNGLE_MEDIEVAL_FAIRES', 'MODIFIER_PLAYER_ADJUST_FEATURE_UNLOCK' );
INSERT INTO ModifierArguments
(ModifierId, Name, Value )
VALUES ('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_JUNGLE_MEDIEVAL_FAIRES', 'FeatureType', 'FEATURE_JUNGLE' ),
('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_JUNGLE_MEDIEVAL_FAIRES', 'CivicType', 'CIVIC_MEDIEVAL_FAIRES' );
UPDATE Features SET AddCivic='CIVIC_MEDIEVAL_FAIRES' WHERE FeatureType='FEATURE_JUNGLE';
INSERT INTO TraitModifiers
(TraitType, ModifierId )
VALUES ('TRAIT_CIVILIZATION_MTGLL_ANCESTRAL_FORESTS', 'MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_FOREST_MEDIEVAL_FAIRES' );
INSERT INTO Modifiers
(ModifierId, ModifierType )
VALUES ('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_FOREST_MEDIEVAL_FAIRES', 'MODIFIER_PLAYER_ADJUST_FEATURE_UNLOCK' );
INSERT INTO ModifierArguments
(ModifierId, Name, Value )
VALUES ('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_FOREST_MEDIEVAL_FAIRES', 'FeatureType', 'FEATURE_FOREST' ),
('MODIFIER_MTGLL_ANCESTRAL_FORESTS_PLANT_FOREST_MEDIEVAL_FAIRES', 'CivicType', 'CIVIC_MEDIEVAL_FAIRES' );
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<AssetObjects..ArtDefSet>
<m_Version>
<major>1</major>
<minor>0</minor>
<build>0</build>
<revision>0</revision>
</m_Version>
<m_TemplateName text="UnitOperations"/>
<m_RootCollections>
<Element>
<m_CollectionName text="UnitOperation"/>
<m_ReplaceMergedCollectionElements>false</m_ReplaceMergedCollectionElements>
<Element>
<m_Fields>
<m_Values>
<Element class="AssetObjects..StringValue">
<m_Value text="PLANT_JUNGLE"/>
<m_ParamName text="Activity"/>
</Element>
<Element class="AssetObjects..StringValue">
<m_Value text=""/>
<m_ParamName text="TargetType"/>
</Element>
<Element class="AssetObjects..StringValue">
<m_Value text="ACTIVITY_DIG"/>
<m_ParamName text="DefaultTargetActivity"/>
</Element>
</m_Values>
</m_Fields>
<m_ChildCollections/>
<m_Name text="UNITOPERATION_MTGLL_PLANT_JUNGLE"/>
<m_AppendMergedParameterCollections>false</m_AppendMergedParameterCollections>
</Element>
</Element>
</m_RootCollections>
</AssetObjects..ArtDefSet>