Luke's Name (Ren'Py Code Musing)


Writing all this down for posterity so that I can either have this available to refer to later OR I can share it with  my fellow VN Devs in the future. 

I want to make a function in the game that changes Luke's "name" in the dialogue box based on if a variable is True or False. The variable I've defined is in_hiding. I want it to do the following to Luke's name:

If in_hiding is True, show Luke's name as "Luke".
If in_hiding is False, show Luke's name as "Lucas".

I have Luke's name set up as so:

define luke = Character("[luke_name]", callback = name_callback, cb_name = "luke")

As of now, I just toggle his name between "Luke" and "Lucas" by manually changing it like so:

$ luke_name = "Luke"
or
$ luke_name = "Lucas"

...which is going to get old REALLY FAST. Especially since I want to be able to make a hiding minigame that will also affect luke_name, where when the player successfully hides from the Corruption, it will automatically change his name from "Lucas" back to "Luke."

I think I found something that might be a good lead: this post on reddit where the OP wants to define a character name based on whoever's speaking and referring to them.

There's alsothis video by Coding with B & E, which talks about changing the character names based on variables.

I'll be studying for a little bit and will update this as I figure things out.

Get TwistedFates: LUCAS , Episode 1 (DEMO)

Leave a comment

Log in with itch.io to leave a comment.