Creating a Ace Attorney like dialogue "battle"

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
nature1996
Regular
Posts: 62
Joined: Wed Jun 21, 2017 10:35 am
Contact:

Creating a Ace Attorney like dialogue "battle"

#1 Post by nature1996 »

I'm new to the visual novel community, and I'm trying to create a game that takes from Ace Attorney and the like. I already created the first one from my game, which serve as a kind of tutorial, but I'm having trouble including the present function. I would like help with that.


But first things first, let me explain the basic mechanic.

At some point in the game, the character will enconter testimony.

The testimony, shown all at once on the screen (in nvl mode) with interactive statement. Selecting the statement will let you interact with it. The game goes back to adv mode, where the statement is reapeted with a menu giving you for option:

-Explain, which ask for more information on the statement

-Back it up, which ask for the mechanism, or proof, behind the argument

-Fact, wich is what I need help with, will let you present a fact you have gained earlier, either during the story, or previously during your examination of the testimony.

-Back, which let you go back to the full testimony.

While you examin the diferents statements, sometime statement will be added or updated and you can learn new fact.

The last possibility apear at the end of the testimony. You can re-examin everything, which let you look at the state of the testimony as a whole, which will only have an effect if the testimony is in the right state.


Anyway, so right now I'm able to change the version of the statement using variable (ex. S1=0 mean no first statement, S1 = 1 mean statement 1 in his first state, etc.), and the Examin and Back it up action are working as dialogue resulting from a choice menu, and the Re-examin everything statement work as intended, but I can't figure out how to include the Fact action.


I would like it to prompt some kind of list of the different fact acquirered during the game, in which lead to one customed message if it is the right one for the statement, and to a general faliure one if not. (I intend it to be volontarily as thick as AA present system).


I have some idea on the logic to make it work, but I don't know how to do it

So, first, the Fact inventory: I could use the same mechanic as I used for the statement, whith variable to determine if I show the option to use that fact or not, but with around 20 fact for the introduction and the first chapter alone, and testimony containing like 15 statement with multiple version, it seem to be an awfull lot of variable, though I could make it work, maybe.

For the Fact use, I have the idea to use a variable which would take a specific value if there is a weakness (corpare to 0 if not) and a subroutine wich would be called everytime someone will try to use fact which will bring them to a fact select screen where it will check if there is an special responce for the specified statement and fact, and display the specific message if needed, or the geniric one if not.

I would also like to have a life systhem on 10 point where point are lost if a wrong fact is presented, leading to a game over if it reach 0. You would also gain point for advencing in the story, or using the right fact at the right place. But this could wait for later.

To conclude, I will include a exerpt from my game containin the first testimony, which, as I said before, is some kind of tutorial. That mean the different option open progressively, while they will be always accessible from that point on.

Walktrough

Statement 1: Explain

Statement 3: Back it up --> Fact gain (not implanted)

Statement 4: Fact(you want me to use fact) (not implanted, I simply give access to the next part instead)

Statement 5: Explain

