In my game you can choose between 3 different characters: Mary, Janet and Claire.
Since they have different styles, I want them to have different bedrooms.
So in the begining of the game, a choice menu would open for you to choose between them.
The problem is that each bedroom has imagebuttons placed in different places (according to the decoration).
So I wanted to have something like: "screen marybedroom", "screen janetbedroom", "screen clairebedroom".
And according to the character you chose, the correct bedroom would appear when the scene is in the bedroom.
But I have no idea how or if it's possible. Or if I could make something with the "if, elif, else".
Sometimes I still get confused about the codes that "work together".
Does anyone has any idea on how I could do this? What would be a better way to do it?
Thanks.
Is it possible to make a "variable" screen?
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.
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.
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Is it possible to make a "variable" screen?
You could have different lines of scripts for each character. You could even have them as separate documents.Nanahs wrote: ↑Sat Dec 08, 2018 8:20 am In my game you can choose between 3 different characters: Mary, Janet and Claire.
Since they have different styles, I want them to have different bedrooms.
So in the begining of the game, a choice menu would open for you to choose between them.
The problem is that each bedroom has imagebuttons placed in different places (according to the decoration).
So I wanted to have something like: "screen marybedroom", "screen janetbedroom", "screen clairebedroom".
And according to the character you chose, the correct bedroom would appear when the scene is in the bedroom.
But I have no idea how or if it's possible. Or if I could make something with the "if, elif, else".
Sometimes I still get confused about the codes that "work together".
Does anyone has any idea on how I could do this? What would be a better way to do it?
Thanks.
script_mary.rpy
script_janete.rpy
and
script_claire.rpy.
You could start of in script.rpy
with a menu to chose which character to play
Code: Select all
label start:
menu:
"What character will you play?"
"Mary":
jump maryStart
"Janete":
jump janeteStart
"Claire":
jump clairStart
Re: Is it possible to make a "variable" screen?
Hello! I'll try to do it. Thank you so much!Per K Grok wrote: ↑Sat Dec 08, 2018 9:21 amYou could have different lines of scripts for each character. You could even have them as separate documents.Nanahs wrote: ↑Sat Dec 08, 2018 8:20 am In my game you can choose between 3 different characters: Mary, Janet and Claire.
Since they have different styles, I want them to have different bedrooms.
So in the begining of the game, a choice menu would open for you to choose between them.
The problem is that each bedroom has imagebuttons placed in different places (according to the decoration).
So I wanted to have something like: "screen marybedroom", "screen janetbedroom", "screen clairebedroom".
And according to the character you chose, the correct bedroom would appear when the scene is in the bedroom.
But I have no idea how or if it's possible. Or if I could make something with the "if, elif, else".
Sometimes I still get confused about the codes that "work together".
Does anyone has any idea on how I could do this? What would be a better way to do it?
Thanks.
script_mary.rpy
script_janete.rpy
and
script_claire.rpy.
You could start of in script.rpy
with a menu to chose which character to playIf you do it this way you don't have to worry about having to constantly having fixes for which of the characters the player has chosen. Just make sure you do not duplicate the label names. So you cannot have i.e. 'label bedroom' in more than one of the scripts. You could do something like 'label bedroom_m', 'label bedroom_j' and 'label bedroom_c' to keep it simple.Code: Select all
label start: menu: "What character will you play?" "Mary": jump maryStart "Janete": jump janeteStart "Claire": jump clairStart
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Is it possible to make a "variable" screen?
Code: Select all
screen bedroom(hero = 'default'):
if hero== 'Mary':
text 'something_about_Mary'
# add, style, buttons and etc....
elif hero=='Janet':
text 'something_about_Janet'
elif hero=='Claire':
text 'something_about_Claire'
else:
text 'default'
label start:
menu:
'Mary':
show screen bedroom('Mary')
'Janet':
show screen bedroom('Janet')
'Claire':
show screen bedroom('Claire')
'None':
show screen bedroom
'!'
Re: Is it possible to make a "variable" screen?
Thank you so much! I'll try this code tooIrinaLazareva wrote: ↑Sat Dec 08, 2018 1:01 pmCode: Select all
screen bedroom(hero = 'default'): if hero== 'Mary': text 'something_about_Mary' # add, style, buttons and etc.... elif hero=='Janet': text 'something_about_Janet' elif hero=='Claire': text 'something_about_Claire' else: text 'default' label start: menu: 'Mary': show screen bedroom('Mary') 'Janet': show screen bedroom('Janet') 'Claire': show screen bedroom('Claire') 'None': show screen bedroom '!'
Who is online
Users browsing this forum: No registered users