Existing Mod, New Problems

GuiSKJ

Chieftain
Joined
May 26, 2020
Messages
32
I have a small balance mod that has been working like a charm for quite a while.

Last night, I came with the brilliant idea that Water Mills would be a lot more useful if they added Production rather than Food to farmable bonus resources.

So off I went and wrote the following:
code to update the Water Mill modifiers to add production rather than food
Code:
UPDATE ModifierArguments
    SET
        Value = 'YIELD_PRODUCTION'
    WHERE
        Name = 'YieldType'
        AND (
            ModifierId = 'WATERMILL_ADDRICEFOOD'
            OR ModifierId = 'WATERMILL_ADDWHEATYIELD'
            OR ModifierId = 'WATERMILL_ADDMAIZEYIELD'
        );

code to update the localized text for the Water Mill
Code:
UPDATE LocalizedText
    SET
        Text = 'Bonus resources improved by Farms gain +1 [ICON_Production] Production each. City must be adjacent to a River.'
    WHERE
        Language = 'en_US'
        AND Tag = 'LOC_BUILDING_WATER_MILL_DESCRIPTION';

And just for clarity, here is my mod setup
Code:
  <FrontEndActions>
    <UpdateText id="RunLocalization">
      <File>Core/Localization.sql</File>
    </UpdateText>
  </FrontEndActions>
  <InGameActions>
    <UpdateDatabase id="RunCode">
      <File>Core/Code.sql</File>
    </UpdateDatabase>
  </InGameActions>

My mod continues to work 100% just fine EXCEPT for this new change, neither the localized text nor the modifier argument changes are taking effect. I can't find any failure in database.log, so I am at a loss as to why this is a problem.
 
  1. <FrontEndActions> for an Ingame Localization Update is bound to fail.
  2. Your UpdateDatabase code executes properly for me using a test mod so the problem is most likely in not having a LoadOrder setting as part of the action.
    Code:
      <InGameActions>
    	<UpdateDatabase id="SQL_Changes">
    		<Properties>
    			<LoadOrder>150</LoadOrder>
    		</Properties>
    		<File>MyCiv6SQL_Changes.sql</File>
    	</UpdateDatabase>
    ..........
  3. If adding the LoadOrder value does not cure the issue for you then there has to be a syntax issue in file Code.sql or the Path/Filename specified is not correct in the modinfo file.
 
Good catch about the localization, I added an InGameAction that runs the same localization SQL that the FrontEndAction does.

As for the load order, is there a way to set that in the ModBuddy (Visual Studio)? I'd like to avoid having to do a post build script to insert this if possible.


Also, you rock, thanks for helping me in multiple threads.


EDIT: I tried adding your suggested LoadOrder manually and it still did not work, the Water Mill is adding food rather than production to the tile
 
Last edited:
Did you start a new game ?

Or did you add a Watermill in a city that did not already have one ?

Once an object like a building is added to a city, the modifiers are applied as they are at the time of the addition. Later alterations of the modifier will not alter this original attachment by the game of the effects of the modifier for those cities that already had a Watermill with its modifiers as they were defined before you made the changes in the database.

I know the code works because I looked at the database after executing your Update instruction to table ModifierArguments.

See the top link in my signature. There's a section on LoadOrders, Dependancies, etc., that shows the steps needed in ModBuddy to add a LoadOrder value to an action.
 
I had a save file that had a city right about to finish construction of a Water Mill.

I'll try it again with a fresh save, thanks.
 
No matter what I try, I can't get the Water Mill to actually add Production rather than Food. I have spent too much time for such a small change. I'm dropping this now.

Thanks for the help anyway, it taught me a couple new things.
 
Back
Top Bottom