Here is my character class and character info, as well as the conditionals I'm trying to implement:
Code: Select all
init python:
import renpy.store as store
import renpy.exports as renpy
class Chara(store.object):
def __init__(self, name, pronouns, description, meet = False, affection = 0):
#imageName = "",
self.name = name
self.pronouns = pronouns
self.description = description
#self.imageName = "characters/"+ imageName + ".png"
self.meet = meet
self.affection = affection
class CharaList(store.object):
def __init__(self):
self.chara_list = []
def metChara(self, chara):
self.chara_list.append(chara)
def removeChara(self, chara):
self.chara_list.remove(chara)
def hasChara(self, chara):
if chara in self.chara_list:
return True
else:
return False
default metCharacters = CharaList()
# characters
# add proper image names!! otherwise renpy will kick ur ass or smt idk
# example:
# default Name = Chara("name", "pronouns", "description", imageName = "")
default Player = Chara(persistent.player.upper(), "they/them", "It's you.", meet = True)
default Bug = Chara("BUG", "they/them", "Your glitchful guide to the Playgrounds.")
default Clown = Chara("JESTER", "he/him", "A temperamental fallen clown.")
default Creature = Chara("THING", "it/its", "It.. exists.")
default Theo = Chara("THEO", "he/they", "The first.")
default lostsouls = Chara("LOST SOULS", "it/they", "The wanderers of the Playgrounds.")
if lostsouls.affection <= 0:
$lostsouls.description = "The children of the Playgrounds."
elif lostsouls.affection == 5:
$lostsouls.description = "The playful spirits that roam the Playgrounds."
elif lostsouls.affection >= 10:
$lostsouls.description = "They seem to like you."
default selectedCharacter = Player
Code: Select all
screen CharactersUI:
tag charactersUI
add "UI/moon.png"
hbox:
frame:
style_prefix "characters"
ysize 1080
xsize 640
vbox:
xalign 0.5
yalign 0.5
textbutton _(Player.name):
action SetVariable("selectedCharacter", Player)
xsize 640
if metCharacters.hasChara(lostsouls):
textbutton _(lostsouls.name):
action SetVariable("selectedCharacter", lostsouls)
xsize 640
if metCharacters.hasChara(Bug):
textbutton _(Bug.name):
action SetVariable("selectedCharacter", Bug)
xsize 640
if metCharacters.hasChara(Clown):
textbutton _(Clown.name):
action SetVariable("selectedCharacter", Clown)
xsize 640
if metCharacters.hasChara(Creature):
textbutton _(Creature.name):
action SetVariable("selectedCharacter", Creature)
xsize 640
if metCharacters.hasChara(Theo):
textbutton _(Theo.name):
action SetVariable("selectedCharacter", Theo)
xsize 640
textbutton _("Return"):
yalign 0.5
yoffset 90
xoffset 20
action Return()
## Right frame
## Notice that we're using selectedCharacter to show the variables here.
frame:
ysize 1080
xsize 1280
vbox:
xoffset 20
yoffset 20
text "Name: [selectedCharacter.name]"
text "Pronouns: [selectedCharacter.pronouns]"
text "Description: [selectedCharacter.description]"