So just declare them
$ BranchA = False
$ BranchB = False
$ BranchC = False
$ LifeA = False
$ LifeB = False
$ LifeC = False
$ NPCAAffection = 0
$ NPCBAffection = 0
etc.....
I slightly disagree with this statement, as I think it's better to declare all variables using either
define
(value is never going to change while the game is running) and
default
(value is changed by code).
So I'd say it should be more like:
Python:
default BranchA = False
default BranchB = False
default BranchC = False
default LifeA = False
default LifeB = False
default LifeC = False
default NPCAAffection = 0
default NPCBAffection = 0
# etc.....
Any help would be extremely appreciated.
The main thing is to consider your goals.
You talk about "3 endings", "3 lifestyles" and "8 to 10 love interests".
3 endings...
Wouldn't the endings be dictated by the lifestyle and success/failure of your love interests?
You might not need separate variables to track the endings, as other variables will already have you covered.
Depending on what you have planned for those endings, I can't help but feel that 8-10 love interests is going to make things more complicated than a simple 3 endings. But that's fine - I don't know your project, so it's okay if I'm confused.
3 lifestyles...
You have a couple of options here. Let's say the lifestyles (based on your project title) are "Dom", "Sub", "Switch". Or maybe "Dom", "Sub", "Vanilla".
Your first option is a single lifestyle variable.
default lifestyle = "switch"
Okay... important lesson here. If you are going to use string (text) variables for tracking this... make sure the values are always lowercase. "Switch" and "switch" are NOT the same to a computer. It will make your life infinitely easier if your values are consistent. Especially when you're trying to find a bug where the game doesn't work because you accidentally used a capital letter within the value.
Continuing on...
Now... as your game progresses and the player makes choices... you have the option to change the value of the
lifestyle
variable based on those decisions.
That could be a direct choice...
Python:
default lifestyle = "switch"
label start:
scene black with fade
menu:
"Stand up to him":
"You slap his hand away."
$ lifestyle = "dom"
"Cower backward":
"You take a step backward and sink to your knees."
$ lifestyle = "sub"
"Do nothing":
"You wait to see what he does next."
Or it could be an indirect choice...
Python:
default lifestyle = "switch"
default sam_love = 0
default dave_love = 0
label start:
scene black with fade
# much later on within the game...
if dave_love >= 6 and sam_love <= 3:
$ lifestyle = "dom"
if sam_love >= 5:
$ lifestyle = "sub"
But... using strings generally isn't a good idea. At the very least, it's more prone to typos as well as just being more typing.
If you went this route... you could use a simple number instead. Where 1 is used instead of "dom", 2 is used instead of "sub" and 3 is used instead of "switch" (or "vanilla").
Python:
default lifestyle = 3
label start:
scene black with fade
menu:
"Stand up to him":
"You slap his hand away."
$ lifestyle = 1
"Cower backward":
"You take a step backward and sink to your knees."
$ lifestyle = 2
"Do nothing":
"You wait to see what he does next."
Obviously for this to work, you have to remember which is which both when you are setting the value and checking it.
Your second option is three variables...
Programming tends to lead to lots of checks whether something is true or false... and your choice here is no exception. Though the python programming language (and therefore RenPy) specifically uses
True
and
False
. It's case sensitive and those capital letter matter.
But you could go with...
Python:
default dom = False
default sub = False
default switch = True
label start:
scene black with fade
menu:
"Stand up to him":
"You slap his hand away."
$ dom = True
$ sub = False
$ switch = False
"Cower backward":
"You take a step backward and sink to your knees."
$ dom = False
$ sub = True
$ switch = False
"Do nothing":
"You wait to see what he does next."
$ dom = False
$ sub = False
$ switch = True
Though as I type this, I'm kinda terrified that
sub
and
switch
might be reserved words within the python language. So maybe
role_dom
,
role_sub
and
role_switch
might be better variable names.
I am assuming here that the lifestyles are mutually exclusive and therefore the player by settings the player to one, the other two must be
False
.
Which brings up another option...
Your third option is only two variables...
"switch" and/or "vanilla" in this context is just someone who is neither a dom or a sub or who is both. Since "dom" and "sub" are really the only thing that matters... those might need to be our only variables for lifestyle.
Python:
default role_dom = False
default role_sub = False
label start:
scene black with fade
menu:
"Stand up to him":
"You slap his hand away."
$ role_dom = True
"Cower backward":
"You take a step backward and sink to your knees."
$ role_sub = True
"Do nothing":
"You wait to see what he does next."
# later in the code, after more chances to set "dom" and "sub"....
if role_dom == True and role_sub == True:
"Player is a switch."
if role_dom == True and role_sub == False:
"Player is a dom."
if role_dom == False and role_sub == True:
"Player is a sub."
if role_dom == False and role_sub == False:
"Player is vanilla."
Though depending on your game's needs, maybe both values being True or both values being False could signify a "switch" too.
As with any programming language, there are alternative ways to structure those final four checks. A more experienced programmer might nest those
if
statements within each other...
Python:
if role_dom == True:
if role_sub == True:
"Player is a switch."
else:
"Player is a dom."
else:
if role_sub == True:
"Player is a sub."
else:
"Player is vanilla."
My conclusion...
If it were just a choice between "dom" and "sub"... I'd use
True
/
False
and have a single variable.
But since you said 3 lifestyles... I'd again go with a single variable... this time a number. Where dom=1, sub=2, switch=3. (maybe vanilla=0 ?). Dunno if that makes sense for your game, but presuming lifestyle is what I think it is... then a number solution makes sense to me. If you're more comfortable using strings/text... then use strings.
However... maybe lifestyles are not mutually exclusive. Maybe my example of "dom" AND "sub" being a "switch" make sense in the context of your design... so my example of combinations using True/False may suit you better.
8-10 Love Interests...
99 times out of a 100 this is going to be a number. You start at zero and add 1 or 2 or whatever each time you earn points with that love interest.
The other 1 out of a 100 is going to be a simple Yes/No solution... or in computer terms...
True
or
False
.
But in all likelyhood, it's going to be that number... and since I haven't covered numbers is much detail yet - I may as well assume number here.
Python:
default dave_love = 0
default sam_love = 0
default marvin_love = 0
default george_love = 0
default marty_love = 0
default milton_love = 0
default lou_love = 0
default wilbur_love = 0
label start:
scene black with fade
"You see Sam stood by the lockers."
menu:
"He looks tasty":
$ sam_love += 1
"I'm unimpressed":
$ sam_love -= 1
"Whatever":
pass
$
is RenPy for "do python command"
+= 1
is shorthand for "add 1 to this variable".
-= 1
is shorthand for "subtract 1 to this variable".
pass
is RenPy for "do nothing". You only use it when no other command fits the situation.
Beyond that, it's only about checking the values of those numbers as the game progresses. There are already examples of
if
checks above.
Just know that:
==
checks to see if two things are equal.
!=
checks to see if two things are not equal.
<
checks to see if the first thing is less than the second thing.
>
checks to see if the first thing is greater than the second thing.
<=
checks to see if the first thing is less than or equal to the second thing.
>=
checks to see if the first thing is greater than or equal to the second thing.
Finally, there's checking things in combination with each other using
and
,
or
and
not
.
if role_dom and milton_love >= 6:
or perhaps
if wilbur_love == 0 or george_love <= 3:
.
I would add a word of caution here too. It's very easy to get into a habit of gating off content based on number values.
Python:
# somewhere in the code...
if dave_love <= 6:
jump ch3_skip_shower_scene
label ch3_shower_scene:
# lots of pretty graphics and text.
label ch3_skip_shower_scene:
"And then I went to bed."
But a lot of devs will do this check based on the maximum that value can be at that moment. So if the player could have potentially done +1, +1, +1, +2, +1 and +1... the maximum is currently 7. It's very easy to write
if dave_love >= 7:
or
if dave_love < 7:
. Except for a player to see that content, you've now made it so the player must have played the PERFECT game so far and not made a single bad choice. Not only have you made a walkthough pretty much mandatory for players - all those extra scenes you wrote for what happens if the player makes the "other" choice is pretty much wasted effort on your part. The trick is making "bad choices" rewarding too (not easy) or at least reducing the threshold down from 7 to maybe 4 or 5.
I know that's a lot to get through... so congrats if you made it this far.