Sid Meier's Civilization VI

Sid Meier's Civilization VI

Silk & Spice: Trade Route Rework
Madisonian 2022 年 4 月 16 日 下午 10:19
Icons for 6T Grand Eras
I wrote code to add icons for these to the Tech and Civic trees for 6T Grand Eras, feel free to include it in your mod if you like.

I used Coast background with Trader icon for 4 tile range, Ocean background with Trader icon for 6 tile range.

-- Silk Road Tech Sea Trade Route Range
-- ==============================================================
INSERT OR IGNORE INTO TechSpecialUnlockables
(Unlockable, PrereqTech, Description, Background, Icon, Civilopedia)
SELECT ModifierId, TechnologyType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_4', 'COAST', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM TechnologyModifiers
WHERE ModifierId='SQUARE_RIGGING_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO TechSpecialUnlockables
(Unlockable, PrereqTech, Description, Background, Icon, Civilopedia)
SELECT ModifierId, TechnologyType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_6', 'OCEAN', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM TechnologyModifiers
WHERE ModifierId='STEAM_POWER_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO TechSpecialUnlockables
(Unlockable, PrereqTech, Description, Background, Icon, Civilopedia)
SELECT ModifierId, TechnologyType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_6', 'OCEAN', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM TechnologyModifiers
WHERE ModifierId='STEEL_ADJUST_SEA_TRADE_RANGE';

-- Silk Road Civic Sea Trade Route Range
-- ==============================================================

INSERT OR IGNORE INTO CivicSpecialUnlockables
(Unlockable, PrereqCivic, Description, Background, Icon, Civilopedia)
SELECT ModifierId, CivicType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_4', 'COAST', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM CivicModifiers
WHERE ModifierId='NAVAL_TRADITION_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO CivicSpecialUnlockables
(Unlockable, PrereqCivic, Description, Background, Icon, Civilopedia)
SELECT ModifierId, CivicType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_4', 'COAST', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM CivicModifiers
WHERE ModifierId='EXPLORATION_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO CivicSpecialUnlockables
(Unlockable, PrereqCivic, Description, Background, Icon, Civilopedia)
SELECT ModifierId, CivicType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_4', 'COAST', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM CivicModifiers
WHERE ModifierId='COLONIALISM_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO CivicSpecialUnlockables
(Unlockable, PrereqCivic, Description, Background, Icon, Civilopedia)
SELECT ModifierId, CivicType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_4', 'COAST', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM CivicModifiers
WHERE ModifierId='CAPITALISM_ADJUST_SEA_TRADE_RANGE';

INSERT OR IGNORE INTO CivicSpecialUnlockables
(Unlockable, PrereqCivic, Description, Background, Icon, Civilopedia)
SELECT ModifierId, CivicType, 'LOC_BTT_SILK_TRADE_ROUTE_RANGE_6', 'OCEAN', 'UNITOPERATION_MAKE_TRADE_ROUTE', 'UNIT_TRADER'
FROM CivicModifiers
WHERE ModifierId='GLOBALIZATION_ADJUST_SEA_TRADE_RANGE';

And the accompanying descriptions to go in the text file. Wrote it in XML since I couldn't get an SQL version to work.

<Row Tag="LOC_BTT_SILK_TRADE_ROUTE_RANGE_4">
<Text>Increases [Icon_SEARANGE] Trade Route range by 4 tiles.</Text>
</Row>

<Row Tag="LOC_BTT_SILK_TRADE_ROUTE_RANGE_6">
<Text>Increases [Icon_SEARANGE] Trade Route range by 6 tiles.</Text>
</Row>

(PS: I re-used descriptions for 4 and 6 tile so if anyone wants to use custom values, they'd just need to add a new description tag/text where applicable.)
最后由 Madisonian 编辑于; 2022 年 4 月 16 日 下午 10:36
< >
正在显示第 1 - 6 条,共 6 条留言
Alf.Net  [开发者] 2022 年 4 月 17 日 上午 8:39 
Hi Ciar, I really appreciate the help! I see now that 6T creates new tables. I tried incorporating your SQL code into the mod but couldn't get the Ocean and Coast icons to appear. I looked through JNR's files to see if I could figure something out, but I can't see what I'm doing wrong. I must be missing something obvious.

I'm a newbie modder and some simple things still elude me. So far I've managed to get what I want through trial and error and brute force, rather than a deep knowledge of SQL/XML.

I'll also ask for help in the modding discord, see if someone can lend a hand. Might be able to still sort it this weekend, otherwise it will have to wait until the next.
Madisonian 2022 年 4 月 17 日 上午 10:35 
I'm not an expert either, I just learn through reverse engineering other code.

JNR created a new table for Tech and Civic unlocks; the background icons are imported in 6T_Icons_UnlockFrames.xml and declared in TechAndCivicSupport_6T.lua as COAST or OCEAN. It should work out of the box assuming you have 6T Grand Eras activated.

Only thing I can think of that might be the problem is the Load Order; JNR uses Load Order 10/11 for those files, while your DB file doesn't have one set.

Try adding a load order higher than those to your main SQL in the modinfo file and see if that fixes it on your end.

<UpdateDatabase id="MainSilkRoads">
<Properties>
<LoadOrder>500</LoadOrder>
</Properties>
<File>Core/Main_SilkRoads.sql</File>
</UpdateDatabase>
Madisonian 2022 年 4 月 17 日 上午 10:42 
Also, I'm not sure if that code makes 6T a hard dependency or not since I always use it anyway; you'll instead want to add the new SQL file and accompanying text in separate files and *only* load them if 6T Grand Eras is enabled.

<ActionCriteria>
<Criteria id="6T_Grand_Eras">
<ModInUse>3ec8a6fb-2a3f-425f-bff5-b00146b7d5b0</ModInUse>
</Criteria>
</ActionCriteria>

<InGameActions>

<UpdateDatabase id="6T_Grand_Eras_DB" criteria="6T_Grand_Eras">
<Properties>
<LoadOrder>1000</LoadOrder>
</Properties>
<File>ModSupport/6T_Grand_Eras_DB.sql</File>
</UpdateDatabase>

<UpdateText id="6T_Grand_Eras_Text" criteria="6T_Grand_Eras">
<Properties>
<LoadOrder>1000</LoadOrder>
</Properties>
<File>ModSupport/6T_Grand_Eras_Text.xml</File>
</UpdateText>

</InGameActions>

<Files>
<File>ModSupport/6T_Grand_Eras_DB.sql</File>
<File>ModSupport/6T_Grand_Eras_Text.xml</File>
</Files>

Hope that helps.
最后由 Madisonian 编辑于; 2022 年 4 月 17 日 上午 10:49
Alf.Net  [开发者] 2022 年 4 月 17 日 下午 4:31 
Today I learned how to insert ActionCriteria into a modinfo file, and also how to change it directly in the project file so that it appears in ModBuddy as a Criteria option.

Unfortunately, after many attempts, it still didn't work :D. I suspected that would happen as there was no reason for it not to work "out of the box" with 6T eras enabled.

I'll try again next weekend. I think I've got all of the info that I need. It will end up being a silly detail somewhere.

Thanks for the help!
JNR 2023 年 4 月 2 日 下午 9:49 
Can't see anything wrong with Ciar Aon's code right now. I recommend using a DB viewer such as SQLiteStudio to check if the code is inserted in the first place to narrow down whether the code is wrong or the file isn't loaded. Let me know if you have any further questions, if you really can't get it to work at all I can also look into adding it on my end.

Also, I think Ocean background should be fine. Apart from unit actions, notification icons can also be a cool source, I think the trade *post* icon would fit well here.
Alf.Net  [开发者] 2023 年 4 月 3 日 下午 12:55 
Issue is now resolved as JNR has kindly made the mod compatible on his end. Thank you.
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50