Stat Script for Relationships


#1

Hello everyone

So I am developing a game where I would like to show the relationship status of the protagonist with the various NPCs in the game. This could lead to potential romantic interests.

Say for example, I have three characters - Jack, Jill and Tom. I would like to show both negative and positive stats. So if, over the course of the game, the player makes choices that affects her/his relationship with Tom, it should reflect on the stat screen and vice versa.

What script do you recommend I use for the stat chart?

Also, is there a way to change the name of the stat name over the course of the game? Say it starts of at 0, which I would name “Neutral”. If the stat improves, I would like to change it to “Friends” and it then progresses to “Best Friends” and so on.


More than two stats in an opposed pair?
#2

The first thing I would suggest is to avoid potentially negative values (less than zero). Use a positive range of, say, 1-99, so 50 would be the starting default / Neutral.

As for *stat_chart itself, you cannot use conditional scripting within the body of that command, but you can make the entire thing conditional using *if, by indenting the *stat_chart below that. By this means you could, in theory, have multiple conditional *stat_charts of which only one will display at any given time, and so can be worded accordingly.

The simpler alternative for what you want to achieve would be to use conditional text (using *if / *elseif / *else) instead of - or in addition to, if you really must have - a *stat_chart. A simple sentence describing the current relationship with each friend might be best, and be less impersonal than showing the numerical values used to determine that text.


#3

I think everyone uses the start stats of 50. I can show you a way how to include the stats in a way they will never get over 100 or below 0, and how to include special names as well.

The best would be to use this:
In the startup, create the following variables:

*create met_Jill false
*create Jill 0
*create Jill2 ""
*create met_Jack false
*create Jack 0
*create Jack2 ""
*create met_Tom false
*create Tom 0
*create Tom2 ""
*create Unknown 0

You can leave out the ‘met_Jill’ part for example, if you want to show the Relationships even before you’ve met the character already. Personally, I like to just leave it to “Unknown”, and they will be revealed once the Character has been met in the future. If you decide to not use the “Unknown” part, just leave that out as well.

You won’t need any more in the Startup File, and thus we go to the ChoiceScriptStats File.
There you should include the following just like I instruct you below, or else you will be in a loop.

*temp JackText ""
*temp JillText ""
*temp TomText ""

[b]Relationships[/b]
*if met_Jill = false
    *stat_chart
        percent Unknown
*if met_Jill = true
    *gosub relJill
    *set JillText ("Jill "&Jill2)
    *stat_chart 
        percent Jill ${JillText}
*if met_Tom = false
    *stat_chart
        percent Unknown
*if met_Tom = true
    *gosub relTom
    *set TomText ("Tom "&Tom2)
    *stat_chart 
        percent Tom ${TomText}
*if met_Jack = false
    *stat_chart
        percent Unknown
*if met_Jack = true
    *gosub relJack
    *set JackText ("Jack "&Jack2)
    *stat_chart 
        percent Jack ${JackText}

*goto continue

*label relJill
*if (Jill > 100)
    *set Jill 100
*if (Jill < 0)
    *set Jill 0
*if (Jill >= 85)
    *set Jill2 "(Ally)"
*if (Jill >= 75) and (Jill < 80)
    *set Jill2 "(Great)"
*if (Jill >= 60) and (Jill < 75)
    *set Jill2 "(Good)"
*if (Jill >= 50) and (Jill < 60)
    *set Jill2 "(Neutral)"
*if (Jill >= 35) and (Jill < 50)
    *set Jill2 "(Bad)"
*if (Jill >= 25) and (Jill < 35)
    *set Jill2 "(Really Bad)"
*if (Jill < 25) and (Jill > 0)
    *set Jill2 "(Enemy)"
*if (Jill = 0)
    *set Jill2 "(Nemesis)"
*return

*label relTom
*if (Tom > 100)
    *set Tom 100
*if (Tom < 0)
    *set Tom 0
*if (Tom >= 85)
    *set Tom2 "(Ally)"
*if (Tom >= 75) and (Tom < 80)
    *set Tom2 "(Great)"
*if (Tom >= 60) and (Tom < 75)
    *set Tom2 "(Good)"
*if (Tom >= 50) and (Tom < 60)
    *set Tom2 "(Neutral)"
*if (Tom >= 35) and (Tom < 50)
    *set Tom2 "(Bad)"
*if (Tom >= 25) and (Tom < 35)
    *set Tom2 "(Really Bad)"
*if (Tom < 25) and (Tom > 0)
    *set Tom2 "(Enemy)"
*if (Tom = 0)
    *set Tom2 "(Nemesis)"
*return

*label relJack
*if (Jack > 100)
    *set Jack 100
*if (Jack < 0)
    *set Jack 0
*if (Jack >= 85)
    *set Jack2 "(Ally)"
*if (Jack >= 75) and (Jack < 80)
    *set Jack2 "(Great)"
*if (Jack >= 60) and (Jack < 75)
    *set Jack2 "(Good)"
*if (Jack >= 50) and (Jack < 60)
    *set Jack2 "(Neutral)"
*if (Jack >= 35) and (Jack < 50)
    *set Jack2 "(Bad)"
*if (Jack >= 25) and (Jack < 35)
    *set Jack2 "(Really Bad)"
*if (Jack < 25) and (Jack > 0)
    *set Jack2 "(Enemy)"
*if (Jack = 0)
    *set Jack2 "(Nemesis)"
*return

*label continue

Now, here you can write whatever else you want to include to your Statscreen, but do not write anything between the *goto and *label continue part, or else it won’t be shown. As soon as the Player opens the stat screen in the game, the script will first look if we even have met any of the RO’s above. If yes, it will jump to the label with their Name (relJack, for example), and look how good their relationship with the MC currently is. Depending on that, it will include a special word afterwards to show how high or low the RS is. Once it is finished, it will jump over the same part to not create a loop and will continue at the label ‘continue’

Of course, you would probably need to change the descriptions, I used the one I have in FAWR, and there it’s rather Ally and Nemesis instead of best Friend.

For further questions, just continue to ask x)


#4

That is a good idea. I think I should avoid negative values. Though the reason I am using numerical values is to help the player keep a track of her/his standing with the NPCs. Eventually, these values will lead to different endings featuring each of the NPCs. Moreover, I would like the player to take risky decisions by seeing how close she/he is to improving or worsening a relationship.


#5

Also, I think I would just like to take a complete comment space to simply say wow! That was a lot of help guys. Thank you.


#7

Thank you for typing that out. It really means a lot when I can get help from others. I owe you a beer. Or two.

Okay. Back to the game. So the protagonist meets the NPCs after the introductory section, at the end of which the player will have a chance to establish their name, gender, sexual orientation (I want this game to be played by all :slight_smile: since after all, it involves romance) and a few other traits.

After the introduction, the player will begin Chapter 1, where the NPCs will be slowly introduced. Now, say I create two choices.
Choice 1: Creates a negative relationship stat with Jill
Choice 2: Positive with Jill

So I just have to add an *if statement while providing the choice?


#8

Not really. If you used my code above, you can just type the following

*set Jill - 5
*set Jill + 5

Depending on what you want to have added, you need to add it to the choice afterwards, like this:

*fake_choice
    #Give Jill a Negative RS
        *set Jill - 5
    #Give Jill a Positive RS
        *set Jill + 5

#9

I think I shall try out that code. Looks like I have a lot of learning to do, especially with this section.