[SOLVED] how can be manage the flow of the story in the simplest way?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

[SOLVED] how can be manage the flow of the story in the simplest way?

#1 Post by deltadidirac »

Hi,
I'm absolutely ignorant about all regarding the programming, so I'm here to ask you kindly as I can control the story flow (if it's possible), using the minor number of variables to not create for each label an hard conditional statement with much "if, elif, and else ecc...", because often when I use it the game don't go on as I would or go in crash something.

consider that I create a single variable for each character, for each location, and for each hour or day of the week... with this method:
default dagval = 0
default droom1 = 0
ecc...

so when I play a single scene (a dialogue label), at the end of it some variables will improve with the $ dagval +=1, $ droom1 +=2, and so on, and while the main character remain in the same location, the UI screen appear and appear the screen of that location... so you can move everywhere you want and go or do what the story suggest..., but obviously, the next scene (or dialogue) needs some conditions to be able to be playable...
Until now I only used the "if, elif, else" statement to unblock the new scene, but often nothing happens, or there are some contradictions, or too much conditions...

How can I manage all this in the simplest way?
Do I the correct solution and I must control better the single values?
or another method more fast and easy exist?

have a nice day
Last edited by deltadidirac on Sun Jan 20, 2019 9:16 am, edited 1 time in total.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: how can be manage the flow of the story in the simplest way?

#2 Post by Kia »

usually the problem is not considering every possible combination. let's consider you have one variable. you have the conditions:

Code: Select all

if dagval == 0:

elif dagval == 1:

elif dagval == 2:

elif dagval == 3:
and so on, if you don't add something like "if dagval > 4" there's always the possibility that the players do something you didn't predict and go to a line of code that you didn't want to.
when you have a combination of variables, it gets very complicated, for only 3 variable that each can be 0, 1 or 2 you have 27 possibilities, that's 27 if statement you need to consider.

Code: Select all

if a == 0 and b == 0 and c == 0:

elif a== 0 and b == 0 and c == 1:

so on...
the easiest method is using "and" and a "minimum requirement" to unlock a scene:

Code: Select all

if dagval  > 4 and droom1  > 3:
    jump scene_4
else:
    jump denied_msg

User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

Re: how can be manage the flow of the story in the simplest way?

#3 Post by deltadidirac »

Hi Kia,
thanks, so what I did until now it's correct, I must only calculate better every single value and combine it in the right way with others...

have a nice day

Post Reply

Who is online

Users browsing this forum: No registered users