Looking for something that will show an additional side image on the opposite side of the text box to show to whom the speaker is talking to.
Additionally, I'm looking for a way to show multiple side images on one side, like if someone is standing directly behind them or a small group is speaking to someone.
A good link will be most helpful here if anything (i struggle with searching with the right question).
I don't think that there's a link for that since it's far do be something basic. Plus, I'm not sure if it would effectively add something to the game, while it will clearly drastically increase the difficulty of the code.
Having a side image is easy, you define the right argument when creating a character. Then Ren'py will do everything else, changing the image in the same time it display a dialog line, accordingly to who's the speaker.
But what you want to do need way more works. Each time a character talk, you'll have to indicate to whom he is talking, or who stand behind him. It's possible do simplify a little your job and avoid having to define the value every single time, but it will still open the gate for many bugs.
All the way to do that rely on a rewriting of the
say screen, what change is the way you want to pass the value. The easiest way is to rely on the
say
arguments :
[Note: code wrote on the fly, there's possibly some issues]
Python:
# You need to define the possible arguments here
screen say( who, what, interlocutor=None, behind=None ):
style_prefix "say"
if what == "":
text what id "what" style "invisible"
else:
window:
id "window"
if who is not None:
window:
style "namebox"
text who id "who"
text what id "what"
if not renpy.variant("small"):
# If an image is defined for the person behind the speaker, display it a little shifted.
if behind:
add behind xalign 1.0 yalign 1.0 xoffset 10 yoffset -10
add SideImage() xalign 0.0 yalign 1.0
# If an image is defined for the interlocutor, display it at the opposite side.
if interlocutor:
add interlocutor xalign 1.0 yalign 1.0
label whatever:
"blablabla"( interlocutor="images/sideimage/mc.jpg" )
"bliblibli"( behind="images/sideimages/otherGirl.jpg" )
"blobloblo"( interlocutor="images/sideimage/mc.jpg", behind="images/sideimages/otherGirl.jpg" )
"blublublu"
After, you can simplify by using a dictionary to store the image, and just pass a keyword in place of the full image :
Code:
define sideImages = { "mc": "images/sideimage/mc.jpg",
"otherGirl": "images/sideimages/otherGirl.jpg" }
screen say( who, what, interlocutor=None, behind=None ):
[...]
if not renpy.variant("small"):
if behind:
add sideImages[behind] xalign 1.0 yalign 1.0 xoffset 10 yoffset -10
add SideImage() xalign 0.0 yalign 1.0
if interlocutor:
add sideImages[interlocutor] xalign 1.0 yalign 1.0
label whatever:
"blablabla"( interlocutor="mc" )
"bliblibli"( behind="otherGirl" )
"blobloblo"( interlocutor="mc", behind="otherGirl" )
"blublublu"
Or "compose" the path to the image in real time:
Code:
screen say( who, what, interlocutor=None, behind=None ):
[...]
if not renpy.variant("small"):
# If an image is defined for the person behind the speaker, display it a little shifted.
if behind:
add ( "images/sideimages/{}.jpg".format( behind ) ) xalign 1.0 yalign 1.0 xoffset 10 yoffset -10
add SideImage() xalign 0.0 yalign 1.0
# If an image is defined for the interlocutor, display it at the opposite side.
if interlocutor:
add ("images/sideimages/{}.jpg".format( interlocutor ) ) xalign 1.0 yalign 1.0
label whatever:
"blablabla"( interlocutor="mc" )
"bliblibli"( behind="otherGirl" )
"blobloblo"( interlocutor="mc", behind="otherGirl" )
"blublublu"
But as I said, all those methods imply that you'll have to add the parameters every single time you'll write a dialog line.
You can avoid this by using external variables to store the information:
Python:
default interlocutor = None
default behind = None
screen say( who, what ):
[...]
if not renpy.variant("small"):
# If an image is defined for the person behind the speaker, display it a little shifted.
if behind:
add ( "images/sideimages/{}.jpg".format( behind ) ) xalign 1.0 yalign 1.0 xoffset 10 yoffset -10
add SideImage() xalign 0.0 yalign 1.0
# If an image is defined for the interlocutor, display it at the opposite side.
if interlocutor:
add ("images/sideimages/{}.jpg".format( interlocutor ) ) xalign 1.0 yalign 1.0
label whatever:
$ interlocutor = "mc"
# MC is seen at the right
"blablabla"
$ behind = "otherGirl"
# MC is still seen at the right, and otherGirl behind
"bliblibli"
$ interlocutor = None
# MC not anymore seen at the right, but otherGirl is still behind
"blobloblo"
$ behind = None
# otherGirl is not anymore seen behind
"blublublu"
While it simplify a little your work, since the same configuration can be used for more than one dialog line, it don't really limit the number of possible bugs.
The "oops, I forgot to change the value" and "oops, I forgot to reset the value", will just replace the lack of "oops, I forgot to define the value".
There's other way to do it, way more advanced, but in the end none of them would effectively simplify the process. You have to explicitly tell what image have to be displayed, and this for almost every single line of dialog.
The only thing that change is the way to tell it, that can possibly be made easier. But as easier as it can be made, it will absolutely not remove the number of possible bugs.
There's already coders that confuse the sayer, making a dialog line being said by the wrong character. Imagine if in top of that you've also to take care of the "interlocutor" and "behind" values...
Therefore, the question is: Is all this really worth it ?
As I said, from my point of view this add nothing to the game. What character is "behind", is already know by looking at the screen. As for "to whom the character is talking", if it's not relatively obvious, then it mean that the dialog line isn't correct.
And in the same time, it complicate the writing of the code, and open the door to an incredibly high number of bugs.