How to change numbers in tutorial descriptions?

Leyrann

Deity
Joined
Jan 11, 2015
Messages
5,425
Location
Netherlands
I've been building a mod to slow down the Exploration and Modern Age somewhat, and everything is working, except I can't figure out how to change the text in the tutorial descriptions for the victory modifiers.

For example, the first milestone for the Enlightenment victory path has been shifted to two 40-yield tiles instead of one, which means the last part of the description of the third entry in the associated tips should read: "Achieve single tile yield: [number]/2".

This text can be found in \text\en_us\TutorialText.xml, where it reads:

XML:
        <Row Tag="LOC_TUTORIAL_SCIENCE_QUEST_3_TRACKING_BODY">
            <Text>Achieve single tile yield: {1_YieldCurrent}/{2_YieldGoal}</Text>
        </Row>

And I don't know where I can find what {2_YieldGoal} points at - and how I can change it.

Obviously I could just put static numbers instead but I don't know what issues that might cause down the line here or there.
 
I'm not at my PC right now but those numbers would be defined in one of the UI files. Simply changing them to static numbers in the text will likely cause problems because the UI script is expecting dynamic fields it can update and by taking a them out an exception may be thrown.
 
Ah, so they're not an xml thing...

Guess I'll just upload the mod without it and put an open invitation for anyone with the required knowledge to provide the properly edited stuff.

Luckily, the descriptions of the general goal are static text.
 
It's in this file.

age-exploration/ui/tutorial/tutorial-quest-items-exploration.js

I just did a string search of 'LOC_TUTORIAL_SCIENCE_QUEST_3_TRACKING_BODY'.

The xml is tracking the quest and shows how much yield your highest district yield is over the target goal. So if I had a district with 30 yield and checked the quest in the ui in game, it would read Achieve single tile yield: 30/40. You are going to need to edit two parts of the file. I put code snippets of the things you can search to find them in the js file. I would suggest adding another const (ex: const SCIENCE_QUEST_3_YIELD_NEEDED2 = 40; )and restructuring the code in the quest section to check for two districts instead of one. Here is a function that I found that should be able to help with that, playerStats.getNumDistrictWithXValue(*YOUR_VALUE_HERE*, DistrictTypes.URBAN) >= 2. After that you can change the text field in the xml to reflect the coding changes. If you need any help with the coding you can message me.

TutorialManager.add({
ID: "science_victory_quest_3_tracking",
quest: {
title: Locale.compose("LOC_TUTORIAL_SCIENCE_QUEST_3_TRACKING_TITLE"),
description: "LOC_TUTORIAL_SCIENCE_QUEST_3_TRACKING_BODY",
...
getDescriptionLocParams: () => {
let iYieldCurrent = 0;
const player = Players.get(GameContext.localPlayerID);
if (player) {
const playerStats = player?.Stats;
if (playerStats) {
iYieldCurrent = playerStats.getHighestDistrictYield(DistrictTypes.URBAN);
}
}
return [iYieldCurrent, SCIENCE_QUEST_3_YIELD_NEEDED];
...
onCompleteCheck: (_item) => {
let iYieldCurrent = 0;
const player = Players.get(GameContext.localPlayerID);
if (player) {
const playerStats = player?.Stats;
if (playerStats) {
iYieldCurrent = playerStats.getHighestDistrictYield(DistrictTypes.URBAN);
}
}
if (iYieldCurrent >= SCIENCE_QUEST_3_YIELD_NEEDED) {
return true;
}
return false;
---------------------------------
// SCIENCE QUEST 3
const SCIENCE_QUEST_3_YIELD_NEEDED = 40;
 
Last edited:
Back
Top Bottom