Dynamic way to add videos need HELP
Posted: Mon Nov 11, 2019 6:43 pm
Hello everybody!
I have a big problem with my game. I made a random npc generator wich is working fine. I try to add videos depends on the characters but I can not make it to work. The characters randomly generated with hair color, body type and skin color. I using dynamic images for these generated characters. I tried the same way with the videos but no luck. I hope somebody can help me.
Thank You!
This is how the generator is working:
Here is the code when I tried to add a video. I have videos for each variation so i want to play the right video wich is fit for the generated character.
I tried diffferent ways but all of them was faulty. It is keep saying the video not found.
I hope it is clear. I just want to know the way I can add the videos like the dynamic images.
Thanks Again!
I have a big problem with my game. I made a random npc generator wich is working fine. I try to add videos depends on the characters but I can not make it to work. The characters randomly generated with hair color, body type and skin color. I using dynamic images for these generated characters. I tried the same way with the videos but no luck. I hope somebody can help me.
Thank You!
This is how the generator is working:
Code: Select all
init python:
class RandomNPCf():
def __init__(self, namelistf):
self.name = renpy.random.choice(namelistf)
self.hairtext = "black"
self.bodytype = "skinny"
self.bodycolor = "white"
self.sextype = renpy.random.choice(sextypelistf)
self.trait = renpy.random.choice(traitlist)
portrait1f="black.jpg"
portrait2f="black.jpg"
portrait3f="black.jpg"
center1f="black.jpg"
center2f="black.jpg"
center3f="black.jpg"
define randnamelistf = ["Eva", "Emma", "Violet", "Tina", "Juliet", "Olivia", "Mia", "Zoey", "Eleanor", "Rylee", "Mary", "Harmony", "Leila", "Ember"]
define hairlist = ["red", "black", "blonde", "brunette"]
define bodytypelist = ["skinny", "average", "chubby"]
define bodycolorlist = ["white", "tanned", "black"]
define randchar1f = RandomNPCf(randnamelistf)
define randchar2f = RandomNPCf(randnamelistf)
define randchar3f = RandomNPCf(randnamelistf)
define rc1f = Character("[randchar1f.name]", image="randchar1f")
define rc2f = Character("[randchar2f.name]", image="randchar2f")
define rc3f = Character("[randchar3f.name]", image="randchar3f")
image randchar1f center = "[center1f]"
image randchar2f center = "[center2f]"
image randchar3f center = "[center3f]"
label start:
$ i=0
while i<3:
if len(hairlist)==0:
$ hairlist = ["red", "black", "blonde", "brunette"]
$ hair = renpy.random.randint(0, len(hairlist)-1)
$ hairtext = hairlist.pop(hair)
if len(bodytypelist)==0:
$ bodytypelist = ["skinny", "average", "chubby"]
$ btype = renpy.random.randint(0, len(bodytypelist)-1)
$ bodytype = bodytypelist.pop(btype)
if len(bodycolorlist)==0:
$ bodycolorlist = ["white", "tanned", "black"]
$ bcolor = renpy.random.randint(0, len(bodycolorlist)-1)
$ bodycolor = bodycolorlist.pop(bcolor)
if i==0:
$ randchar1f.hairtext=hairtext
$ randchar1f.bodytype=bodytype
$ randchar1f.bodycolor=bodycolor
$ randompics = renpy.random.randint(1, 3)
if randompics == 1:
$ portrait1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1p.png"
$ center1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1.png"
elif randompics == 2:
$ portrait1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2p.png"
$ center1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2.png"
elif randompics == 3:
$ portrait1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3p.png"
$ center1f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3.png"
elif i==1:
$ randchar2f.hairtext=hairtext
$ randchar2f.bodytype=bodytype
$ randchar2f.bodycolor=bodycolor
$ randompics = renpy.random.randint(1, 3)
if randompics == 1:
$ portrait2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1p.png"
$ center2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1.png"
elif randompics == 2:
$ portrait2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2p.png"
$ center2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2.png"
elif randompics == 3:
$ portrait2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3p.png"
$ center2f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3.png"
elif i==2:
$ randchar3f.hairtext=hairtext
$ randchar3f.bodytype=bodytype
$ randchar3f.bodycolor=bodycolor
$ randompics = renpy.random.randint(1, 3)
if randompics == 1:
$ portrait3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1p.png"
$ center3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "1.png"
elif randompics == 2:
$ portrait3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2p.png"
$ center3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "2.png"
elif randompics == 3:
$ portrait3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3p.png"
$ center3f= "images/npc/female/" + hairtext + "/" + bodytype + "/" + bodycolor + "3.png"
$ i +=1
# My game start from here. This code above is working perfectly. It is choosing the images fine from the folders depends on the stats.
I tried diffferent ways but all of them was faulty. It is keep saying the video not found.
Code: Select all
# THIS IS THE FIRST VERSION WICH I TRIED:
image randchar1_dance = Movie(play="[rc1dance]", xalign=0.5, yalign=0.2)
label club:
$ rc1dance = "images/npc/female/" + randchar1f.hairtext + "/" + randchar1f.bodytype + "/" + randchar1f.bodycolor + "/dance.webm"
call screen rc1dance:
add "randchar1_dance"
text "[randchar1f.name] - You are a great dancer."
vbox xpos 1600 ypos 100:
textbutton "Leave" action Jump("map")
# THIS IS THE SECOND VERSION WICH I TRIED:
image randchar1_dance = Movie(play="[rc1dance]", xalign=0.5, yalign=0.2)
label club:
$ rc1dance = "images/npc/female/" + "[randchar1f.hairtext]" + "/" + "[randchar1f.bodytype]" + "/" + "[randchar1f.bodycolor]" + "/dance.webm"
call screen rc1dance:
add "randchar1_dance"
text "[randchar1f.name] - You are a great dancer."
vbox xpos 1600 ypos 100:
textbutton "Leave" action Jump("map")
# THIS IS THE THIRD VERSION WICH I TRIED:
image randchar1_dance = Movie(play="[rc1dance]", xalign=0.5, yalign=0.2)
label club:
$ rc1dance = "images/npc/female/[randchar1f.hairtext]/[randchar1f.bodytype]/[randchar1f.bodycolor]/dance.webm"
call screen rc1dance:
add "randchar1_dance"
text "[randchar1f.name] - You are a great dancer."
vbox xpos 1600 ypos 100:
textbutton "Leave" action Jump("map")
Thanks Again!