Help Danganronpa Trial System

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
Westeford
Regular
Posts: 151
Joined: Mon Jun 19, 2017 4:43 pm
Completed: 12 Hours to Die
Projects: Project Premonition
itch: westeford
Location: United States
Contact:

Help Danganronpa Trial System

#1 Post by Westeford »

This is the biggest road block I've hit in my project. A trial system like in Danganronpa.
If you're unfamiliar with the trials here is a short video showcasing the basic game play. from 4:30 to 5:00
https://youtu.be/wWlegT06gDo?t=4m30s

These are my notes on how I want this to work.
1. Intro
-a. Show the truth bullets that can be used in this argument
2. Argument
-a. Shows person1 talking showing a screen with their statement.
-b. after some time the statement fades out and the next statement comes in. (If someone else is talking, then the camera pans to that person.)
-c. During the argument the player can switch out truth bullets. This doesn't pause the game.
-d. The white statements are untargetable. (I'd just use an image or screen with no action)
-e. The orange statements are possible weakpoints in the argument. These can be targeted.
-f. The player clicks on the orange statement to fire a truth bullet.
-g. If the player used the wrong truth bullet on the statement then a separate dialogue plays about how wrong the player is, then the argument starts again at the beginning.
-h. If the player used the right truth bullet on the right statement then the "No that's wrong" animation plays and the game continues.
3. Closing

That's a lot of stuff, so I'll break it down to four categories.
1. Camera Panning
2. Autorunning
3. Truth Bullets
4. Statements

(I already got the camera panning system from the cookbook and it's working just fine, so I'll move on to the truth bullets and the statements.)

Autorunning
During the arguments everything is played automatically until the argument has been played in full, then it resumes to the dialogue and click to continue thing, then it restarts the argument.
I'm not sure how I would go about doing this. How would I hide the window and disable click-to-continue during these moments?

Truth Bullets
Before the argument begins the game shows the player the truth bullets they have available. During the trial, the player can switch their bullets out without pausing the game. I assume I would use images as the bullets then I would map at least one button the keyboard to rotate the bullets in.
I'm not sure where to start and how I would do this.

Statements
Okay, I have some code for this one. Here's my thought process.
During argument

Code: Select all

label debate1a:
    show screen statement1
    pause(3)
    hide screen statement1
    show screen statement2
    pause(3)
    hide screen statement2
    show screen statement3
    pause(3)
    hide screen statement3
    show screen statement4
    pause(3)
    hide screen statement4
    show screen statement5red
    pause(3)
    hide screen statement5red
    #Present Autopsy
label debate1b:    
    t "Something didn't seem right about that one statement..."
    pause(1)
    jump debate1a
label debate1c:
#show animation
	"um actually...blahblahblah"
    
Statement Screens

Code: Select all

screen statement5red(): #Gives me an error 
    vbox:
        imagebutton "bad1.png" action Jump(debate1c)
        
screen statement1(): #Same with 2,3, and 4.
	vbox:
		image "good1.png"   
The previous code isn't even taking into account the truth bullet being fired, right now I'm trying to get it to get the button to work before adding evidence to the mix.

Anyway, I know this is a long post. So thank you for taking the time to read this. I appreciate any help and tips and nudges that'll get me in the right direction.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Help Danganronpa Trial System

#2 Post by DannX »

Well, first about the error in your screen, in Jump screen action, you have to pass the label as a string:

Code: Select all

imagebutton "bad1.png" action Jump('debate1c')
As for the system itself, some time ago I was working on a similar argument battle system (kind of a mixture between Ace Attorney and Danganronpa, big fan of both), sadly I lost most of the code for that game, but I remember having it working for the most part. I can say you're going to need a lot of screens, ATL, labels, and python code, possibly objects.

This is a really complicated thing to do if you don't have much experience with Ren'Py and Python.
Autorunning
How would I hide the window and disable click-to-continue during these moments?
I made this by combining a loop with call instead of show screen, that screen received a list of statements that were displayed with the help of timer in the screen. The screen would not end until the player clicked on a weakspot (there was no time limit). For the statements I used normal text, for the weakspots (orange words) I used textstyled hyperlinks that called a label when clicked, depending on currently selected truth bullet, that label would be a generic mistake label, or the correct label for that particular debate, that would advance the story.
Truth Bullets
I'm not sure where to start and how I would do this.
This would be another screen, it should be called before the statements loops (debate) screen, once. Then during the statements loop, you can show a button to call the screen once again, or key statement to map keys to cycle between truth bullets. You might want to begin by creating the truth bullets and statements themselves, and storing them in a variable, or better yet, object. At least you need some kind of way to check when a truth bullet is valid.

I realize this explanation is not very good, it's one of those things I understand well myself but have trouble explaining to others. Anyway feel free to ask any questions and I'll do my best to clarify.

EDIT:
Made a quick example (still doesn't take truth bullets into account)

Code: Select all

default debate1_statements = ["They did it",
                              "Shut up",
                              "This is {a=jump:db1c}not wrong{/a}",
                             ]

default debate1_finished = False

screen statement_display(statement):

    text statement at truecenter

    timer 3 action [Hide('statement_display'), Return()]

label start:

    "Test start!"

    window hide

    while not debate1_finished:

        python:

            for s in debate1_statements:

                renpy.call_screen('statement_display', statement=s)
                renpy.pause(1)

    return

label db1c:

    $ debate1_finished = True

    hide screen statement_display

    "Naegi" "No that's wrong!"

    return


I hope this helps.

User avatar
Westeford
Regular
Posts: 151
Joined: Mon Jun 19, 2017 4:43 pm
Completed: 12 Hours to Die
Projects: Project Premonition
itch: westeford
Location: United States
Contact:

Re: Help Danganronpa Trial System

#3 Post by Westeford »

DannX wrote: Mon Jun 11, 2018 11:22 am EDIT:
Made a quick example (still doesn't take truth bullets into account)
So far so good. Your example has helped me very much. There's a few things about the code I want to clarify and fix before trying to implement the truth bullets.
1. For each debate I have three labels. A is the beginning of the loop, B is what the player character says before the argument resets. (Serving as both a hint and a way to tell the player, this is it.) C. the end of the argument and the continuation of the trial. So I'd like to re-enable click-to-continue and show the textbox while the player character thinks for a little bit. then jump back to A.
2. I'd like to be able to edit each of the statements. Mainly choosing how they transition in and out.
3. I still need to be able to aim the camera at the characters speaking. I'm not sure if this will help, but this is some of the code used when panning to the characters.

Code: Select all

show layer pan at a_name1 #moves the "camera" to this character's position
show name1 anger onlayer pan at p_name1 #Changes character sprite
I'll be experimenting on my own, but if you or anyone have any suggestions I'm open.
Thank you very much

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Help Danganronpa Trial System

#4 Post by DannX »

Rewrote some of the previous code to make it a bit easier to use and address point 1 and 2 of your previous post, for the panning I can't test it as I can't download the demo right now but it should be a matter of adding the show statements before the call screen, you may have to tinker a bit with it. I don't have the time to explain this in detail right now, later as soon as I can and if you need me I'll come back and explain it thoroughly.

Code: Select all

#This screen is used to display each statement. It takes a sta parameter, that is a string containing the
#text, and a trans, that should be the transform applied to the text.
screen st_display(sta, trans):

    text sta at trans # display the text at the transform

    timer 3 action Return() #after 3 seconds passed, return/exit the screen

#this is a simple transform to demonstrate that you can pass transforms to the screen.
#feel free to try your own
transform dissolve_s:

    alpha 0

    linear .5 alpha 1

label start:

    "Test start!"

    jump db1 

#This is a debate label. It is divided into three local labels, a, b, and c.
label db1:

    # local label a, used for the preliminary dialogue before the statements loop starts
    label .a:

        "Naegi" "I won't mess up here! Let's go!"

        jump .loop

    # the loop label. For each statement you want to display, you call the screen st_display passing it the statement
    # and a transform to animate it.
    label .loop:

        window hide

        $ renpy.call_screen('st_display', sta="I was never in the kitchen.", trans=dissolve_s)
        $ renpy.pause(1)
        #This statement contains a clickable hyperlink that jumps to a label, in this case, the label is c and it breaks
        #the loop.
        $ renpy.call_screen('st_display', sta="So I never took the {a=jump:db1.c}knife{/a}!", trans=dissolve_s)
        $ renpy.pause(1)
        
        #once all statements have been displayed, if the player didn't click any, jump to label b
        jump db1.b

    #local label b, here the characters comment the statements to give a hint or something.
    label .b:

        "Naegi" "The second statement is suspicious."

        "Naegi" "Let's try that again." 
 
        #this jumps back to the loop label, effectively restarting the statements loop.
        jump .loop

    # label c. This would be the "correct!" label. 
    label .c:

        hide screen st_display

        "Naegi" "No that's wrong!"

        "Naegi" "You did take the knife!"

        "Blackened" "Oh no you got me!"

        "END"

        return 

User avatar
Westeford
Regular
Posts: 151
Joined: Mon Jun 19, 2017 4:43 pm
Completed: 12 Hours to Die
Projects: Project Premonition
itch: westeford
Location: United States
Contact:

Re: Help Danganronpa Trial System

#5 Post by Westeford »

DannX wrote: Fri Jun 15, 2018 8:52 am Rewrote some of the previous code to make it a bit easier to use and address point 1 and 2 of your previous post, for the panning I can't test it as I can't download the demo right now but it should be a matter of adding the show statements before the call screen, you may have to tinker a bit with it. I don't have the time to explain this in detail right now, later as soon as I can and if you need me I'll come back and explain it thoroughly.
I finally got to experimenting with this code and I was impressed on how easy it was to implement. I'll be tinkering around with the transforms
Thank you also for teaching me a few new tricks
Fun fact, I didn't know what alpha meant until now. (I don't know how I overlooked that. lol)

Post Reply

Who is online

Users browsing this forum: AWizardWithWords, Google [Bot]