Use the hide command to hide any characters that are present?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
tcassat
Regular
Posts: 33
Joined: Tue Oct 03, 2017 7:32 pm
Contact:

Use the hide command to hide any characters that are present?

#1 Post by tcassat »

Hello!

In my game the player can call two different characters, out of a total of 5, to come to a room.

For that I created two "slots" for the room. When the player enters the room, he has the option of calling one character to slot 1 (left) and another to slot 2 (right).

However, let's say that after choosing the BOB character to occupy slot 1 and the RICK character to occupy slot 2, the player changes his mind and decides that he will call the character MARCO to slot 1.

To do this, I'll need to use the "hide bob" command so that it disappears, followed by the "show marco at left". But would it be possible for me to use the hide command on any character that is currently occupying slot 1, without having to write the name of the image?

Since I'm new to Renpy, I'm not sure how to do this. I thought of creating specific layers for each slot and have the contents of these layers erased if the player decides to call another character, but I do not know if this is feasible or recommendable.

Thank you.
Last edited by tcassat on Wed May 16, 2018 8:30 am, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Use the hide command to hide any characters that are present?

#2 Post by kivik »

I bet someone is going to correct me and it'll be a revelation for me - but I found that this is slightly more complicated than expected because Renpy doesn't have a "hide expression" statement. I assume you're using show expression statements at the moment to dynamically show the character you wanted currently, but without hide expression you're stuck?

Well we just need to dig a little deeper into renpy functions: https://www.renpy.org/doc/html/statemen ... renpy.hide

Code: Select all

$ renpy.hide("bob")
That will hide bob, or more likely:

Code: Select all

$ renpy.hide(char_name)
Since you'd have a variable holding the character name already.


Your idea of using a separate layer would work as well, but seems excessive in this case - so long as you know who the character is you should be able to do it.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Use the hide command to hide any characters that are present?

#3 Post by Remix »

If you did:
show expression chosen_char[0] as left_char at left

You could then just either hide or overwrite using the alias left_char:
hide left_char
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: No registered users