Re-examin everything --> end (won't always be the case)

Btw, sorry for the long post
Attachments
script.rpy
Part of my game including the first testimony and the pertinant variable. I'm using a place holder character.
(11.29 KiB) Downloaded 98 times

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Creating a Ace Attorney like dialogue "battle"

#2 Post by DannyGMaster »

I'm very interested in this kind of game, I'm a big fan of Ace Attorney after all. I tried your script and it's pretty interesting, I would love to see it implemented, although at the time it is a little hard to read, jumping from nvl mode to adv mode, I still liked it, it has a lot of potential. As for the Fact Inventory, and the whole game if it's possible, you probably want to create a screen to have the user choose from all of the facts he's collected, and check wich is the correct one.

I'm working on one right now wich is more alike Ace Attorney, but I'll share it once it's functional so you can see if it works for you.
The silent voice within one's heart whispers the most profound wisdom.

User avatar
nature1996
Regular
Posts: 62
Joined: Wed Jun 21, 2017 10:35 am
Contact:

Re: Creating a Ace Attorney like dialogue "battle"

#3 Post by nature1996 »

I know it's a bit problematic to go from nvl mode to adv mode, but my reason is that controling a 15 statement in a rolling testimony would get confusing. I guess the transition aren't helping either, since they are a bit buggy (it should be dissolving but it end up flashing most of the time). Also the text appear kinda randomly in nvl mode, and I dont know why yet.

I've seen it done before though, in 999 and VLR (Zero escape serie). I'm oppen to suggestion, but I believe I can fix it given enough time and information.

Thank you for the comment, this is definitely the next thing on my list.

I would definitely like to see your aproach of this problem.

Thanks for your help

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Creating a Ace Attorney like dialogue "battle"

#4 Post by DannyGMaster »

Well after thinking about it and playing a little with my own test code, I've concluded that a good way
of storing and accessing the facts Inventory is by making it using Python code.

OK, this is what I have so far. I haven't tested it thoroughly so it can have errors, but hopefully you
will understand my approach (it's pretty much like Ace attorney):

Code: Select all

define e = Character("Eileen")
define you = Character("Phoenix")
default case1_facts = ['My Badge'] #This creates the facts inventory
default check_fact = None #This is a variable where we will store the fact you choose
default life = 50

screen your_life:
    frame:
        text "Life: [life]"

screen facts_list(items):
    frame:
            vbox:
                text "FACTS:"
                for i in items:
                    textbutton i action SetVariable('check_fact', i), Return()
                   
                textbutton "Go back" action SetVariable('check_fact', None), Return()

# The game starts here.

label start:

    show screen your_life #Show life points

    "Judge" "Let us begin the cross examination."

    $ correct_fact = 'It was 9:00 PM' #This is the correct fact, the one that you need to present

    $ life = 50

    label statement1:

        menu:

            e "I was walking home from work."

            "Hold it!":

                you "Hold it!"

                you "What time was it?"

                e "It was 9:00 PM."

                you "Hmm... I should make note of that."

                
               #This checks if you have this fact in your inventory
                if not 'It was 9:00 PM' in case1_facts: 

                    #This adds a new fact if you don't have it yet
                    $ case1_facts.append('It was 9:00 PM') 

                    "Statement added to Facts."

            "Present":

                "Jumping to Fact Inventory"

                call screen facts_list(case1_facts) #Calls the fact screen

                if check_fact == None:
                    jump statement1

                else:
                    jump case1_failure 
                                                   

            "Go on":
                jump statement2 

    label statement2: 

        menu:
            
            e "Then I saw the boy in front of the house."

            "Hold it!":

                you "Hold it!"

                you "Are you sure?"

                e "Yes, I am sure."

            "Present":

                call screen facts_list(case1_facts)

                if check_fact == None:
                    jump statement2
                else:
                    jump case1_failure

            "Go on":
                jump statement3

    label statement3: #This is the faulty statement

        menu:

            e "It was 8:50 PM! just like that handsome prosecutor said!"

            "Hold it!":

                you "Hold it!"

                you "Are you sure?"

                e "Yes, I am sure."

            "Present":

                call screen facts_list(case1_facts)

                if check_fact == correct_fact: 
                    jump case1_objection

                if check_fact == None:
                    jump statement3

                else:
                    jump case1_failure

            "Go on":
                jump after_statements 
                                                     

label after_statements:

    you "I wasn't able to discover anything. Let's try again."

    jump statement1 

label case1_failure: 
                                

    you "Objection!"

    you "Now the judge will see how awesome I am."

    "Judge" "I don't see why I would."
    
    "Judge" "Here's a penalty for you."

    $ life -= 10

    if life <= 0: #If you have no life left, you lose.

        you "No way, I can't believe I lost."

        jump bad_end

    you "Ooops, I missed. let's try that again"

    jump statement1 

label case1_objection: #This is called only when you present the right evidence.

    you "Objection!"

    you "You said yourself you went home at 9:00 PM!"

    you "But you claim to have seen the boy at 8:50! That's a contradiction!"

    jump end 

label end:

    e "OMG! You got me!"

    "End of cross-examination"

label bad_end: 
                         
    if if <= 0: #Fixed. Thanks nature1996! 

        "You lost the trial. Bad ending"
Last edited by DannyGMaster on Thu Jun 22, 2017 9:30 am, edited 4 times in total.
The silent voice within one's heart whispers the most profound wisdom.

User avatar
nature1996
Regular
Posts: 62
Joined: Wed Jun 21, 2017 10:35 am
Contact:

Re: Creating a Ace Attorney like dialogue "battle"

#5 Post by nature1996 »

Thanks, that really point me in the right direction. Your code is working fine except for the second to last line, which contain a mistake.

I took the liberty to change a bit your life system in order to make it more function like:

Code: Select all

screen your_life:
    frame:
        text "CP: [Life]"

init python in life:
    
    Life = 5
    
    def add():
        
        global Life
        if Life < 10:
            Life +=1
        return Life
        
    def less():
        
        global Life
        Life -=1
        return Life
    
    def set(value):
        
        global Life
        Life = value
        return Life

init python:
    import store.life as life

label start:
    
    #to add 1 point, with a limit of ten
    $Life = life.add()

    #to remove one point
    $Life = life.less()

    #to set the value (to 9 for ex)
    $Life = life.set(9)
I'm still trying to figure out the code for the inventory itself, but I believe I'm on the right path.

Thanks again for your help

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Creating a Ace Attorney like dialogue "battle"

#6 Post by DannyGMaster »

Thanks for pointing out my mistake. I will try and add more comments explaining how it works
in the future, but for now I'm glad I could point you in the right direction, I'll be looking forward to
what you make of it.
The silent voice within one's heart whispers the most profound wisdom.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot]