Howdy everybody! A friend of mine has been giving it his all making a Ren'Py system for a super in depth game recently. But he's ran into a wall I want to help him with.
The objective is to make a variable name that displays a side image for the name currently filling that variable.
Whenever a character speaks their side image is suppose to appear, however with the code (detailed below) this image does not appear when the name is a variable rather than a specific value. I.E. If the name called upon is: Amanda. It shows up great. But if it's a variable that is equal to Amanda, no dice. Thank you all for your time.
label start:
#Defining Amanda & Side Image
define Amanda = Character("Amanda", window_left_padding=165, image="Amanda")
image side Amanda = im.FactorScale("side_Amanda.png", 0.5, 0.5)
#Designating Neutral Variable
$ name = "Amanda"
#Displays Side Image Properly
Amanda "Hello"
#Does Not Display Side Image
name "Hello"
#Displays Side Image Properly
Amanda "Hello"
return
Side Images Not Appearing With Variable Styled Names!
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.
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Side Images Not Appearing With Variable Styled Names!
put theses above label start
Code: Select all
define Amanda = Character("Amanda", window_left_padding=165, image="Amanda")
image side Amanda = im.FactorScale("side_Amanda.png", 0.5, 0.5)
Re: Side Images Not Appearing With Variable Styled Names!
This happened 'cause you can show some text without declaring a character first, like
So,assigns the text value to variable 'name'.
Andjust shows "Hello" by undeclared character with name stored in variable 'name'.
Try
Code: Select all
"some_name" "Heloo..."
Code: Select all
$ name = "Amanda"
And
Code: Select all
name "Hello"
Try
Code: Select all
$ name = Amanda # pre-defined character without quotes
Re: Side Images Not Appearing With Variable Styled Names!
As alex said, what you want is to actually store the character in the variable, not the name. If there’s a reason you need go bring up a character by the name as string for any reason, then you may want to use a dict. After you’ve setup the Amanda character:
That should work because npc[“Amanda”] is the Amanda character.
Code: Select all
npc = {“Amanda”: Amanda}
$ name = “Amanda”
npc[name] “hello world”
Re: Side Images Not Appearing With Variable Styled Names!
Thanks everybody! You replied super fast and were able to help out. My friend was skeptical, but your solution did solve his problem Alex! All of you have an awesome day.
Who is online
Users browsing this forum: Bing [Bot]