Ren'Py Question: Strange Effect using layeredimage in Mod

srksrk 68

Forum Fanatic
Modder
Sep 17, 2018
4,392
5,606
Hello Ren'py, Python or Unren Gurus,

(I hope this is the right forum to ask for help. If not, please some Mod move it where it belongs.)

I posted it here before, but I was pointed to this forum to ask the question here. So here it comes...

I have a clean unmodified installation of game Summertime Saga v0.19.1 and try to mod it. First problem was to find the right tool to extract sources and images, because the game makes massive use of new Ren'py 7.3 features which are not fully supported by unren.bat or un.rpyc. I do not quite remember which tool I used to get it right (maybe a combination of latest un.rpyc and unren-dev-0.0.bat), and there have been things that needed manual fixing, but finally it runs. Kind of. This is probably not the issue here, just for your information.

Problem (apart from the known stuff like some line indentations being wrong) is that, once everything is working and the game running, some layered images do not work as expected. For instance, the game has an automatic talk recognition, meaning that when a character is shown with a face attribute like e.g. "f_smile", then this is replaced automatically with something like "f_smile_talk" when he says something.

Now this works as long as both images are physically available. In some cases, the game provides only the non-talking face image, and in this case even when the char is talking, the non-talking variant is shown.

This would be achieved by an image statement like

Code:
renpy.image("grace_face_talk_f_thinking", "grace_face_f_thinking")
where the file is named "grace_face_f_thinking.png" in the images directory, and "grace_face_talk_f_thinking.png" is not available physically.

What I do not understand is that some talk variants of faces are neither existing on disk in the image directory, nor is there such an image statement. Nevertheless, in the unextracted game it works, but not any longer as soon as the game files are extracted. In that case, a blank face is shown.

In this example, there is the file "<summertime saga>\game\scripts\characters\eve\button_dialogues.rpy" extracted from the source, and this contains the lines

Code:
    grace f_thinking "Hmm."
    pause
Now the unmodded game automatically chooses to display "grace_face_f_thinking.png" for both the "Hmm." and the pause, because "grace_face_talk_f_thinking.png", which would normally be displayed during grace talking, is mapped to "grace_face_f_thinking.png" by the renpy.image statement.

At least, this is what I would expect. Fact is that there is neither the physical image nor the image mapping statement in the extracted sources. And consequently, in the modded game (modded only in the sense that the extracted but unmodified rpy file is present), the face is not shown when grace is talking. My question now is how this is possible?

This is easily reproduced by providing or not providing the extracted "<summertime saga>\game\scripts\characters\eve\button_dialogues.rpy". If it is present, the error occurs, otherwise not -- even though that file is not modified at all, it comes as it is originally extracted from the rpa files.

Has anybody an explanation for this? I know this is a difficult problem. However, I attach the saves (one for the rpy file present, the other one for the unmodded game) and the source in question here. I hope a guru finds the time to enlighten me ;)

What I should mention is that I fixed this issue for me whith the following coding piece, which maybe someone mind find useful. It scans all known images and creates a mapping from the missing talk variants to the non-talking ones, if the talk variant is not physically available. Maybe the unmodded game has something similar in place, but it is not extracted for some reason...

Code:
init -999 python:

    old_scan_images_directory = _scan_images_directory

    def my_scan_images_directory():
        old_scan_images_directory()
        for i in renpy.list_images():
            if i.find('_face_') > 0 and i.find('_talk_f_') < 0 and i.find('_f_') > 0:
                b = i.split('_f_', 1)
                j = b[0] + '_talk_f_' + b[1]
                if not renpy.has_image(j):
                    renpy.image(j, i)
  
    _scan_images_directory = my_scan_images_directory
 
Last edited: