# Need help! Especially if you play Breach series by Maxwell, that you'll understand my problem

Soo I’m making my own game, and i adore Breach’s skill & relations stats system, so i want to use as inspiration for my own game.

If I’m not mistaken that Breach skill system using 200 points for his skill(his new game use 200 points for the skill, i don’t know about the relations’ one) and opening the Stat Screen, it shows the percentages with half of the skill points.
let’s say i put 100 for my Strength variable, it shows as 50% in stats screen

I tried to code this… but i encountered with problem, I don’t know to code them… i know the value need to be divided by 2, and then put it into new variable to be shown as percentages in stats screen, but i don’t know how to code it…

My code example
Main.txt
*create max_strenght 0
*create strength 200
*set strength -188
*set max_strength (strength / 2)

choicescript_stats.txt
*stat_chart
percentage strength
Strength

Using code above, sure the percentage in stat screen shows 6% because 12/2 = 6.
BUT! when I’m using command *set strength +10, the “strength” variable changed from 12 to 22, but the “max_strength” value still 6% not changing like 11%

How to i “keep updating” the value of variable “max_strength” each time I’m using the *set strength to change value of “strength” variable? Is this makes sense, I’m kinda jumping here and there…

Oh! One more thing, how do you create “return to the game” option when in stats screen? plenty of game have that choice, Breach too! But i don’t know to code it…
*Yes i could just use the button that located above the screen, but i want to learn how to code that button…

*set commands only trigger when the code hits it. When you increase the strength stat do you always put the *set max_strength (strength/2) after it or is that only set once currently?

Well, my mistake is that i didn’t add that hehehe
But it’s fine, i just figured it out few hours ago, after scouring wikis and forums. I’ll write the solutions here, just in case someone has similar problem like me.

Basically since i just need that percent to show(only in stats screen) the half value of variable “strength”, rather than creating new variable “max_strength”, instead i used the *temp command in stats screen file, because… it’s only for show, I’m not using that variable for skill check throughout the game.

The code goes like this:
startup.txt
*create strength 12

choicescript_stats
*temp stat_strength
*set stat_strength (strength / 2)

*stats_chart
percent stat_strength Strength

I don’t know if it’s the most efficient codes flow… but its get the job done. Everytime i set new value of variable strength, and i look into stat screen, the percent does change. It’s solved! And I’m not gonna use that for the game’s skills check too, because I’m using the other permanent variables like *create strength.

Yea it’s solved, you could close this thread though, thank you for responding still.

1 Like

Hey, @mann, welcome to the forum. When sharing a piece of code it’s better to use a pre-formatted block. You can do that by typing three back ticks or clicking the gear icon on the edit box and selecting `Preformatted text`.

Your solution only works if the maximum value is 200, but the proper way to calculate a percentage is by dividing the current value by the maximum value and multiplying by 100. You can use the round function to avoid long decimals. For example:

``````*temp strength_percent round((strength/max_strength)*100)
``````
1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.