Following from yesterday, I worked on a conversation about who should collect firewood, with the conversation system passing along the collect firewood activity to whichever npc is picked. I also generalized the collect firewood activity for any task that involves finding items to go drop off at a location.
The conversation json now includes the ability to add interrupts on a line. The interrupts can jump to a different set of lines, or show a menu of items for the player to choose. And he can be quite sassy if he wants to! It also supports jumping to a specific line if the player doesn't answer within a limited timeframe, similar to the telltale games.
It was surprisingly easy to add too. The biggest difficulty was repurposing the radial menus I had and giving their control over to the conversations. I ended up using the same menu instance that is used for other actions in the game, just making sure to reset its state at the end.
What could possibly go wrong? I'm at the stage where most things are pretty easy to add, but it's also easy to get some spaghetti code that wont scale later. I'm sure I will have to schedule one of these days for refactoring.
Today I did: NPC reacting to the player leaving in the middle of a conversation.
Back to my plan:
1) Conversation object which detects when player is near or not: DONE
2) Assign a simple linear script to the conversation, no special character animation, just lines: DONE
3) Make conversation ensure that all actors are summoned to it's area on conversation start: DONE
4) Character speaking direction changes according to who they are responding to: BUGGY
5) Generic interrupt section can be assigned to a conversation: DONE TODAY
6) Ability to insert specific interrupts on each line of conversation: not yet
Number 6 is going to be important to actually allow the player to say things to change the flow of the conversation. After that, the system will be functional for the game, although it's lacking a ton in polish.
Here is the conversation script shown in the GIF:
{"lines": [ ["mother","My poor boy. What is it?"], ["mother","I'm sorry your legs are hurting."], ["mother","Can't rest until the tracker says it's time."], ["mother","He says the danger is still out there."], ["mother","Considering what we have left, I believe it."] ], "walk_away":{"distance":100,"replace_lines":[ ["mother","It's ok if you don't talk to me, go explore."], ["mother","Just be safe, OK?"] ]} }
When the player walks at least 100 units away, the script switches to the lines defined by "replace_lines". When I implement step 6 though I'll be able to expand this dialog to allow the player to choose the conversation topic after the first line in response to the mother's question.