Barks with 'responses'

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Barks with 'responses'

Post by wattoo »

Hello,



Firstly, thanks very much for your help on my importing problem Tony. All seems good so far.



So onto proper questions...



Is it possible for NPCs to bark more than one dialogue box?



In our game, there is repartee between the main NPC and the Player which doesn't require clicking through on a menu, it's just stuff they may say at random points. This would be both timed and also conditional (ie if the Player is doing X, he 'may' say a certain string, but when he's doing 'Y' he may say something else). Some of these barks are one-liners so I've got them working, but others require the player's character to respond (note: not the player themself, the dialogue occur without player interaction). Would I have to use an interactive conversation with conditions attached instead? But then how do I make it random?



Is it possible to activate a bark, just by being near something (no use button, literally just close by a relevant object?). We're not using the mouse so it would be just down to the physical location (and direction he's facing) of the player's character.



I may have some others, but a couple are probably due to the type of crazy ass game we're making.



Cheers
User avatar
Tony Li
Posts: 20769
Joined: Thu Jul 18, 2013 1:27 pm

Barks with 'responses'

Post by Tony Li »

3195 wrote: Is it possible for NPCs to bark more than one dialogue box?


There are a few examples in the Examples/Bark  Example folder. You might want to use Bark Dialogue UI to run it as a conversation that uses the participants' bark UIs.



3195 wrote: But then how do I make it random?


If you go with a conversation (versus barks), you can use Lua's math.random() function. For example, in the START node, use the Script field to set a variable to a random number. For example, say you have 3 possible responses:

entryNum = math.random(3)

Add a blank child node to START. Then add 3 child nodes to this blank node. Set the Conditions fields to:

entryNum == 1

et cetera. The intermediate blank node is required because the Dialogue System evaluates one level ahead in order to have the response menu ready.



For barks, on the other hand, you just put the conditions on the Conditions field of the second-level nodes (i.e., the children of the START node).



3195 wrote: Is it possible to activate a bark, just by being near something (no use button, literally just close by a relevant object?).


Sure! Here are two ways:



1. Set the Bark Trigger to OnTriggerEnter. The character will bark when the player enters the trigger area.



2. To bark on idle (i.e., automatically at random intervals) only when the player is nearby, use Range Trigger. This is a general-purpose component that can activate and deactivate anything when the player enters or leaves a trigger area.



There's currently no built-in facility for checking what direction the player is facing.
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Barks with 'responses'

Post by wattoo »

Thanks Tony, you are indeed the Keymaster
User avatar
Tony Li
Posts: 20769
Joined: Thu Jul 18, 2013 1:27 pm

Barks with 'responses'

Post by Tony Li »

3198 wrote: Thanks Tony, you are indeed the Keymaster


Just call me Vinz. :-)
wattoo
Posts: 16
Joined: Sun Oct 05, 2014 2:40 am

Barks with 'responses'

Post by wattoo »

So I have a conversation tree with a load of separate branches such that each time this conversation is triggered, you get a different set of lines (as per your info above with entryNum).



What I'd like is to remove said lines from possible selection so after it's been said, it won't be repeated and will pick an unsaid line instead. I initially put an entryNum assignment in the last dialogue box of each branch, but obviously this did nothing and the random selection in START just over rode it. Ideally I'd like something simple as I'm hacking as it is (until code support catches up with me) so I don't want anything too convoluted as it'll make checking and using it alongside my other hacks too tricky.



Can I change the entry conditions from the dialogue script box for example?
User avatar
Tony Li
Posts: 20769
Joined: Thu Jul 18, 2013 1:27 pm

Barks with 'responses'

Post by Tony Li »

The Dialogue System's data structure is based on a dialogue authoring tool called Chat Mapper. In Chat Mapper, every dialogue entry has a field called "SimStatus" that records whether the entry "WasOffered" (i.e., offered as a possible response in a response menu), "WasDisplayed" (i.e., spoken by a character), or "Untouched". You can read more about this here: Chat Mapper manual (under Scripting with Lua > Conditions and Scripts).



In Chat Mapper, you can check this in the Conditions field. For example:



Conditions: Dialog[5].SimStatus == "Untouched"



If you tick Dialogue Manager > Include Sim Status, the Dialogue System will also keep track of SimStatus. It's a little messy because it works directly with dialogue entry ID numbers. But those numbers are shown right in the inspector, so it's not too hard to work with.



If you're using barks, just set the order to random, and add a condition like the one above to each dialogue entry. You don't need to deal with entryNum. But the problem with barks is that it's more difficult to allow the PC (or other NPCs) to speak follow-up lines. You can chain together BarkOnDialogueEvent components, but it's messy.



If you're using conversations and a random entryNum, you need to pick an entryNum that hasn't been spoken yet.



In the START node's Script, you could repeatedly loop until you find a random entryNum where Dialog[entryNum].SimStatus=="Untouched", but if there are no untouched entries, you'll get into an infinite loop and the game will freeze.



It's going to take a little coding, either in Lua or C#. I recommend getting your coder to write a short function. It should gather a list of all dialogue entries whose Conditions are true, choose one at random, and return its ID. If you're using C#, you can use Lua.RegisterFunction() to tie it into Lua. That way, you can use it yourself in the entry's Script field. I can provide help if your coder has any questions.
Post Reply