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=0, name=default_var,species=default_var, age=default_var, birthday=default_var, trade=default_var, hobby=default_var, likes=default_var, dislikes=default_var, description=default_var, motto=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.species = species
self.age = age
self.birthday = birthday
self.trade = trade
self.hobby = hobby
self.likes = likes
self.dislikes = dislikes
self.description = description
self.motto = motto
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.
$ Millicent = char(
name="Milli",
species="Nope",
age="-",
birthday="-",
trade="Clothier",
hobby="-",
likes="bob",
dislikes="unknown",
description="Friendly & bubbly",
motto="Giggles.",
dateable=False,
pic="c/Milli/millichibi.png"
)
$ Adam = char(
name="Milli",
species="Nope",
age="-",
birthday="-",
trade="Clothier",
hobby="-",
likes="bob",
dislikes="unknown",
description="Friendly & bubbly",
motto="Giggles.",
dateable=True,
pic="c/Milli/millichibi.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
$ species = "Species: " + char.species
$ trade = "Trade: " + char.trade
$ age = "Age: " + char.age
$ birthday = "Date of Birth: " + char.birthday
$ hobby = "Hobby: " + char.hobby
$ likes = "Likes: " + char.likes
$ dislikes = "Dislikes: " + char.dislikes
$ description = char.description
$ motto = "Motto: \n \"" + char.motto + "\""
$ 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 species
if trade != 'Trad: ???':
text trade
text age
text birthday
text hobby
vbox xmaximum 500:
text likes
text dislikes
vbox spacing 10 xmaximum 490:
text description
text motto
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
While running game code:
File "renpy/common/_layout/screen_main_menu.rpym", line 11, in script
File "game/CharProfiles.rpy", line 79, in python
AttributeError: char instance has no attribute 'species'
Code: Select all
$ species = "Species: " + char.species