Hiding character relationships until you meet them

I was experimenting with my choicescript game commands and with the help of various forums that I read, I managed to make one. If anyone can suggest an improvement for my code, I will appreciate it, but my goal in writing this is topic is to help other people who are also having a hard time hiding the relationship or stat chart until it is needed. (I’m still new in coding so forgive me if I use the wrong terms or unable to use the proper jargons.)

The first thing that I did was to create a character relationship in the startup txt, which I then set to 0 so that relationships will not appear in the startup screen.

Note: RelChar1 can be changed into whatever label you like.

*create RelChar1 100
*create RelChar2 100
*create RelChar3 100
*create RelChar4 100
*create RelChar5 100
*create RelChar6 100
*create RelChar7 100
*create RelChar8 100
*create RelChar9 100

*set RelChar1 0
*set RelChar2 0
*set RelChar3 0
*set RelChar4 0
*set RelChar5 0
*set RelChar6 0
*set RelChar7 0
*set RelChar8 0
*set RelChar9 0

Then I went into the choicescript_stats and created an if-else statement.

*if RelChar1 = 0
*goto no_data
*else
*stat_chart
percent RelChar1 Char1
*if RelChar2 = 0
*goto no_data
*else
*stat_chart
percent RelChar2 Char2
*if RelChar3 = 0
*goto no_data
*else
*stat_chart
percent RelChar3 Char3
*if RelChar4 = 0
*goto no_data
*else
*stat_chart
percent RelChar4 Char4
*if RelChar5 = 0
*goto no_data
*else
*stat_chart
percent RelChar5 Char5
*if RelChar6 = 0
*goto no_data
*else
*stat_chart
percent RelChar6 Char6
*if RelChar7 = 0
*goto no_data
*else
*stat_chart
percent RelChar7 Char7
*if RelChar8 = 0
*goto no_data
*else
*stat_chart
percent RelChar8 Char8
*if RelChar9 = 0
*goto no_data
*else
*stat_chart
percent RelChar9 Char9

*label no_data
Characters that you have met will appear in this screen.

Now the way this code works is if the stated relationship of your character is 0, it will automatically go to the no_data label. If the relationship is more than 0, the relationship chart would automatically appear on the show stat screen. Now you can increase the relationship for your character at any point in your game. An example of this would be the following:

“Hello, Char1!” You greeted the woman sitting on top of the desk.
*set RelChar1 30

Once a value for RelChar1 is more than 0, their relationship chart would now appear on the show stats screen. As previously stated, until you set a value more that 0 for a character, their chart would not appear on the show stat screen.

However, I admit that there is one tragic flaw with this code that I made. If you decreased the character’s relationship unknowingly to 0, the relationship chart would once again disappear from the show stat screen. In some instances, this can be helpful especially in situations where you want to kill off your characters.

I hope that this topic helps everyone in some way.

2 Likes

Hi. I hope it’s okay, but I have a few potential improvements for your first post. Firstly, if you put ``` before and after your block of code, it’ll let you display the indents, which is very useful (and probably vital for this post).

Secondly, if you meet the characters in any order other than the strict numerical order, the later ones won’t appear in the stat screen until you’ve met the ones in between. It would be better to just ignore the *goto no_data part and instead just have something like:

*if RelChar1 != 0
    *stat_chart
        percent RelChar1 Char1
*if RelChar2 != 0
    *stat_chart
        percent RelChar2 Char2

And so on.

I would also note that as long as you use fairmath (*set RelCharX %-10 etc.) and don’t change it by 100% or more, you’ll never get back down to 0.

(Also, is there any reason why you create the stats at 100 instead of just 0?)

1 Like

Thank you! I will try to further improve my code based on this. Also there is no particular reason on why I use 100 on the stats. I guess it’s just a force of habit since the first tutorial/guides that I’ve learned from have 100 stats so I’ve been using it ever since. I haven’t tried changing the 100 to 0 so I don’t know what would happen if I do it.

I use something similar but instead of going by the relationship stat to show the relationship I use met_char1 variable

*if met_char1 false
    A mysterious figure (other flavour text, you don't even need to put flavour text here)
*if met_char1 true
character info 
flavour text which changes based on the relationship value or you can put stat_chart here
1 Like