conditional image and variable

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
Vandaris
Newbie
Posts: 2
Joined: Fri Oct 26, 2018 11:24 am
Organization: Silvester-Project
Github: vandaris
Location: Bandung
Contact:

conditional image and variable

#1 Post by Vandaris »

hey all...
i want to ask something
on my VN, i have 4 girl to have ending (whatever it good or bad). then, i want put love image or symbol at left side of character name and then, every time the variable change (the variable increase is from choices) the love image or symbol is changed colour. maybe smiliar as harvest moon dialouge style. please help me. :cry: :cry:

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

Re: conditional image and variable

#2 Post by Kia »

you can edit the character's name using: $ girl1.name = "♥ Aiko"
an maybe few text tags for coloring

User avatar
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: conditional image and variable

#3 Post by Milkymalk »

Use a variable reference as the name and change the variable, as seen here: viewtopic.php?f=8&t=56009&p=514661#p514694

Another option, though more complicated, would be to edit the speech boxes, but that's only necessary if you have changeable names and want to use the variable contents in instances where the ♥ is not wanted.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Vandaris
Newbie
Posts: 2
Joined: Fri Oct 26, 2018 11:24 am
Organization: Silvester-Project
Github: vandaris
Location: Bandung
Contact:

Re: conditional image and variable

#4 Post by Vandaris »

ok guys. im inspire.
how can i replace name colour.
for example,
if affection poin = 0, the name colour is black
if affection poin = 1, the name colour is blue
if affection poin = 2, the name colour is green
etc. owh sorry im really new here

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: conditional image and variable

#5 Post by Crazy Li »

The easiest way is to probably make multiple character definitions for each color (like if the character's name was sue, you could have sue1, sue2, and sue3) and then when it's time to show the dialog, have an if check on the value of the affection variable and pick the appropriate character. Something like

Code: Select all

$ sue1 = Character("Sue", color="#000000")
$ sue2 = Character("Sue", color="#0000FF")
$ sue3 = Character("Sue", color="#008000")

#check affection level
if affection == 0:
    sue1 "I don't like you."
elif affection == 1:
    sue2 "You're okay."
else:
    sue3 "I love you!"
basic, barebones idea anyway.

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

Re: conditional image and variable

#6 Post by Kia »

Vandaris wrote: Sun Jul 14, 2019 11:49 amhow can i replace name colour.
there are two main approaches, one by editing the character:

Code: Select all

$ girl.color = "#f00"
or by editing the say screen in the screens.rpy. this one requires a bit more knowledge about screens and styles.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot]