Quick Modding Questions Thread

  1. So far as I recall no one has been able to get a negative plot yield to be implemented by the game when the 'Name' value in a ModifierArguments row is 'YieldType'. As a general rule negative values tend to be ignored by the game by most ModifierTypes.
  2. This part is not correct at all
    Code:
    INSERT INTO ModifierArguments (ModifierId, Name, Type, Value, Extra, SecondExtra) VALUES
    ('IMPROVEMENT_MINE_MODIFIER_JJ', 'Amount', 'YIELD_FOOD', '-1', NULL, NULL);
    Column 'Type' is not used in that way. Only the following can be provided for that column
    Code:
    ARGTYPE_IDENTITY
    LinearScaleFromDefaultHandicap
    ScaleByGameSpeed
    • The last two are only ever to be used to create scaling effects for the human player's chosen difficulty-level and game-speed. All other usages must use 'ARGTYPE_IDENTITY'.
    • Since the default value for column 'Type' in table 'ModifierArguments' is 'ARGTYPE_IDENTITY' you never need to state a value for column 'Type' unless you are reconfiguring the way game-speeds (Marathon, Quick, etc.) work or player difficulty levels (Prince, King, etc.).
    • It's better to just eliminate use of the column altogether.
    • It is also better to omit columns 'Extra' and 'SecondExtra' as greater than 99% of all Modifiers added to the game by mod-makers will never need them.
    • This may be contrary to what you might have seen on other threads but I don't advocate people adding unecessary columns to their code because it's just a lot of extra typing and prone to result in syntax errors.
    Two rows are needed in table ModifierArguments to specify a "yield change" to a plot or other game-element: one uses 'Amount' and the other 'YieldType' for the "Name" arguments:
    Code:
    INSERT INTO ModifierArguments	(ModifierId,				Name,		Value)
    VALUES				('IMPROVEMENT_MINE_MODIFIER_JJ',	'Amount',	'-1'),
    				('IMPROVEMENT_MINE_MODIFIER_JJ',	'YieldType',	'YIELD_FOOD');
    But as already mentioned the '-1' is likely not going to work as best as I can recall which modifier-types accept negative 'Amount' values.
  3. Eliminating additional un-needed columns from your SQL code elsewhere it is a little easier to see that this makes no logical sense:
    Code:
    INSERT INTO Requirements (RequirementId,			RequirementType)
    VALUES 			 ('REQUIRES_IMPROVEMENT_MINE_JJ',	'REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES');
    
    INSERT INTO RequirementArguments (RequirementId,			Name,		Value)
    VALUES				 ('REQUIRES_IMPROVEMENT_MINE_JJ',	'UnitType',	'IMPROVEMENT_MINE');
    • An ImprovementType is never going to be a 'UnitType' or vice versa.
    • Instead of 'UnitType' you need 'ImprovementType' in order for the logic to make sense. The given RequirementType is 'REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES' so the "Name" column in table "RequirementArguments" needs to be specifying 'ImprovementType'.
  4. 'MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD' is not logical either.
    Code:
    INSERT INTO TraitModifiers (TraitType, ModifierId)
    VALUES			   ('TRAIT_LEADER_MAJOR_CIV', 'IMPROVEMENT_MINE_MODIFIER_JJ');
    
    INSERT INTO Modifiers	(ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId)
    VALUES			('IMPROVEMENT_MINE_MODIFIER_JJ', 'MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD',	0, 1, 'PLAYER_IS_HUMAN', 'QUALIFIED_REQUIREMENTS_JJ');
    Table TraitModifiers attaches its modifiers at a player level, so you can't have the ModifierType be a city-level modifier.
    • The problem with 'MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD' is that the game would not be able to "parse" what to do with this modifier since no City is specified as the object to which the modifier should be attached.
    You would want a ModifierType of MODIFIER_PLAYER_ADJUST_PLOT_YIELD because this ModifierType is defined as
    ModifierType | CollectionType | EffectType
    MODIFIER_PLAYER_ADJUST_PLOT_YIELD | COLLECTION_PLAYER_PLOT_YIELDS | EFFECT_ADJUST_PLOT_YIELD
    So all of a player's plots are affected with the Yield Change when using this ModifierType .

    And it makes logical sense because the ModifierType is a player-level modifier rather than a city-level modifier.
 
  • Like
