Need help with character avatar choices

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
daaes
Newbie
Posts: 4
Joined: Fri Dec 13, 2019 2:05 pm
Contact:

Need help with character avatar choices

#1 Post by daaes » 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.


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)

User avatar
Per K Grok
Miko-Class Veteran
Posts: 674
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
itch: per-k-grok
Location: Sverige
Contact:

Re: Need help with character avatar choices

#2 Post by Per K Grok » Sat Dec 14, 2019 1:36 pm

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]. "


Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]