i've been trying to make a VN where the user can decided which character they want to play and to let them choose , i decided to make a branch button so they can choose it base on the image i display in the screen.
the problem is what is the python code for that? i've been looking for tutorial but non able to solve my problem so far.
i cant make an image as a choices button and to make the script remember the characther that the user choose. please help with example code so i can understand . thankyou !
Making user to decided two characters ?
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.
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Making user to decided two characters ?
So basically you want two buttons that set a variable when clicked or branch off to a different path. You don't need (much) python, you need screen language instead.
https://www.renpy.org/doc/html/screens.html
Keywords that will be useful are Frame, Hbox, Vbox and Imagebutton (and the actions SetVariable and Jump from here: https://www.renpy.org/doc/html/screen_actions.html).
https://www.renpy.org/doc/html/screens.html
Keywords that will be useful are Frame, Hbox, Vbox and Imagebutton (and the actions SetVariable and Jump from here: https://www.renpy.org/doc/html/screen_actions.html).
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Re: Making user to decided two characters ?
Pretty much what he said ^ Theres a few ways to do it but the easiest is probably to set it up like a menu, though with a different screen than your usual menus that displays your "character picker" Essentially it's just a menu that looks a little different. You can use your button to set a variable, you've just got to make sure to do a check to make sure only one button can be enabled at a time. You don't want some weird bug popping up if someone were to press both buttons.
Re: Making user to decided two characters ?
but how to make the system to remember the choice we choose , like if there is a 2 choice between mc1 and mc2 , how to make them remember as one 1 variable?
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Making user to decided two characters ?
Very basic example...
I am not too sure how that handles images though, whether 'show player happy' would effectively look for 'g happy' or 'b happy' (to cut down on repeated code) -
Maybe test it with different image='img_tag' parameters in the defines...
If it works ok with a menu as above, just tweak it to use imagebuttons
Code: Select all
define g = Character("Girl")
define b = Character("Boy")
label start:
"Words"
menu:
"Girl":
$ player = Character(kind=g)
"Boy":
$ player = Character(kind=b)
player "Words said by chosen type"
Maybe test it with different image='img_tag' parameters in the defines...
If it works ok with a menu as above, just tweak it to use imagebuttons
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Making user to decided two characters ?
yes i use that to determine the character but my problem remain unsolvedRemix wrote: ↑Fri Aug 18, 2017 1:30 pm Very basic example...I am not too sure how that handles images though, whether 'show player happy' would effectively look for 'g happy' or 'b happy' (to cut down on repeated code) -Code: Select all
define g = Character("Girl") define b = Character("Boy") label start: "Words" menu: "Girl": $ player = Character(kind=g) "Boy": $ player = Character(kind=b) player "Words said by chosen type"
Maybe test it with different image='img_tag' parameters in the defines...
If it works ok with a menu as above, just tweak it to use imagebuttons
the question is How do I link user choice to two variable ?
FOR EXAMPLE :
$ USERCHOICE = "X" OR "Y"
X = IMAGE_CHARACTER1
Y= IMAGE_CHARACTER2
the chosen X or Y become 1 variable = image CHOOSENCHARATER
so i can just type
show image CHOOSENCHARACTER
and the shown image will depend on user choice(whether it's X or Y)
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Making user to decided two characters ?
It seems to work fine using string interpolation in the image name = "" bits...
Other than the imagebuttons question, does that cover your needs?
imagebutton .... action [ SetVariable( player, Character(kind=g) ), SetVariable( image_tag, "girl" ) ] should/might steer you on your way
Code: Select all
define g = Character("Girl")
define b = Character("Boy")
default image_tag = "girl"
image player happy = "images/[image_tag]_happy.png"
label start:
"Words"
menu:
"Girl":
$ player = Character(kind=g)
"Boy":
$ player, image_tag = Character(kind=b), "boy"
player "Words said by chosen type"
# shows images/boy_happy.png for choice 'boy' else girl_happy.png
show player happy at truecenter
"words"
imagebutton .... action [ SetVariable( player, Character(kind=g) ), SetVariable( image_tag, "girl" ) ] should/might steer you on your way
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot]