Creating a stat that wont show up until later in the game?

I’ve been working on a game for some time and have a kind of decent grasp on all the coding, but one thing i was wondering. Is it possible to add a stat to the stat screen that wont show up on the stat screen until you get to a certain point in the story?

Any help would be appreciated, thanks.

Sure. Just use an if/else statement in choicescript_stats.txt and make it conditional on a boolean global variable that gets flipped at the right point in the story.

It’s perhaps also worth bearing in mind that while you cannot use an *if command within an actual *stat_chart (e.g. to make just a particular percentile bar conditional, which would be useful on occasion), you can however make an entire *stat_chart conditional:


*if (condition)
  *stat_chart
    percent skill1
    percent skill2
    etc.

The only problem is that two separate *stat_charts always have a gap between them, so unfortunately it’s also not possible to have a conditional second one and make it appear to be an extension of the first.

In essence, any conditional stats will always have to appear separate to any ordinary ones so you have to design the overall look accordingly, bearing this in mind.

You could get rid of that gap @Vendetta was talking about.
Do your normal stats this way (by using a conditional chart):


*if not (condition)
  *stat_chart
    percent skill1
    percent skill2

Then, add another stat chart, after that:


*if (condition)
  *stat_chart
    percent skill1
    percent skill2
    percent skill3

The first stat chart is the one that displays all your stats WITHOUT “skill3” (which, in this case, is the attribute we want to display only after a certain part in the game).
The second stat chart is the one that displays all your stats WITH “skill3”.

Since we added the “*if” in the front of both, only one of them will display. You define the variable in mygame.js as “false” (the “condition” variable) and then, when you want the hidden stat to display, you just set that “condition” variable to true so that it will display that stat as well, amongst the other ones (without any gaps).

@Vendetta raises a good point that I forgot to mention. The stat_chart needs to be embedded inside the *if statement. Embedding the *if statement inside of a stat_chart won’t work. @AlexCosarca’s advice in turn builds on @Vendetta’s. Sometimes you’re better off using alternate charts if you want to group a conditional ability with other abilities that aren’t conditional without that gap appearing.

thanks for the help, this helps a lot

You can probably remove the gap via css too.