This code was designed to be easily changed throughout the span of the game to reflect new information on a character as you learn it or unlock things.
The only thing wrong with the code is that changes do not reset at the end of each playthrough, but they will reset when you turn off and then on again. If anyone could figure out how to fix that without jumping through a lot of hoops, it'd be much appreciated :3 Anyways, how to get this to work.
To use, it requires new .rpy files and altering of one of the existing ones. Before anything else, find "# Quick Menu" in your screens.rpy and see where all textbuttons are being defined. Wherever you want to put it, insert this line of code:
Code: Select all
textbutton _("Info") action ShowMenu("profile_screen")
Code: Select all
init python:
xmax = config.screen_width
ymax = config.screen_height
init -2 python:
#declares a new style called "infoscreen"
style.infoscreen = Style(style.default)
style.infoscreen_text.size = 24
style.infoscreen_window.background = "infoscreenBG.png" #<-- This puts a custom background in the area that displays the text and picture
style.infoscreen_frame.background = Frame("box.png", 10, 10) #<--same as above, but in the area that displays the buttons
style.infoscreen_button.idle_background = Frame("box2.png", 10, 10)
style.infoscreen_button.hover_background = Frame("box3.png", 10, 10)
style.infoscreen_button_text.idle_color = "FF731C"
style.infoscreen_button_text.hover_color = "FF731C"
style.infoscreen_button_text.selected_color = "#F00"
style.infoscreen_button.top_padding = 5
style.infoscreen_button.bottom_padding = 5
style.infoscreen_bar.left_bar = "bar_full-checks.png"
style.infoscreen_bar.right_bar = "bar_empty-checks.png"
style.infoscreen_bar.xmaximum = 209
style.infoscreen_bar.ymaximum = 34
style.infoscreen_bar.right_gutter = 0
style.infoscreen_bar.left_gutter = 0
style.infoscreen_bar.thumb = None
Code: Select all
init python:
# declares a class called 'char'
default_var = '???'
class char:
#--------------------------VV--------if you want to change how much affection they start with
def __init__(self, affection=50, name=default_var, bloodType=default_var, major=default_var, age=default_var, birthday=default_var, sign=default_var, likes=default_var, dislikes=default_var, description=default_var, currentThoughts=default_var, dateable=True, pic='none'): #<-- this line sets all the defaults; the only one you'll probably use
self.affection=affection
self.name = name
self.bloodType = bloodType
self.major = major
self.age = age
self.birthday = birthday
self.sign = sign
self.likes = likes
self.dislikes = dislikes
self.description = description
self.currentThoughts = currentThoughts
self.dateable=dateable
self.pic=pic
#You can add more areas if you want, just put self. and whatever it is you need
def add_affection(self, amount):
self.affection += amount
if self.affection > affectionMax:
self.affection = affectionMax
def normalize(self):
if self.affection > affectionMax:
self.affection = affectionMax
if self.affection < 0:
self.affection = 0
init:
#declare all the characters here, use the following format. Add as many as you want or need.
$ girl = char(
name="Girl",
bloodType="A",
major="N/A",
age="16",
birthday="Everyday",
sign="Nope",
likes="Pizza",
dislikes="Tacos",
description="Your neighbor.",
currentThoughts="I really want pizza.",
dateable=False,
pic="girl a 1.png"
)
$ boy = char(
name="Boy",
bloodType="AB",
major="N/A",
age="17",
birthday="February 31",
sign="Meh",
likes="Tacos",
dislikes="Pizza",
description="Your best bud.",
currentThoughts="I really want tacos.",
dateable=False,
pic="b1.png"
)
#these are the characters shown on the screen, you can add more as you meet new people
$ allchars = [girl, boy]
$ affectionMax = 100 #<-- maximum affection value is changed here
$ show_profiles = False
$ viewing = "Girl" #<-- the default character to show when the info screen is first called
screen profile_screen:
tag menu
zorder 10
# creates a string for proper display of each fact (+some bars)
for i in allchars:
$ char = i
if viewing == char.name:
$ name = "Name: " + char.name
$ bloodType = "Blood Type: " + char.bloodType
$ major = "Major: " + char.major
$ age = "Age: " + char.age
$ birthday = "Date of Birth: " + char.birthday
$ sign = "Sign: " + char.sign
$ likes = "Likes: " + char.likes
$ dislikes = "Dislikes: " + char.dislikes
$ description = char.description
$ thoughts = "Current Thoughts: \n \"" + char.currentThoughts + "\""
$ pic = char.pic
#if char == main: ##For the main character
#$ affectionBar = False
#$ friendshipBar = False
if char.dateable: ##If you define the main character, change this statement to elif
$ affectionBar = True
$ friendshipBar = False
else:
$ affectionBar = False
$ friendshipBar = True
$ affection = char.affection
#actually displays everything
frame xminimum 240 xmaximum 240 yminimum ymax:
style_group "infoscreen"
vbox yalign 0.5 xalign 0.5:
for i in allchars:
#$ textbutton_name, dummy1, dummy2 = i.name.partition(' ') #cuts off the name after the first space
textbutton i.name action SetVariable("viewing", i.name) xminimum 220 xmaximum 220 yminimum 50
#code for future imagebuttons
#imagebutton idle "i.idlepic" hover "i.hoverpic" action SetVariable("viewing", i.name)
$ i.normalize()
textbutton "Return" action Return() ypos 0.8
window xanchor 0 xpos 240 yalign 0 xminimum 784 xmaximum 784 yminimum ymax ymaximum ymax:
style_group "infoscreen"
vbox spacing 10:
vbox:
text name
text bloodType
if major != 'Major: ???':
text major
text age
text birthday
text sign
vbox xmaximum 500:
text likes
text dislikes
vbox spacing 10 xmaximum 490:
text description
text thoughts
hbox ypos 0.7:
if affectionBar:
text "Love:"
bar value affection range affectionMax style "infoscreen_bar" right_bar "bar_empty-pink.png" left_bar "bar_full-pink.png"
if friendshipBar:
text "Relationship:"
bar value affection range affectionMax style "infoscreen_bar"
if pic != 'none':
add pic xalign 0.6 yalign 0.0 #Tinker with these numbers as needed to change where the image goes
Here's how you'd use it in the script:
Code: Select all
label start:
scene bg
show girl 1 at left
show boy 1 at right
"One upon a time you and your friends had a party."
g "I want pizza."
b "I want tacos."
g "Oh wow no pizza FTW sheesh."
"What will you order for dinner?"
menu:
"Pizza":
show girl 3 at left
show boy 2 at right
$ boy.pic = "b2.png"
$ girl.pic = "girl a 3.png"
$ boy.major = "Pain"
$ girl.currentThoughts=("AW YIS PIZZA.")
$ girl.affection += 200
$ boy.currentThoughts=("I hate life.")
$ boy.affection -= 200
g "YEHHHHHHH"
b "Oh wow player we cannot be friends anymore I hate you."
"Tacos":
show girl 2 at left
show boy 6 at right
$ boy.pic = "b6.png"
$ girl.pic = "girl a 2.png"
$ girl.major = "Pain"
$ boy.currentThoughts=("AW YIS TACOS.")
$ boy.affection += 200
$ girl.currentThoughts=("I hate life.")
$ girl.affection -= 200
b "YEHHHHHHH"
g "Oh wow player we cannot be friends anymore I hate you."
return
Attached to the end of the post is an example source code for this. Download it, explore the code, and have fun! The background was taken and filtered by Celianna, found in this thread.