Midnight Stardew


Conversation Responses


You will often want the player to be able to respond to what the characters say and have the player's response impact the relationship they have with the character. With the Midnight Stardew framework you can create a conversation of any length with as many responses as you want to add. This is accomplished by putting an entire new conversation as the response to a question, we'll start with easy examples and build our way up.

{
    "Name": "Robin",
    "Conversations":
    [
        {
            "Statement": [ "Hello" ], // What the character says:
            "Responses":
            {
                // Response 1 that the player could choose.
                "Hello!" :
                // How the character responds to response 1.
                {
                    "Statement": [ "It's good to see you." ]
                },
                
                // Response 2 that the player could choose.
                "Bah humbug" :
                // How the character responds to response 2.
                { 
                    "Statement": [ "Looks like someone is grumpy!" ]
                }
            }
        }
    ]
}

The above code will display a question that has the prompt of "Hello" which may not be what you're wanting.



The last quoted element within Statement is only shown on the question displayed to the user. Adding additional quoted elements within the Statement can make it more clear to the player who is speaking and what the question is as shown below.

{
    "Name": "Robin",
    "Conversations":
    [
        {
            "Statement":
            [
                "Hello", // Displayed before the question:
                "How do you respond:" // Displayed on the question:
            ],
            "Responses":
            {
                "Hello!" : 
                {
                    "Statement": [ "It's good to see you." ]
                },
                "Bah humbug" :
                { 
                    "Statement": [ "Looks like someone is grumpy!" ] 
                }
            }
        }
    ]
}






If the player chooses "Hello!", Robin will respond "It's good ot see you." if the player responds "Bah humbug" then Robin will say "Looks like someone is grumpy!" Just like in the top level conversation, the Statement tag lets the framework know what the character should say.

How you choose to write the statements made by the characters and what is displayed on the question is a matter of design without a right answer. The import technical aspect to remember is that all Statement elements except the last one will be displayed as conversation coming from the character, the last element will be displayed as the prompt on the question.

Following the prompts displayed to the player you see a colon then a new response conversation that follows after the player's response. The response conversation can have all of the same elements we've talked about: keys, requirements, effects, statements, and more responses. We'll work through a few examples to build up the response conversation like we did with the top level conversations.

Adding effects to the decisions the player makes takes adding an Effect tag to the response conversation as shown below.

{
    "Name": "Robin",
    "Conversations":
    [
        {
            "Statement": [ "Hello", "How do you respond:" ],
            "Responses":
            {
                "Hello!" : 
                {
                    "Statement": [ "It's good to see you." ],
                    "Effects": 
                    { 
                        "Hearts": "20" 
                    }
                },
                "Bah humbug" :
                { 
                    "Statement": [ "Looks like someone is grumpy!" ],
                    "Effects": 
                    {
                        "Hearts": "-20"
                    }
                }
            }
        }
    ]
}

The above will incrase the player's friendship points if they choose to respond by saying "Hello!" and decrease the player's friendship points by 20 points if they respond "Bah humbug".

Custom stats can be changed in the same way as a top level conversation by using the Stats tag.

{
    "Name": "Robin",
    "Conversations":
    [
        {
            "Statement": [ "Hello", "How do you respond:" ],
            "Responses":
            {
                "Hello!" : 
                { 
                    "Statement": [ "It's good to see you." ],
                    "Effects": 
                    { 
                        "Stats": {"Rapport": "80"}
                    }
                },
                "Bah humbug" : 
                {
                    "Statement": [ "Looks like someone is grumpy!" ],
                    "Effects":
                    {
                        "Stats": { "Rapport": "-80" } 
                    }
                }
            }
        }
    ]
}

The above file will increase the custom stat, Rapport, by 80 for "Hello!" and reduce it by 80 for "Bah humbug". The layout of the second response conversation was changed as a reminder that white space doesn't matter.

Response conversations can also have requirements, limiting what the player can say if they don't meet certain requirements including keys.

{
    "Name": "Robin",
    "Conversations":
    [
        {
            "Statement": [ "Hello", "How do you respond:" ],
            "Responses":
            {
                "Give her a hug": // Can only be chosen once when hearts are four or more.
                {
                    "Key": "robinhug",
                    "Reqs": { "Hearts": "4" },
                    "Statement": [ "I guess we're on a hugging basis on!" ],
                    "Effects": { "Hearts": "500" }
                }
                "Hug her": // Player must have hugged Robin and still have four hearts.
                {
                    "Reqs": 
                    {
                        "Keys": [ "robinhug" ],
                        "Hearts": "4"
                    },
                    "Statement": [ "Always great to see you!" ],
                    "Effects": { "Hearts": "250" }
                }
                "Hello!" : 
                { 
                    "Statement": [ "It's good to see you." ],
                    "Effects": { "Hearts": "250" }
                },
                "Bah humbug" : 
                {
                    "Statement": [ "Looks like someone is grumpy!" ],
                    "Effects": { "Hearts": "-250" }
                }
            }
        }
    ]
}