Ren'Py Changing a scene

iOtero

Active Member
Aug 4, 2020
925
1,459
Hello, everyone, again.

Well, I'll see if I'm lucky enough to get your help again.

As some of you already know, I usually do non-automatic translations of the games into Spanish and, besides that, I like to give them my personal touch.

I'm translating a game in which every time the MC does something wrong, the output is:

Code:
scene gameover
return
That code is not right, I have tried to say it, but as I am not his patron I cannot do it, by other means he does not pay any attention to me. The correct code would be:

Code:
scene gameover
""
return
Because without the "" the game passes the gameover screen without stopping and is not seen.

In all the game outputs it uses that code. And the scene gameover has it defined in its script.rpy like this:

Code:
image gameover = "images/game_over.jpg"
The image game_over.jpg in a simple sign with that phrase GAME OVER, and that seems to me something boring. There aren't many exits from the game and it wouldn't cost me any work to make a custom one indicating why the game is finished, luckily, working with Gimp I like it very much and I don't do it very badly. I would like to make a screen for each exit of the game that would say something like: "You're an idiot when "doing this" and therefore, the game is over".

If I would modify the original code of the game I would have it very easy, but as I don't want to do it, my problems start there, I don't know how to do it with a patch and I don't even know if it can be done.

Some time ago I saw this in a patch of a game and I saved it, but I don't remember what game it was, and I haven't been able to check if it works or not:

Code:
init 99 python:

    config.label_overrides = {
            "label1" : "label1Patched",
            "label2" : "label2Patched",
            "label3" : "label3Patched"
            }

init 99:
    $ rb = ("brother")
    $ rs = ("sister")
    $ rbb = ("big bro")
    $ rss = ("little sis")

label label1Patched:
    mc 'Well, we’re not together. I mean we are living together, but we are not together "together". *sigh* I mean, she\'s my sister.'
    becca "Ah! Well then, she’s lucky to have such a caring brother."
    jump beccaFlirting

label label2Patched:
    jump scene0204Cont

label label3Patched:
    scene 0202059 with dissolve
    becca "Oh! Hey, you must be Sarah!"
    return

label label4Patched:
    mc "I never understood much of what she was saying, but that was always her biggest passion."
    mc "Though I think she should spend some more time understanding what \"ethical hacking\" means..."
    jump scene7cont
I've tried to do something similar with the gameover scenes I want to change, but I haven't done it well and it doesn't work for me.

So here I am again, asking for your help.

Can I do what I want or not?

Thanks for your help.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
The eternal "it depends".

It depends on how that bit of the game is coded, since config.label_overrides only affects when the script uses jump {label} (or call {label}).

So if the game has code that looks like:

Python:
label start:

    scene black with fade
    "Start:.... "


label almost_the_end:

    "This is just some random text."
    "More random text."

    #blah, blah, more code.

You *couldn't* code a replacement for almost_the_end, since that label is not jumped to at any point.
In this example, if you wanted to replace that section of code, you'd need to go back up and actually do the overrides on the label start since that label is jumped to and copy all the in both the start: and almost_the_end: blocks.

However, here's an example that would be fine and will work how I think you want it to...

Python:
# --- script.rpy ---
label start:

    scene black with fade
    "Start:.... "

    jump almost_the_end


label almost_the_end:

    "This is just some random text."
    "More random text."


label the_end_of_the_game:

    scene white with fade
    "*** THE END ***"

    return

Python:
# --- replacement_label.rpy ---
init 1 python:

    config.label_overrides = {
        "almost_the_end": "another_almost_the_end",
        }

label another_almost_the_end:

    "This is just some random text."
    "Just know that it will show this instead of what was original coded."
    "More random text."

    jump the_end_of_the_game

As far as I know, it's necessary to copy all the code from the old label to your new label... and amount of code you will need to copy is dependent on where the next label that is jumped to is (since the last thing your replacement code will need to do is jump back to where the game needs to continue).

In my example here, that's copying 2 lines of dialogue in order to add a 3rd line. In a real game, that might be require copying 150 lines of code just to add 1 extra line.

If there's a way of doing it another way (like inserting just a line here and a line there), I don't know it.

So in your example, you'd need to check which labels are before and after your scene gameover code. Then check if the label before is actually jumped to. Then recreate the section of code between the label that is jumped to and the line that says return in order to add in any extra lines you wanted.

Normally, you'd need to copy everything down to the next label, but since you are ending the game with return, you can stop there.

Personally, I would use pause rather than "", but that's just me.

Python:
    scene gameover with dissolve
    pause

    return
 

iOtero

Active Member
Aug 4, 2020
925
1,459
Thanks, but if you don't have to copy the whole LABEL again, I'd better forget about it, because the LABELs in this game are longer than the Mississippi River... :unsure:

And yes the use of PAUSE I think it is more correct, but from what I have seen so far they usually use more "" than the PAUSE, which is used more when they want to put a time to the PAUSE.

Thanks for your help.