Reactions: cvb
Tell me about what VFX Asset is. Some units i've downloaded here comes not only with unit assets but also its FX asset. Unit animation demonstrations with Asset Editor shows functional FX assets but in real game it shows '!' instead. In order to bring this to work,
1. Do I need to create VFX.XLP with Asset Editor and ad this new FX asset into it and add VFX referrences in Art.XML?
2. If so. In addition do I still need to create VFX Artdef as well?
3. And what's the deal after that? what else has to be done before hitting 'cook' button in Asset Editor and 'Build' button in Modbuddy?
 
So uhhh, I do have a question, I'm working on my first mod, and I want to ask this so I created this account specifically for asking questions here lol

Ok so, for this mod, I want my civilization to be able to plant forests with the Mysticism civic. If I'm correct, by default, Builders get the ability to plant woods with the Conservation civic... well just for this unique civilization I want to change the civic for planting woods to Mysticism, and I am having a hard time figuring out how to do this, is it possible that anyone here might know the right codes on how to do that?

(I am using XML format by the way)
 
Last edited:
So uhhh, I do have a question, I'm working on my first mod, and I want to ask this so I created this account specifically for asking questions here lol

Ok so, for this mod, I want my civilization to be able to plant forests with the Mysticism civic. If I'm correct, by default, Builders get the ability to plant woods with the Conservation civic... well just for this unique civilization I want to change the civic for planting woods to Mysticism, and I am having a hard time figuring out how to do this, is it possible that anyone here might know the right codes on how to do that?
It’s the middle of the night here but I’ll give a quick answer that assumes you have some familiarity with how civ6’s xml is set up. If you aren't, consider reading this excellent modding guide by LeeS. I’ve made my own civ/leaders but I’ll need to refer back to them in the morning.

When you create the civilization’s unique ability, what happens is you define a new entry or entries in the table Traits. For example, you might peruse the base game files as see traits like "Trait_Civilization_Mother_Russia" or "Trait_District_Bath." These traits are then used as conditions in other areas. For example, there's a modifier that increases the yield of all tundra tiles, that is specifically conditioned on the player possessing the trait "Trait_Civilization_Mother_Russia." Likewise, a city can only build a Bath district or train a Legion unit with the necessary trait.

These traits are linked to the civilizations themselves through a table called CivilizationTraits. This table simply has a bunch of rows saying "Civilization XYZ has trait ABC."

So in your instance, once you define your civilization's traits you can use them to grant this ability to plant at mysticism. Then you need to find out how builders acquire this normally. I actually don't know what controls builder actions off the top of my head. But if it is some kind of modifier, you would create your new modifier that lets builders do this with the requirement set that the player both has mysticism and has the trait. (Refer to LeeS' guide on what that means if you are unsure, its a quick read and very informative.)

That's the 1000 foot view of this. Hopefully by morning someone who knows more about builder actions will be able to chime in on how those work behind the scenes.
 
Whow! Thank YOU very much!!! You not only show the errors and help to understand why they are errors. Your in-depth explanations are so valueable for beginning modders FAR beyond wanting to solve some errors in a specific application example. They are VERY interesting quite general: could be part of a documentation we never will get. Thanks again!

So now 'reducing the Food yield of all mined plots by 1 for the human player' looks like this:
Code:
INSERT INTO TraitModifiers (TraitType, ModifierId)
VALUES ('TRAIT_LEADER_MAJOR_CIV', 'IMPROVEMENT_MINE_MODIFIER_JJ');

INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId)
VALUES ('IMPROVEMENT_MINE_MODIFIER_JJ', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 0, 1, 'PLAYER_IS_HUMAN', 'QUALIFIED_REQUIREMENTS_JJ');

INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('IMPROVEMENT_MINE_MODIFIER_JJ', 'Amount', '-1'),
       ('IMPROVEMENT_MINE_MODIFIER_JJ', 'YieldType', 'YIELD_FOOD');

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType)
VALUES ('QUALIFIED_REQUIREMENTS_JJ', 'REQUIREMENTSET_TEST_ANY');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId)
VALUES ('QUALIFIED_REQUIREMENTS_JJ', 'REQUIRES_IMPROVEMENT_MINE_JJ');

INSERT INTO Requirements (RequirementId, RequirementType)
VALUES ('REQUIRES_IMPROVEMENT_MINE_JJ', 'REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES');

INSERT INTO RequirementArguments (RequirementId, Name, Value)
VALUES ('REQUIRES_IMPROVEMENT_MINE_JJ', 'ImprovementType', 'IMPROVEMENT_MINE');
Originally I wanted to nerve only the resourceless mines, but think now, it is ok also for the Strategic & Luxury ones. Just the Bonus one (COPPER) is too bad, so I'd like to boost that a bit:
Code:
INSERT INTO Improvement_ResourceYieldChanges (ImprovementType, ResourceType, YieldType, YieldChange)
VALUES ('IMPROVEMENT_MINE', 'RESOURCE_COPPER', 'YIELD_FAITH', 1);



Now the potential fatal problem:
So far as I recall no one has been able to get a negative plot yield to be implemented by the game when the 'Name' value in a ModifierArguments row is 'YieldType'. As a general rule negative values tend to be ignored by the game by most ModifierTypes. [...]

INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('IMPROVEMENT_MINE_MODIFIER_JJ', 'Amount', '-1'),
('IMPROVEMENT_MINE_MODIFIER_JJ', 'YieldType', 'YIELD_FOOD');

[...] But as already mentioned the '-1' is likely not going to work as best as I can recall which modifier-types accept negative 'Amount' values.
I looked into some mods and found, that @Knasp's
Agricultural Revolution Expanded (AREX) 2.8.5
contains in the file /Data/AREX_World.sql @ line 1445 a similar construct (as part of a ImprovementModifiers):
Code:
INSERT OR REPLACE INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('MINE_WOODS_PROD_PENALTY', 'Amount', -1),                 
       ('MINE_WOODS_PROD_PENALTY', 'YieldType', 'YIELD_PRODUCTION');
Provided this works, would it make a difference whether it is part of a ImprovementModifiers or part of a TraitModifiers?

.
 
Was pPlayer:GetAI_Diplomacy():GetDiplomaticState(iPlayerID) in the GamePlay context nuked at some point? Having the worst time getting it working.
If it isn't available, is there something close I can swap out for?
 
Provided this works, would it make a difference whether it is part of a ImprovementModifiers or part of a TraitModifiers?
Generally it is the EffectType that matters rather than the source table from which the modifier is applied to a game object. ModifierTypes that create a plot yield change will generally use one of two or three EffectTypes each of which is some kind of Adjust Plot Yield effect, regardless of whether the ModifierId is attached in TraitModifiers or BeliefModifiers or ImprovementModifiers.

The same would be true for a ModifierType that adjusts city housing: those are all going to use one of a handful of EffectTypes that change or adjust housing, regardless of the table used to attach the modifier.

The differences are generally in that a ModifierId attached via table ImprovementModifiers is going to be applied regardless of which player completes the improvement, whereas a TraitModifier that alters the yields of a plot when that plot has IMPROVEMENT_X is only going to be applied to those players who are assigned that Trait in either LeaderTraits or CivilizationTraits.
 
  • Like
Reactions: cvb
Are you getting errors for "function expected instead of nil" or are you just getting bizarre data from the querry ?
The function expected instead of nil, yes. Trying from Combat event, if that may have some impact? In Firetuner, only the Diplomacy tab's settings seem to allow it.
 
It’s the middle of the night here but I’ll give a quick answer that assumes you have some familiarity with how civ6’s xml is set up. If you aren't, consider reading this excellent modding guide by LeeS. I’ve made my own civ/leaders but I’ll need to refer back to them in the morning.

When you create the civilization’s unique ability, what happens is you define a new entry or entries in the table Traits. For example, you might peruse the base game files as see traits like "Trait_Civilization_Mother_Russia" or "Trait_District_Bath." These traits are then used as conditions in other areas. For example, there's a modifier that increases the yield of all tundra tiles, that is specifically conditioned on the player possessing the trait "Trait_Civilization_Mother_Russia." Likewise, a city can only build a Bath district or train a Legion unit with the necessary trait.

These traits are linked to the civilizations themselves through a table called CivilizationTraits. This table simply has a bunch of rows saying "Civilization XYZ has trait ABC."

So in your instance, once you define your civilization's traits you can use them to grant this ability to plant at mysticism. Then you need to find out how builders acquire this normally. I actually don't know what controls builder actions off the top of my head. But if it is some kind of modifier, you would create your new modifier that lets builders do this with the requirement set that the player both has mysticism and has the trait. (Refer to LeeS' guide on what that means if you are unsure, its a quick read and very informative.)

That's the 1000 foot view of this. Hopefully by morning someone who knows more about builder actions will be able to chime in on how those work behind the scenes.

Hi, thanks for the reply Sostratus, it was quite helpful! And thank you for the guide too!

So first off, I'd like to point out that I already had a knowledge of how modifiers work, especially in the cases of civilization traits and unit abilities, though with regards to requirements, I am still working my way though that, but I'll figure it out.

And as for your examples, they made me search up on the code of the Roman Legion and its ability to build forts, and something struck me into realization as I looked through the code: It's probably impossible to change the starting civic for these type of improvements for only one civilization without changing the entire game. But for a situation like this in particular, two unique improvements come to mind: The Romans' Roman Fort and the Inca's Qhapaq Ñan. What do these two improvements have in common? Both improvements are basically identical to the normal Fort and Mountain Tunnels, but they are built significantly earlier than the eras that unlock their normal counterparts. Plus, when I looked at their codes, they are listed as separate improvements, yet all their functions except are exactly identical in-game.

Normal Fort = IMPROVEMENT_FORT (Built by Military Engineers which requires the Military Engineering tech)
Roman Fort = IMPROVEMENT_ROMAN_FORT (Built by the Roman Legion which requires the Iron Working tech)
Mountain Tunnel = IMPROVEMENT_MOUNTAIN_TUNNEL (Built by a Military Engineer and requires the Chemistry tech)
Qhapaq Ñan = IMPROVEMENT_MOUNTAIN_ROAD (Built by a Builder of the Incas which requires the Foreign Trade civic)

So here's my idea: I think I will try creating a duplicate of the Woods feature, with the same exact features, the only difference being that these woods can be planted at Mysticism, and they can only be planted by the civilization I'm working on (If woods is listed as "FEATURE_FOREST", then the codename for this copy for woods would be "FEATURE_[CIVILIZATIONNAME]_FOREST" or something like that, and put it in the Civilization traits section or something so only this specific civ can use this feature)

I imagine if this works the way I figure it out to be, then these unique woods after being planted should also stay around even if the city they were planted by gets razed.....

Well, I'm gonna try out this experiment... and put as many modifiers and changes needed to make this work hopefully... well once again, thanks for your help!
 
Last edited:
So would this 'negative plot yield'-ignorance
So far as I recall no one has been able to get a negative plot yield to be implemented by the game when the 'Name' value in a ModifierArguments row is 'YieldType'. As a general rule negative values tend to be ignored by the game by most ModifierTypes.
also apply, even if formal no "ModifierId, ModifierType, ModifierArguments ..." are involved?

As in:
Code:
INSERT INTO Improvement_YieldChanges (ImprovementType, YieldType, YieldChange)
VALUES ('IMPROVEMENT_MINE', 'YIELD_FOOD', -1);

---

One could try to apply this requirement-free variant above together with
Code:
[...]
INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId)
VALUES ('IMPROVEMENT_MINE_MODIFIER_JJ', 'MODIFIER_PLAYER_ADJUST_PLOT_YIELD', 0, 1, 'PLAYER_IS_AI', 'QUALIFIED_REQUIREMENTS_JJ');

INSERT INTO ModifierArguments (ModifierId, Name, Value)
VALUES ('IMPROVEMENT_MINE_MODIFIER_JJ', 'Amount', '1'),
       ('IMPROVEMENT_MINE_MODIFIER_JJ', 'YieldType', 'YIELD_FOOD');
[...]
a positive plot yield attached for YIELD_FOOD only applied to AIplayers. (and so applying only the -1 to the human)

.
 
So here's my idea: I think I will try creating a duplicate of the Woods feature, with the same exact features, the only difference being that these woods can be planted at Mysticism, and they can only be planted by the civilization I'm working on (If woods is listed as "FEATURE_FOREST", then the codename for this copy for woods would be "FEATURE_[CIVILIZATIONNAME]_FOREST" or something like that, and put it in the Civilization traits section or something so only this specific civ can use this!
For extra accuracy, woods that have been replanted are never “old growth” like they get labeled at conservation- you can’t get production from chopping replanted woods.

I’ve never looked at features to see how they come up with that distinction, but it’s something to keep in mind for your civ, especially because being able to chop planted woods would be like the most OP ability ever :lol:
 
Hi, thanks for the reply Sostratus, it was quite helpful! !
One other thing. If you read the section in the guide I linked on requirement sets, you can nest them; that is, you can make an element of a requirement set another requirement set.
Since Req Sets can be specified to be “all must be true” or “any must be true,” you can mix this to create any Boolean logic you need. I haven’t done the same digging as you but if you see a modifier with requirements that you want to coopt, you can always just modify Req Set X to be
NewReqSet = Any(X, MyCiv’s Case)
Where your Civ’s case just needs to make sure it triggers on your civ trait/being your civ.
 
I'm struggling to modify a building so that it adds yields (PRODUCTION) to a feature (FOREST) without any improvement. FYI, I am just trying to add this to another mod I am using, not making a new mod/building.
I tried copying how a lighthouse is done in the base game, but the game will not load when I have these added to the mod's building file. I seem to be missing something...

Code:
        <Row>
            <ModifierId>CARPENTER_FOREST_PRODUCTION</ModifierId>
            <ModifierType>MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD</ModifierType>
            <SubjectRequirementSetId>PLOT_HAS_FOREST_REQUIREMENTS</SubjectRequirementSetId>
        </Row>
        <Row>
            <ModifierId>CARPENTER_FOREST_PRODUCTION</ModifierId>
            <Name>YieldType</Name>
            <Value>YIELD_PRODUCTION</Value>
        </Row>
        <Row>
            <ModifierId>CARPENTER_FOREST_PRODUCTION</ModifierId>
            <Name>Amount</Name>
            <Value>1</Value>
        </Row>
        <Row>
            <BuildingType>BUILDING_CARPENTER</BuildingType>
            <ModifierId>CARPENTER_FOREST_PRODUCTION</ModifierId>
        </Row>
        <Row>
            <RequirementId>REQUIRES_PLOT_HAS_FOREST</RequirementId>
            <RequirementType>REQUIREMENT_PLOT_FEATURE_TYPE_MATCHES</RequirementType>
        </Row>
        <Row>
            <RequirementId>REQUIRES_PLOT_HAS_FOREST</RequirementId>
            <Name>FeatureType</Name>
            <Value>FEATURE_FOREST</Value>
        </Row>
        <Row>
            <RequirementSetId>PLOT_HAS_FOREST_REQUIREMENTS</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
        </Row>
        <Row>
            <RequirementSetId>PLOT_HAS_FOREST_REQUIREMENTS</RequirementSetId>
            <RequirementId>REQUIRES_PLOT_HAS_FOREST</RequirementId>
        </Row>
 
I'm struggling to modify a building so that it adds yields (PRODUCTION) to a feature (FOREST) without any improvement. FYI, I am just trying to add this to another mod I am using, not making a new mod/building.
I tried copying how a lighthouse is done in the base game, but the game will not load when I have these added to the mod's building file. I seem to be missing something...
When you try loading the game and it fails, check Documents/My Games/Sid Meier's Civilization VI/Logs/Database.log.
You'll see something like "error - unique constraint failed
In XML serializer while inserting row into Table kjdbgvkjkab..."
Or something along those lines.
I recommend closing the game, then on startup, turning off all mods except the offender and try to load a game. Then check the log. (The log resets every time you restart the Civ application, and this particular file will add more stuff each time you load a game.) Some errors don't matter/keep the game from functioning, hence I suggest turning off other mods to just look for what issues this mod is causing. You'll almost certainly see a reference to something in this code chunk, and you'll know where to look to fix it. Sometimes it's as simple as forgetting to define something as a type elsewhere.
 
When you try loading the game and it fails, check Documents/My Games/Sid Meier's Civilization VI/Logs/Database.log.
Thanks for that tip, TIL. Removed all other mods and started fresh.
The errors didn't make a ton of sense, but it forced me to look carefully at all the entries... and I found a duplicate entry. d'oh.
Removed that and everything works! THANKS!
 
In the context of less food from mined hills I found also a similar mod from FearSunn, 'Mines No Food', but this is available only on steam and so I wasn't able to get a look into its code, which certainly would have been interesting ...

Right now I intent to make just the base definitions with a new ResourceType in SQL:
Code:
INSERT INTO Types (Type, Kind)
VALUES ('RESOURCE_MACERATE_MINE', 'KIND_RESOURCE');

INSERT INTO Resources (ResourceType, Name, ResourceClassType, LakeEligible)
VALUES ('RESOURCE_MACERATE_MINE', 'LOC_RESOURCE_MACERATE_MINE_NAME', 'RESOURCECLASS_BONUS', 0);

INSERT INTO Resource_ValidTerrains SELECT 'RESOURCE_MACERATE_MINE', TerrainType FROM Terrains
WHERE TerrainType IN ('TERRAIN_GRASS_HILLS', 'TERRAIN_PLAINS_HILLS');

INSERT INTO Resource_ValidFeatures SELECT 'RESOURCE_MACERATE_MINE', FeatureType FROM Features
WHERE Impassable = 0 AND Lake = 0;

INSERT INTO Resource_YieldChanges (ResourceType, YieldType, YieldChange)
VALUES ('RESOURCE_MACERATE_MINE', 'YIELD_FOOD', -1);

INSERT INTO Resource_Harvests (ResourceType, YieldType, Amount, PrereqTech)
VALUES ('RESOURCE_MACERATE_MINE', 'YIELD_PRODUCTION', 3, 'TECH_MINING');
and the applying to the Mine improvement of the pPlayer:IsHuman() in Lua GameplayScripts context:
Code:
Events.ImprovementAddedToMap(iX, iY, eImprovement, playerID)
->ResourceBuilder.SetResourceType(pPlot, ResourceType, Qty)

Events.ImprovementRemovedFromMap(iX, iY, eOwner)
->ResourceBuilder.SetResourceType(pPlot, -1)
 
In the context of less food from mined hills I found also a similar mod from FearSunn, 'Mines No Food', but this is available only on steam and so I wasn't able to get a look into its code, which certainly would have been interesting ...

You can look at the code of mods on Steam if you subscribe to them. The mod's files will be downloaded to your computer. I am not at home right now so I can't give an example path but you can probably look it up. It will be put in a directory that has the mod's ID number, so if you are subscribed to multiple mods you will want to check what that number is. For example, for FearSunn's mod the URL is: https://steamcommunity.com/sharedfiles/filedetails/?id=1442435045 so the files for that mod will be in a directory with the name 1442435045.

I didn't follow all your past posts. If you are still trying to reduce food yield of mines for human players then the way you are doing it seems much more complicated than needed. I don't see why any Lua would be needed or the creation of a new resource. Seems like you were close in your previous post.
 
From a quick skim of one of the game's lua User Interface files. [...] City:GetCulturalIdentity() is only valid in a User Interface context [...]
The City:ChangeLoyalty(iChgangeAmount) method is indeed what would be needed to alter a city's current Loyalty value. [...] But it can only be used in a GamePlayScript.
I have seen mentioned that data can be sent between the UI and GamePlayScript contexts. In this case, is that the sort of thing I should look into?
Yes, search in 'Civ6 - Creation & Customization' for "ExposedMembers.".
If you are still trying to reduce food yield of mines for human players then the way you are doing it seems much more complicated than needed. I don't see why any Lua would be needed or the creation of a new resource.
Well, I mentioned in the Lua part only the significant pivots, because I can do that with ease. Obviously I'm struggling with SQL (which I just started).
"much more complicated than needed" - yes, I suspected that; can I leave out the statements concerning Resource_ValidTerrains, Resource_ValidFeatures & Resource_Harvests, if that is not needed or handled in the Lua code? So the ResourceType definition is:
Code:
INSERT INTO Types (Type, Kind)
VALUES ('RESOURCE_MACERATE_MINE', 'KIND_RESOURCE');

INSERT INTO Resources (ResourceType, Name, ResourceClassType)
VALUES ('RESOURCE_MACERATE_MINE', 'LOC_RESOURCE_MACERATE_MINE_NAME', 'RESOURCECLASS_BONUS');

INSERT INTO Resource_YieldChanges (ResourceType, YieldType, YieldChange)
VALUES ('RESOURCE_MACERATE_MINE', 'YIELD_FOOD', -1);
Would that work?
Seems like you were close in your previous post.
I learn a lot from such general discussions and suppose many others do - and think, it is worth doing it for that alone. But to solve a specific task "being close" won't help, so I escaped to Lua.

Still, I'm interested how a (working) pure SQL solution looks like.
You can look at the code of mods on Steam if you subscribe to them. [...] FearSunn's mod the URL is: https://steamcommunity.com/sharedfiles/filedetails/?id=1442435045 so the files for that mod will be in a directory with the name 1442435045.
civ4! 2005 I played several months vanilla. Great game!!! Had to pause. Bought in 2010 the two expansions and did a lot of modding. Excellent experience. Thought later, that was the perfect timing.
Came back 2016, decided to start playing & modding civ6 when it is ready ... wouldn't be more than 3 years ... :lol::lol: Also didn't think, that I'll be in a situation nobody expects / understands. :sad:

In short: I don't have the game yet and can't subscribe & download.

I don't think, it would be a problem of any kind, if a customer's mod to which millions have access would be downloaded (to C:\Program Files (x86)\Steam\steamapps\workshop\content\289070\1442435045) and several relevant statements of the SQL or XML file copied into a post on another appropriate site's forum while giving FearSunn all the due high regard for creating a (probably first) working solution.


Yeah, it seems weird to be interested in modding a game one doesn't play (yet). :D Soon™.
But I think, it is ok for an average CivFanatic :p

.
 
Last edited:
civ4! 2005 I played several months vanilla. Great game!!! Had to pause. Bought in 2010 the two expansions and did a lot of modding. Excellent experience. Thought later, that was the perfect timing.
Came back 2016, decided to start playing & modding civ6 when it is ready ... wouldn't be more than 3 years ... :lol::lol: Also didn't think, that I'll be in a situation nobody expects / understands. :sad:

In short: I don't have the game yet and can't subscribe & download.

I loved Civ4 too! It got me started into modding for a little while. Then I got busy with other things in life and just started modding again recently with Civ6. Also I never got into Civ5 as much as 4 so didn't really feel like modding that game. I will send you some code examples in a message later from the mods on the Steam workshop similar to what you are doing.
 
  • Like
Reactions: cvb
Top Bottom