- Sep 26, 2018
- 3,120
- 3,181
characters at certain time and locations
images name would like so
with minutes mom_12_0_livingroom.png
without minutes mom_12_livingroom.png
this fully working code anyone can use it if they want too
class.rpy (you can remove the minutes so the character stay in that location longer)
character_screen.rpy
default.rpy
images name would like so
with minutes mom_12_0_livingroom.png
without minutes mom_12_livingroom.png
this fully working code anyone can use it if they want too
class.rpy (you can remove the minutes so the character stay in that location longer)
Python:
class NPC(object):
def __init__(self, name, nicename, location, hours, minutes, lbt=""):
self.name = name
self.nicename = nicename
self.location = location
self.hours = hours
self.minutes = minutes
self.lbt = lbt
@property
def avatar(self):
#If you remove the minutes remove one of the {} and remove str(minutes),
avtr = "images/avatar/{}/{}_{}_{}_{}.png".format(self.name, self.nicename, str(hours), str(minutes), location)
if renpy.loadable(avtr):
return avtr
else:
return "images/avatar/empty.png"
character_screen.rpy
Python:
screen charcater_screen():
# remove and q.minutes == minutes if you are planning to remove minutes
for q in NPCS:
if q.location == location and q.hours == hours and q.minutes == minutes:
imagebutton:
idle q.avatar
hover q.avatar
focus_mask True
action Call(q.lbt)
Python:
default lbt = ""
default NPCS = []
default hours = 0
default minutes = 0
#make sure you use call InitialiseVariables
label InitialiseVariables:
#If you remove minutes just remove the minutes out
$ NPCS.append(NPC("mom", "mom", "livingroom", 12, 0, lbt="test"))
#$ NPCS.append(NPC("character_name", "folders name", location", hour, minutes, lbt="label"))
return
Last edited: