carnivorejoe
Chieftain
- Joined
- Nov 25, 2019
- Messages
- 7
So I'm working on trying to make the old Ultimate Eras mod compatible with more mods. Most recently, I'm trying to add some compatibility for a simple mod called Coasts and Rivers Yield Gold Again. It does exactly what it sounds like. However, starting in the Prehistoric Era with UEM, most unimproved tiles don't have their usual yields at the start of the game. You have to research a certain tech first, which unlocks a free custom building, which will restore the usual unimproved tile yields that you get from the Ancient Era. With that knowledge, it definitely seems out of place to immediately start earning gold from a river or coast tile in the Prehistoric Era, when nothing else yields gold, and most tiles don't even yield more than 1 food or 1 production.
My approach was to add another free custom building like UEM does, lock it behind a different tech, and when players research the tech, their rivers and coasts will begin yielding gold. To that end, I wrote this SQL code:
However, this doesn't work. I'm no expert at SQL, so I figured in order to see if I just wrote my code wrong, I would just try adding the building with XML:
This didn't work either. I took a look at Kael's guide, and he only referenced the same 3 tables that I did: Buildings, BuildingClasses, and Language_en_US. I also looked at how UEM added their custom building, and I can't find any additional references beyond those 3 tables either. What am I missing here?
My approach was to add another free custom building like UEM does, lock it behind a different tech, and when players research the tech, their rivers and coasts will begin yielding gold. To that end, I wrote this SQL code:
Spoiler :
Code:
DECLARE @RiverYield;
DECLARE @CoastYield;
SET @RiverYield = SELECT Yield FROM Feature_YieldChanges WHERE FeatureType = 'FEATURE_RIVER' AND YieldType = 'YIELD_GOLD';
SET @CoastYield = SELECT Yield FROM Terrain_Yields WHERE TerrainType = 'TERRAIN_COAST' AND YieldType = 'YIELD_GOLD';
IF @RiverYield >= 1
BEGIN
UPDATE Terrain_YieldChanges
SET Yield = 0
WHERE TerrainType = 'TERRAIN_COAST'
AND YieldType = 'YIELD_GOLD';
UPDATE Terrain_RiverYieldChanges
SET Yield = 0
WHERE YieldType = 'YIELD_GOLD';
UPDATE Feature_YieldChanges
SET Yield = 0
WHERE FeatureType = 'FEATURE_RIVER'
AND YieldType = 'YIELD_GOLD';
UPDATE Feature_RiverYieldType
SET Yield = 0
WHERE YieldType = 'YIELD_GOLD';
INSERT INTO Buildings (Type, BuildingClass, Cost, PrereqTech, Help, Description, Civilopedia, Strategy, ArtDefineTag, MinAreaSize, DisplayPosition, NeverCapture, IconAtlas, PortraitIndex)
VALUES ('BUILDING_SAILING_YIELDS', 'BUILDINGCLASS_SAILING_YIELDS', 0, 'TECH_SAILING', 'TXT_KEY_BUILDING_SAILING_YIELDS_HELP', 'TXT_KEY_BUILDING_SAILING_YIELDS', 'TXT_KEY_BUILDING_SAILING_YIELDS_TEXT', 'TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY', 'ART_DEF_BUILDING_PALACE', -1, 32, true, 'UNIT_ACTION_ATLAS', 6);
INSERT INTO BuildingClasses (Type, DefaultBuilding, Description)
VALUES ('BUILDINGCLASS_SAILING_YIELDS', 'BUILDING_SAILING_YIELDS', 'TXT_KEY_BUILDING_SAILING_YIELDS');
INSERT INTO Building_FeaturesYieldChanges (BuildingType, FeatureType, YieldType, Yield)
VALUES ('BUILDING_SAILING_YIELDS', 'FEATURE_RIVER', 'YIELD_GOLD', 1);
INSERT INTO Building_TerrainYieldChanges (BuildingType, TerrainType, YieldType, Yield)
VALUES ('BUILDING_SAILING_YIELDS', 'TERRAIN_COAST', 'YIELD_GOLD', 1);
INSERT INTO Language_en_US (Tag, Text)
VALUES ('TXT_KEY_BUILDING_SAILING_YIELDS', 'Coast & River Yields'),
('TXT_KEY_BUILDING_SAILING_YIELDS_TEXT', 'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
('TXT_KEY_BUILDING_SAILING_YIELDS_HELP', 'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.'),
('TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY', 'This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.');
END
However, this doesn't work. I'm no expert at SQL, so I figured in order to see if I just wrote my code wrong, I would just try adding the building with XML:
Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 12/16/2019 6:27:21 PM -->
<GameData>
<Buildings>
<Row>
<Type>BUILDING_SAILING_YIELDS</Type>
<BuildingClass>BUILDINGCLASS_SAILING_YIELDS</BuildingClass>
<Cost>0</Cost>
<PrereqTech>TECH_SAILING</PrereqTech>
<Help>TXT_KEY_BUILDING_SAILING_YIELDS_HELP</Help>
<Description>TXT_KEY_BUILDING_SAILING_YIELDS</Description>
<Civilopedia>TXT_KEY_BUILDING_SAILING_YIELDS_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY</Strategy>
<ArtDefineTag>ART_DEF_BUILDING_PALACE</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<DisplayPosition>32</DisplayPosition>
<NeverCapture>true</NeverCapture>
<IconAtlas>UNIT_ACTION_ATLAS</IconAtlas>
<PortraitIndex>6</PortraitIndex>
</Row>
</Buildings>
<Building_FeaturesYieldChanges>
<Row>
<BuildingType>BUILDING_SAILING_YIELDS</BuildingType>
<FeatureType>FEATURE_RIVER</FeatureType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>1</Yield>
</Row>
</Building_FeaturesYieldChanges>
<Building_TerrainYieldChanges>
<Row>
<BuildingType>BUILDING_SAILING_YIELDS</BuildingType>
<TerrainType>TERRAIN_COAST</TerrainType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>1</Yield>
</Row>
</Building_TerrainYieldChanges>
<BuildingClasses>
<Row>
<Type>BUILDINGCLASS_SAILING_YIELDS</Type>
<DefaultBuilding>BUILDING_SAILING_YIELDS</DefaultBuilding>
<Description>TXT_KEY_BUILDING_SAILING_YIELDS</Description>
</Row>
</BuildingClasses>
<Language_en_US>
<Row>
<Tag>TXT_KEY_BUILDING_SAILING_YIELDS</Tag>
<Text>Coast & River Yields</Text>
</Row>
<Row>
<Tag>TXT_KEY_BUILDING_SAILING_YIELDS_TEXT</Tag>
<Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
</Row>
<Row>
<Tag>TXT_KEY_BUILDING_SAILING_YIELDS_HELP</Tag>
<Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
</Row>
<Row>
<Tag>TXT_KEY_BUILDING_SAILING_YIELDS_STRATEGY</Tag>
<Text>This building will automatically upgrade any coast and river tiles within your cities to grant +1 gold when worked.</Text>
</Row>
</Language_en_US>
</GameData>
This didn't work either. I took a look at Kael's guide, and he only referenced the same 3 tables that I did: Buildings, BuildingClasses, and Language_en_US. I also looked at how UEM added their custom building, and I can't find any additional references beyond those 3 tables either. What am I missing here?