Page 1 of 1

Need help with character avatar choices

Posted: Fri Dec 13, 2019 2:25 pm
by daaes
so, i dont know how to easily explain this so a quick ramble incoming:

i want to let the player choose their appearance between two preset choices, and i want to have that in a side image like this:
(ignore the assets, theyre all a placeholders)
https://i.gyazo.com/063aef43d894fb89c8c ... cb7756.jpg

i want to be able to change the expressions, and theres only going to be two preset choices. i have no idea where to even start with this, i have the character selection layout all done, but the part that's tripping me up is how to make the choice between the masc player character and the fem one stick, and be able to change between expressions as i normally would with a side image. i tried to look up others doing something similar to this, that had made tutorials or posted the code that i could learn from, but i wasnt able to find anything. i feel like itll be a really simple fix but im still fairly new to renpy
also with the images, i havent even tried to add the second choice placeholders because i wasnt sure where to start with this so i havent put them together yet. i also wasn't 100% if the code was needed or not, because all of this works but i need to know where to go going forward from here.


in script.rpy:
# Character points
$ mascPoints = 0
$ femPoints = 0

screen charselscreen:
zorder 100

imagemap:
ground "ground"
idle "idle"
hover "hover"
hotspot (1122, 168, 572, 911) action SetVariable("mascPoints", mascPoints + 1), Return()
hotspot (501, 164, 568, 912) action SetVariable("femPoints", femPoints + 1), Return()

label chrsel:
show bg street with dissolve
"Who are you?"
$ renpy.call_screen("charselscreen")

if mascPoints ==1:
"I see! What's your name?"
$ yn = renpy.input("I see! What's your name?")
$ yn = yn.title()
$ yn = yn.strip()
if yn == "":
$ yn = "Penn"

if femPoints ==1:
"I see! What's your name?"
$ yn = renpy.input("I see! What's your name?")
$ yn = yn.title()
$ yn = yn.strip()
if yn == "":
$ yn = "Penny"


in a custom images.rpy:

image side yn smiling:
"/images/yn smiling.png"
size(484,667)

image side yn fearful:
"images/yn fearful.png"
size(484,667)


image side yn uncomfortable:
"images/yn uncomfortable.png"
size(484,667)

Re: Need help with character avatar choices

Posted: Sat Dec 14, 2019 1:36 pm
by Per K Grok
daaes wrote: Fri Dec 13, 2019 2:25 pm so, i dont know how to easily explain this so a quick ramble incoming:

i want to let the player choose their appearance between two preset choices, and i want to have that in a side image like this:
(ignore the assets, theyre all a placeholders)
https://i.gyazo.com/063aef43d894fb89c8c ... cb7756.jpg

i want to be able to change the expressions, and theres only going to be two preset choices. i have no idea where to even start with this, i have the character selection layout all done, but the part that's tripping me up is how to make the choice between the masc player character and the fem one stick, and be able to change between expressions as i normally would with a side image. i tried to look up others doing something similar to this, that had made tutorials or posted the code that i could learn from, but i wasnt able to find anything. i feel like itll be a really simple fix but im still fairly new to renpy
also with the images, i havent even tried to add the second choice placeholders because i wasnt sure where to start with this so i havent put them together yet. i also wasn't 100% if the code was needed or not, because all of this works but i need to know where to go going forward from here.

----


I would suggest that you define 2 player characters.

define mc = Character("[name]", image="mi")
define fc = Character("[name]", image="fi")

image side mi="side_mc.png"
image side fi="side_fc.png"

default gender= "n"

In the part where the player chose which character you set the variable gender to "m" or "f" and set name to the player characters name.

In the game you can then set things up as follows.

Code: Select all


if gender=="m":
    mc "It is I,[name]. "
elif gender=="f":
    fc "It is I,[name]. "