Override text called with Character in Renpy game

2.4k views Asked by At

I would like to change the text echoed using the Character class to use context.

Let's say my main character name is stored in a variable, every other Character use this variable to call him in dialogues, but i want this variable replaced is certain condition. I would like to check these condition in a meta context (don't want to change every dialogue texts, just catch some dialogue in a function to update text)

I searched into the Character class, and Character callbacks, even with the translation method, but i can't find anything suitable.

1

There are 1 answers

0
Phoenix iz Fire On

I don't know if I understood well, but I'll add an example of what I understood and you'll tell me :

define hero = Character("[player_name]")
define sis = Character("Lola")
define mom = Character("Ariel")
define friend = Character("Elsa")

label start:
    hero "My name is :"
    $ player_name = ("What is your name ?")
    $ player_name = povname.strip()
    friend "Hey [player_name] !"
    sis "Hey bro !"
    mom "Hey son !"

Hope this looks like what you intend to get. Now if you want to consider custom names, like "Brother" instead of "Bro" for example, you could just :

default from_sis = ""
default from_mom = ""

label custom_names:
    $ from_sis = ("How does your sister call you ?")
    $ from_sis = povname.strip()
    $ from_mom = ("Same for your mother")
    $ from_mom = povname.strip()
    sis "Hey [from_sis]"
    mom "Hey [from_mom]"

Remember that the Character class is only here for the renpy.say function, and the string variable you'll store as a name is just used for writing it in textblocks. Any other string variable can be used for anything. Hope this was your issue and that I fixed it, if not, I'll gladly help you again :)