- Sep 26, 2019
- 1,014
- 2,142
I'm doing an S&M game, but the idea is that rather than having the user mess up once and they are done, the M/sub/bottom has a stress level which builds up if the user chooses cruel acts or goes down if they choose to be kind, plus a training level in which the M builds up a tolerance to stress. So, basically to get a bad end the user has to consistently be a dickhead because it is more of an abusive relationship at that point. That's the basic background.
What I need the game to do after every choice, check a long list of possible states of the heroine's mentality, if it checks a flag, the game diverts to a stress reaction where she lashes out against the MC, if not, then the game continues as normal. The only way I know how to do it is a giant elif list, it's high simplified and will probably be more complex when implemented in game as I balanced it more(I want to let the user have some fun but not allow them to go into psychopath levels).
So, it would look something like this and would check at the end of the scene:
EDIT: I just realized my mistake, the first time the user comes with a stress level of 4 the game is going to freak out, but pretend it works for now.
Thing is, the game is branching/linear(not a sandbox), so while I could just copy and paste the list at the end of every scene in which the user can invoke a stress reaction, I'd like to shorthand it. The only way I can think of is to have a second elif list which the game jumps to that list in which keeps track of a third variable, the scene_progress.
So, at the end of the scene I can just put
$ scene_progress += 1
jump stress_level
So, you basically get the program going:
What is our training level?
- it's 2, check that list against our stress
Is stress less than 8?
-Yes, move onto label "scene_progress"
What is our scene_progress?
-It's 4, so lets go to scene_4
And the story continues at scene_4
Thing is, having a giant elif statement take you to another elif statement which takes you to a yet another elif statement sounds really inefficient.
What I need the game to do after every choice, check a long list of possible states of the heroine's mentality, if it checks a flag, the game diverts to a stress reaction where she lashes out against the MC, if not, then the game continues as normal. The only way I know how to do it is a giant elif list, it's high simplified and will probably be more complex when implemented in game as I balanced it more(I want to let the user have some fun but not allow them to go into psychopath levels).
So, it would look something like this and would check at the end of the scene:
Python:
if training == 0
if stress < 4
$ training += 1
jump continue_to_next_scene
elif stress > 4
jump stress_1_scene
elif stress > 6
jump stress_2_scene
elif stress > 8
jump stress_3_scene
elif training == 1
if stress < 6
$ training += 1
jump continue_to_next_scene
elif stress > 6
jump stress_1_scene
elif stress > 8
jump stress_2_scene
elif stress > 10
jump stress_3_scene
elif training == 2
$ training += 1
if stress < 8
jump continue_to_next_scene
elif stress > 8
jump stress_1_scene
elif stress > 10
jump stress_2_scene
elif stress > 12
jump stress_3_scene
elif training == 3
if stress < 10
$ training += 1
jump continue_to_next_scene
elif stress > 10
jump stress_1_scene
elif stress > 12
jump stress_2_scene
elif stress > 14
jump stress_3_scene
elif training == 4
if stress < 12
$ training += 1
jump continue_to_next_scene
elif stress > 12
jump stress_1_scene
elif stress > 14
jump stress_2_scene
elif stress > 16
jump stress_3_scene
Thing is, the game is branching/linear(not a sandbox), so while I could just copy and paste the list at the end of every scene in which the user can invoke a stress reaction, I'd like to shorthand it. The only way I can think of is to have a second elif list which the game jumps to that list in which keeps track of a third variable, the scene_progress.
Python:
if scene_progress == 1
jump scene_1
elif scene_progress == 2
jump scene_2
elif scene_progress == 3
jump scene_3
elif scene_progress == 4
jump scene_4
elif scene_progress == 5
jump scene_5
elif scene_progress == 6
jump scene_6
$ scene_progress += 1
jump stress_level
So, you basically get the program going:
What is our training level?
- it's 2, check that list against our stress
Is stress less than 8?
-Yes, move onto label "scene_progress"
What is our scene_progress?
-It's 4, so lets go to scene_4
And the story continues at scene_4
Thing is, having a giant elif statement take you to another elif statement which takes you to a yet another elif statement sounds really inefficient.
Last edited: