Creating Relationship Bonuses


So basically what I want to do is create a bonus that gives the player a little boost in stats. The only way to get these bonuses is to improve (or damage) their relationship with the other supporting characters of the game.

*if (talia = 50)
  *set talia_bonus "Encourgment (Max Health +10)"
  *set max_health +10
  *goto warning
*elseif (talia > 50)
  *set talia_bonus "Improved Encourgment (Max Health +15)"
  *set max_health +15
  *goto warning
*elseif (talia = 100) and (romanced_talia = "yes")
  *set talia_bonus "Lover's Encourgment (Max Health +20)"
  *set max_health +20
  *goto warning
*elseif (talia < 50)
  *set talia_bonus "Cold Welcome (Max Health +5)"
  *set max_health +5
  *goto warning
*elseif (talia = 0)
  *set talia_bonus "Silent Treatment (Ranged & Melee +10)"
  *set ranged +10
  *set melee +10
  *goto warning

This is the code for that of just a single character. The problem I’m having is that when I place this in the choicescript_stats it doesn’t affect the max health. For example: in start up I have the *create health command and have set the percentage to 100% and the *create max_health command set to 100 as well. The Improved Encouragement bonus adds +15 to the max health. I place this code into the choicescript_stats (NOT STARTUP) and then BAM! Nothing. So I moved the code to startup and BAM! IT WORKS! YAY! MAX HEALTH IS 115! :)) BUT WAIT! [-X Now as I start to write the next scene I can’t help but wonder, will I have to do this at the beginning of EVERY scene?!? If that’s true then will it continue to add +15 to max health?

So this is what I want to know. How can I get this code to 1) be a bit simpler, maybe even cleaner. 2) Get it into the choicescript_stats screen. And 3) How to prevent it from continuously adding when I want the bonus to be added only once. ALSO how would I have the code reset max_health so that it doesn’t stack? e.g. the player is given Cold Welcome +5 to max_health. Player improves relationship to Improved Encouragement + 15 to max_health. Now player has a bonus of +20 to max health therefore max health is at 120 rather than 115. Make sense? Let me know if I need to clarify a bit more. Any advice or help or links or well, anything is greatly appreciated. I understand how to use choicescript but i would say I’m only an intermediate user so be sure to dumb your explanation down a bit.


The percent bar isn’t supposed to go any higher than 100 as I understand it, if it does, it’ll start to look weird.

What you could do instead is have a number of numeric variables. One for current health and one for max health, and perhaps one for healing and/or damage if heal only gives back a partial value or your damage values are standardized. So your relationship would increase the numeric max health variable but not be displayed by a percentage.

If you’re fine with a simple numeric display, you could do something like;


But if you absolutely want to have the percentage bar, you could probably tie the max health to it in another way. I’m not especially good with math, but perhaps create four numeric variables. One that you can manipulate and increase the max health of, one for current health, one for the purpose of the equation, and one for display purposes. Then you would need to insert some code to get the percentile value of the max health as 100%, so something like;

*set max_health2 (max_health / 100)
*set max_health2 (100 / max_health2)
*set max_health2 * current_health
*set max_health2 / 100
*set max_health_display round(max_health2)

So for instance if max_health is 500, and current health is 255, then you’re currently at 51% health.
500/100 = 5
100/5 = 20
20 * 255 = 5100
5100 / 100 = 51
You’ll notice I also used the round command at the end there.
max_health is the numeric variable you can increase.
max_health2 is only used for the purpose of the equation.
current_health is self explanatory, and max_health_display is the one you use for the percentage bar to display in your stat screen.

Disclaimer, like I said, I’m not good at math. I think this works, but if it doesn’t you’ve been warned.


There’s a few things you can do.

  1. It might not be working in your stats file because it is after the maxhealth variable display, or it might be a percentage thing like Muton Elite said.

  2. You could leave it at the beginning of a scene that you want to give the bonus. This would prohibit you from updating it as your relationship changes, however.

  3. This is probably what you should do, but it’s complex:

You can create a third variable called bonusAmount (for example) and set it at the same time you give the bonus for the relationship. Set it to whatever the bonus you just got was. That way you can rerun the code whenever you want, but first subtract the last bonus. I wouldn’t put it in your choicescript stats folder because it would constantly be subtracting and adding to the max_health every time you open your stats.

As an example:
*set max_health-bonusAmount
determine talia_bonus
*set max_health+10