Letting player stay at area without dialogue

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
User avatar
TheKiwi
Regular
Posts: 56
Joined: Sun Feb 03, 2013 4:09 am
Projects: The Waters Above, Heart of the Woods
Organization: Studio Élan
Tumblr: minutekiwi
Contact:

Letting player stay at area without dialogue

#1 Post by TheKiwi » Fri Feb 03, 2017 6:25 pm

I made a pretty functional exploration feature within my VN, but I'm having trouble just allowing players to stay in area.
They're not very visible right now, but in the future I'll have the textbuttons that say PDA and MOVE replaced with icons. After a player moves into an area, they can just stay there if they want and look over their notes in their PDA and whatnot. The problem is, I can't figure out how to make the game essentially wait for them to use those buttons.

What I could do is put a hard pause that lasts 99999999999999 minutes, but I feel like there's an easier way.

I've tried putting in a variable to do this:

Code: Select all

label start:
$nothingtodo = True
label place1:
while nothingtodo == True:
     pass
And it stops, but then it freezes up and I can't open up the PDA or move menu.

Here's an image as an example of what I want to happen. (The text buttons are a little light)
Image
Any ideas? All help is super appreciated. Thanks for reading.

User avatar
Woozical
Newbie
Posts: 3
Joined: Fri Feb 03, 2017 6:30 pm
Contact:

Re: Letting player stay at area without dialogue

#2 Post by Woozical » Fri Feb 03, 2017 6:39 pm

You're crashing your game with an infinite while loop. If you want the player to stay in the "place1" label while "nothingtodo" is true, try this:

Code: Select all

label place1:
	if nothingtodo:
		jump place1

User avatar
TheKiwi
Regular
Posts: 56
Joined: Sun Feb 03, 2013 4:09 am
Projects: The Waters Above, Heart of the Woods
Organization: Studio Élan
Tumblr: minutekiwi
Contact:

Re: Letting player stay at area without dialogue

#3 Post by TheKiwi » Fri Feb 03, 2017 6:46 pm

That works, as long as I have dialogue in the bottom. But when I don't, ren'py crashes and tells me I have an infinite loop.

User avatar
Woozical
Newbie
Posts: 3
Joined: Fri Feb 03, 2017 6:30 pm
Contact:

Re: Letting player stay at area without dialogue

#4 Post by Woozical » Fri Feb 03, 2017 8:05 pm

Try slapping a 1 second pause before the if statement.

User avatar
Sleepy
Regular
Posts: 136
Joined: Wed Nov 27, 2013 6:12 pm
Projects: Camera Anima
Organization: EXP-resso Mutt
Tumblr: sleepy-does-games.tumblr.com
itch: https://expressomutt
Contact:

Re: Letting player stay at area without dialogue

#5 Post by Sleepy » Sat Feb 04, 2017 12:33 am

I also have exploration levels in my game. How I keep players in an 'explorable' section is I just have an exploration screen which contains things like the image/text buttons for that area. So for ex:

Code: Select all


label area1:
    "blahblahbetter check my pda"
call screen area1_explore

screen area1_explore:
    #Area Move 
    textbutton "Move" action Show("move_menu") align (#insert alignment)

    #PDA Use    
    textbutton "PDA" action [#insert display method here] align (#insert alignment)
If you want to have a text button visible all the time, though, like the PDA, you might considering making that it's own screen and using 'show' instead of 'call'. But something in this format should keep players in the explorable area without being stuck in an infinite loop.
W.I.P.

Image

Complete

Image Image

User avatar
TaoistFruitbat
Newbie
Posts: 20
Joined: Wed Jun 29, 2016 12:46 am
Projects: Soulshine
Contact:

Re: Letting player stay at area without dialogue

#6 Post by TaoistFruitbat » Sat Feb 04, 2017 8:45 pm

You can try creating the screen you need and sticking it out of the viewing area. I had to do a similar thing to display an empty choice menu.

Code: Select all


screen choice(items):

    window:
        style "menu_window"

        if show_menu:  # This is a variable you set elsewhere  
            # normal menu code here

        # If we don't show the menu then we do a dirty hack
        # and stick a single 1x1 button off the screen.
        # From the players perspective there is no menu.
        else: 
            for i in items:
                button:
                    area (-1, -1, 1, 1)

You could do a similar trick for a text screen, or whatever screen you want.

User avatar
TheKiwi
Regular
Posts: 56
Joined: Sun Feb 03, 2013 4:09 am
Projects: The Waters Above, Heart of the Woods
Organization: Studio Élan
Tumblr: minutekiwi
Contact:

Re: Letting player stay at area without dialogue {SOLVED}

#7 Post by TheKiwi » Mon Feb 06, 2017 11:53 pm

Hey, I figured out a super easy way to do it in case anyone needs this. Thank you for the input everyone!

Code: Select all

define emptytext = Character(None,window_background=None)
I have no idea why I didn't figure this out earlier, but yeah. I made an empty character and make it work by just giving it an empty text and making it jump back to the label.

Code: Select all

label endscene1:
    emptytext ""
    while nothingtodo == True:
        jump endscene1

User avatar
ISAWHIM
Veteran
Posts: 287
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: Letting player stay at area without dialogue

#8 Post by ISAWHIM » Tue Feb 07, 2017 2:44 am

Hide Window
Scene Something_here
Pause

or

Window Hide
Scene Something_here
Pause

That will hide the text-box... Then PAUSE until they still have to click to continue, which will then take them to the next part. (Or, if you have a button, they click that.)

The text-box is set to AUTO, by default. That makes it pop-up, if there is something to display. When there is nothing, it does not show. However, when changing a scene, it auto-loads your next box... Since that is what you are use to doing...

Code: Select all

Scene ....
Guysays "something"
The box pops-up, because you told it to, after displaying the scene...

Do this instead...

Code: Select all

OldStuffSaid "something"

Hide Window
Scene ... (What you want to pause at.)
Pause
Narrator "You exit the waiting-area"
You told it to hide the textbox, after displaying the scene... (Though, it should disappear anyways, but it may not, in AUTO.)

PAUSE without any number, will just pause forever.

As a repeatable function...

Code: Select all

label myWaitingArea():
    Hide Window
    Scene cargo_area with dissolve
    Pause
    Narrator "You exit the waiting-area"
    return

label start:
    You "Hello"
    call myWaitingArea

    You "Still nothing"
    call myWaitingArea

Post Reply

Who is online

Users browsing this forum: Google [Bot]