Code: Select all
image persistent.girl = DynamicDisplayable(draw_girl)
Code: Select all
$ persistent.girl = girl
$ persistent.girl = girl
$ renpy.save_persistent()
Code: Select all
image persistent.girl = DynamicDisplayable(draw_girl)
Code: Select all
$ persistent.girl = girl
$ persistent.girl = girl
$ renpy.save_persistent()
You might need to explain a bit more clearly what it is you want to do.beastcarving wrote: ↑Wed Apr 15, 2020 4:27 pm I've been trying to add persistentdata to may customizable image that I'm using to show and my menus. Can someone show me what I'm going wrong here because none of what I'm doing here is working?Code: Select all
image persistent.girl = DynamicDisplayable(draw_girl)
Code: Select all
$ persistent.girl = girl $ persistent.girl = girl $ renpy.save_persistent()
Code: Select all
init python:
dressup_show = False
dressup_button_show = False
skin, glasses, dress, hair = 1, 2, 2, 2 # default dressup items
skin_styles_num, glasses_styles_num, dress_styles_num, hair_styles_num = 2, 3, 4, 2 # number of styles (files) for each dressup item
def draw_girl(st, at):# same thing as above, just scaled and positioned for the sideimage; there's probably more elegant solution than this...
return LiveComposite(
(0, 0),
(0, 0), im.FactorScale("base.png", 1.5, 1.5),
(80, 468), im.FactorScale("skin%d.png"%skin, 1.5, 1.5),
(80, 468), im.FactorScale("dress%d.png"%dress, 1.5, 1.5),
(80, 468), im.FactorScale("hair%d.png"%hair, 1.5, 1.5),
(80, 468), im.FactorScale("glasses%d.png"%glasses, 1.5, 1.5)
),.1
init:
image girl = DynamicDisplayable(draw_girl) # using DynamicDisplayable ensures that any changes are visible immedietly
$ girl = Character('girl', color="#700a1b", show_two_window=True,show_side_image=DynamicDisplayable(draw_girl_side))
$ persistent.girl == girl
$ renpy.save_persistent()
#########################################################################
screen dressup_button: # a button to call the dressup game
if dressup_button_show and not dressup_show:
imagemap:
idle "dressstart1.png"
hover "dressstart2.png"
hotspot (282, 970, 148, 156) action SetVariable("dressup_show", True)
#########################################################################
screen dressup:
if dressup_show:
add "girl" xalign 0 yalign 0 xpos 0
python:
hair_n = hair + 1 # if next hair is chosen
hair_p = hair - 1 # if previous hair is chosen
if hair_p < 1: # making sure we don't get out of index range (index 0 is not allowed)
hair_p = hair_styles_num
if hair_n > hair_styles_num: # making sure we don't get out of index range (index musn't be bigger than hair_styles_num)
hair_n = 1
glasses_n = glasses + 1
glasses_p = glasses - 1
if glasses_p < 1:
glasses_p = glasses_styles_num
if glasses_n > glasses_styles_num:
glasses_n = 1
dress_n = dress + 1
dress_p = dress - 1
if dress_p < 1:
dress_p = dress_styles_num
if dress_n > dress_styles_num:
dress_n = 1
skin_n = skin + 1
skin_p = skin - 1
if skin_p < 1:
skin_p = skin_styles_num
if skin_n > skin_styles_num:
skin_n = 1
y = 90
ui.imagebutton("arrowL.png", "arrowL.png", clicked=SetVariable("hair", hair_p), ypos=y, xpos=10)
y += 180
ui.imagebutton("arrowL.png", "arrowL.png", clicked=SetVariable("glasses", glasses_p), ypos=y, xpos=10)
y += 180
ui.imagebutton("arrowL.png", "arrowL.png", clicked=SetVariable("dress", dress_p), ypos=90, xpos=190)
y += 180
ui.imagebutton("arrowL.png", "arrowL.png", clicked=SetVariable("skin", skin_p), ypos=270, xpos=190)
textbutton ("Done") action ShowMenu ("main_menu")
Code: Select all
init:
image girl = DynamicDisplayable(draw_girl) # using DynamicDisplayable ensures that any changes are visible immedietly
$ girl = Character('girl', color="#700a1b", show_two_window=True,show_side_image=DynamicDisplayable(draw_girl_side))
$ persistent.girl == girl
$ renpy.save_persistent()
There are some things in your code I don't get but, howeverbeastcarving wrote: ↑Thu Apr 16, 2020 4:54 am I've made a dress-up screen where you can choose a custom look for your character.
------
I'm having trouble making this custom character remembered after you close and reopen the game. Right now, I'll put a red dress on the customizable characters, and when I'm done dressing her, she will appear on the menu in the red dress as I want, but after I press play on the game or exit the game, the character shown on the menu will go back to a default gray dress, as if she were never customized in the first place.
The custom character is shown on the menu, so you can't save the progress after dressing her.
I'm mainly trying to define this character image "girl" by adding persistent.data in order to finalize how the player chooses to dress their avatar/pov character when closing the game and reopening.
This is the part I'm trying to work on:
Code: Select all
init: image girl = DynamicDisplayable(draw_girl) # using DynamicDisplayable ensures that any changes are visible immedietly $ girl = Character('girl', color="#700a1b", show_two_window=True,show_side_image=DynamicDisplayable(draw_girl_side)) $ persistent.girl == girl $ renpy.save_persistent()
Code: Select all
label start:
if not persistent.attributList:
$ attList=[0,1,2,3]
else:
$ attList=persistent.attributList
"[attList[0]],[attList[1]],[attList[2]],[attList[3]]"
$ attList[0]= renpy.input("Set value 1")
$ attList[1]= renpy.input("Set value 2")
$ attList[2]= renpy.input("Set value 3")
$ attList[3]= renpy.input("Set value 4")
$ persistent.attributList = attList
$ renpy.save_persistent()
jump start
Code: Select all
def draw_girl(st, at): #Scales, positioned, and combine the dressup items into one displayable
return LiveComposite(
(0, 0),
(0, 0), im.FactorScale("base.png", 1.5, 1.5),
(80, 468), im.FactorScale("skin%d.png"%skin, 1.5, 1.5),
(80, 468), im.FactorScale("dress%d.png"%dress, 1.5, 1.5),
(80, 468), im.FactorScale("hair%d.png"%hair, 1.5, 1.5),
(80, 468), im.FactorScale("glasses%d.png"%glasses, 1.5, 1.5)
),.1
draw_girl might be what I should add persistent data. I'm having a hard time going about that though.def draw_girl(st, at)
Code: Select all
if not persistent.attributList:
$ girl=[0,1,2,3]
else:
$ girl=persistent.attributList
"[attList[0]],[attList[1]],[attList[2]],[attList[3]]"
$ girl[0]= (skin)
$ girl[1]= (glasses)
$ girl[2]= (dress)
$ girl[3]= (hair)
$ persistent.attributList = girl
$ renpy.save_persistent()
return
Ok. The linebeastcarving wrote: ↑Fri Apr 17, 2020 5:49 am Basicly, this is used the group the image items as one displayable image:soCode: Select all
def draw_girl(st, at): #Scales, positioned, and combine the dressup items into one displayable return LiveComposite( (0, 0), (0, 0), im.FactorScale("base.png", 1.5, 1.5), (80, 468), im.FactorScale("skin%d.png"%skin, 1.5, 1.5), (80, 468), im.FactorScale("dress%d.png"%dress, 1.5, 1.5), (80, 468), im.FactorScale("hair%d.png"%hair, 1.5, 1.5), (80, 468), im.FactorScale("glasses%d.png"%glasses, 1.5, 1.5) ),.1
draw_girl might be what I should add persistent data. I'm having a hard time going about that though.def draw_girl(st, at)
...................................................
With your code, I've done this:It remembers the set values, but doesn't actually remember the image items in a visual way, so the character's appearance remains unsaved, but not the values selected.Code: Select all
if not persistent.attributList: $ girl=[0,1,2,3] else: $ girl=persistent.attributList "[attList[0]],[attList[1]],[attList[2]],[attList[3]]" $ girl[0]= (skin) $ girl[1]= (glasses) $ girl[2]= (dress) $ girl[3]= (hair) $ persistent.attributList = girl $ renpy.save_persistent() return
Code: Select all
default persistent.dDress = { "skin" : 1, "glasses" : 2, "dress" : 2, "hair" : 2 }
init python:
def draw_girl(st, at):
return LiveComposite(
(0, 0),
(0, 0), im.FactorScale('base.png', 1.5, 1.5),
(0, 0), im.FactorScale( 'skin{}.png'.format(persistent.dDress['skin']), 1.5, 1.5 ),
(0, 0), im.FactorScale( 'dress{}.png'.format(persistent.dDress['skin']), 1.5, 1.5 ),
(0, 0), im.FactorScale( 'hair{}.png'.format(persistent.dDress['hair']), 1.5, 1.5 ),
(0, 0), im.FactorScale( 'glasses{}.png'.format(persistent.dDress['glasses']), 1.5, 1.5 )
), .1
image girl = DynamicDisplayable(draw_girl)
screen dressup():
add 'girl' align (0, 0)
## other stuff here ##
hbox:
textbutton "<" action SetDict(persistent.dDress, 'skin', persistent.dDress['skin'] - 1)
text "Skin"
textbutton ">" action SetDict(persistent.dDress, 'skin', persistent.dDress['skin'] + 1)
##etc...
Code: Select all
init python:
class DressUp(Action):
def __init__(self, dict, key, value, max):
self.dict = dict
self.key = key
self.value = value
self.max = max
def __call__(self):
value = self.dict[self.key] + self.value
if value < 1:
value = self.max
elif value > self.max:
value = 1
self.dict[self.key] = value
renpy.restart_interaction()
screen dressing():
add 'girl' align (0.0, 0.0)
hbox:
textbutton "<" action DressUp(persistent.dDress, 'skin', -1, 2)
text "Skin"
textbutton ">" action SetDict(persistent.dDress, 'skin', 1, 2)
Code: Select all
define persistent.dDress = { "skin" : {"skin1", "skin2", "skin3"}, "glasses" : 3, "dress" : 4, "hair" : 2 }
Code: Select all
screen dressing():
imagemap:
ground "10white.jpg"
add 'girl' xalign 0 ypos 468 xpos 120
if persistent.dressup =="skin1":
add "face2.png" ypos 468 xpos 120 zoom 1.5
elif persistent.dressup =="skin2":
add "face1.png" ypos 468 xpos 120 zoom 1.5
elif persistent.dressup =="skin3":
add "face3.png" ypos 468 xpos 120 zoom 1.5
Users browsing this forum: Andredron