Simple Question: how to remove yield from tundra hills?

Laz0r

Warlord
Joined
Oct 18, 2019
Messages
127
How do I remove a single production yield from specifically tundra hills? I'm not at all a modder and only know how to modify or repurpose lines from .sql files, so this is what I came up with to no success:

Code:
UPDATE Terrain_Yields
SET Yield = '-1'
WHERE TerrainType = 'TERRAIN_TUNDRA' AND 'REGION_HILLS' AND YieldType= 'YIELD_PRODUCTION';
 
UPDATE Terrain_HillsYieldChanges
SET Yield=(SELECT Yield FROM Terrain_HillsYieldChanges WHERE TerrainType='TERRAIN_TUNDRA' AND YieldType='YIELD_PRODUCTION')-1
WHERE TerrainType='TERRAIN_TUNDRA' AND YieldType='YIELD_PRODUCTION';
 
UPDATE Terrain_HillsYieldChanges
SET Yield=(SELECT Yield FROM Terrain_HillsYieldChanges WHERE TerrainType='TERRAIN_TUNDRA' AND YieldType='YIELD_PRODUCTION')-1
WHERE TerrainType='TERRAIN_TUNDRA' AND YieldType='YIELD_PRODUCTION';
Thank you sir, by chance is there a guide somewhere on this forum for learning the different variables that can be changed in SQL files?
 
 
Bit of a necrobump, but is it possible to do this in XML?
Unfortunately no. For this and other reasons that's why SQL is superior to XML for modding.
 
You're right that SQL is superior to XML but you're wrong about your point
XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 5/2/2019 5:53:11 AM -->
<GameData>
    <Terrain_HillsYieldChanges>
        <Update>
            <Set Yield="1"/>
            <Where TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_PRODUCTION"/>
        </Update>
    </Terrain_HillsYieldChanges>
</GameData>
It's hardcoded, but it not going to matter that it's hardcoded. The SQL implementation is better, and should be what you use, but rest assured that UPDATE statements are in fact possible in XML.

Though this does raise the question as to whether the SQL implementation needs to perform a check in order to prevent the chance of a negative tile yield occurring if other yield changes are in play, in case the game doesn't prevent such a thing itself...
 
You're right that SQL is superior to XML but you're wrong about your point
XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 5/2/2019 5:53:11 AM -->
<GameData>
    <Terrain_HillsYieldChanges>
        <Update>
            <Set Yield="1"/>
            <Where TerrainType="TERRAIN_TUNDRA" YieldType="YIELD_PRODUCTION"/>
        </Update>
    </Terrain_HillsYieldChanges>
</GameData>
It's hardcoded, but it not going to matter that it's hardcoded. The SQL implementation is better, and should be what you use, but rest assured that UPDATE statements are in fact possible in XML.

Though this does raise the question as to whether the SQL implementation needs to perform a check in order to prevent the chance of a negative tile yield occurring if other yield changes are in play, in case the game doesn't prevent such a thing itself...
Thanks for this! I actually tried that exact file earlier, but I forgot how XML works so I put "AND" in the middle of that <Where> line.

After digging into some other mods' code I see that updating the database via SQL doesn't require doing anything fancy in the modinfo file (nothing fancier than doing it via XML, anyway) so I will probably convert all my XML files to SQL at some point. Until then I will use the XML you provided.
 
The XML code given above sets all values TO 1 while the SQL SUBTRACTS 1 from the current value
SQL
Before After
3 --> 2
2 --> 1
1 --> 0
XML
Before After
3 --> 1
2 --> 1
1 --> 1

To do the same with XML you'd need multiple updates with an extra Where parameter
Where Yield=1, Set Yield=0
Where Yield=2, Set Yield=1
Where Yield=3, Set Yield=2
etc
 
Ah yeah, subtle difference. I don't think it affects anything in vanilla, but it could matter if you had a mod which had a building which gave +1 Production to all unforested Tundra tiles, so I'll switch to using your SQL.
 
I think a lot of the scenario database manipulations are done in XML, so that could be a good place to look for how things are done and formatted.
 
Back
Top Bottom