Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Looking for advice creating a dialogue tree macro

I don't usually use the macros function of roll20, but I decided to do more with it recently. One idea I have is creating a token action that players can select when they have an NPC token highlighted that allows them have a "conversation" with said NPC, selecting from several options in a pulldown menu and automatically navigating through the dialogue tree, like in CRPGs. The complications I'm running into are figuring out how to nest macros that can take the conversation down specific rabbit holes, but also has an option to back up to a higher level of the conversation to chase down other tangents. Does anyone know if there's a tutorial or resource out there that elaborates on dialogue trees? Sorry if this is a confusing request, I'm very new to the macros side of things so I'm not entirely sure how to properly describe what I'm envisioning.    
1738420491

Edited 1738420773
Here's what I have so far #Intro-DT-R&R &{template:default}{{name=Entering Roots & Remedies}}{{?{The smell of burnt earth and spicy incense chokes the air of the cramped, mud-tracked shop. Bunches of dried herbs hang from the ceiling, along with dangling pots, presses, alchemical apparatuses, and glassware of more arcane purposes. Pouches of rare plants, jars of colored glass, and all manner of dried, preserved, and jellied animal parts fill high shelves and tables doing double duty as displays and workspaces. In the shop’s rear, a rail-thin woman with severe-l­ooking spectacles and braided hair pulled back tightly busies herself between an overpacked rack of herbs, a table covered in stray powders and measuring equipment, and a pot loudly b­ubbling over with thick gray froth.| Ok, #1st-Visit-DT| Goodbye, *Leaves*}}}  #1st-Visit-DT &{template:default}{{name=Response}}{{?{Over the din of her work and without looking up, the woman impatiently shouts, "And what’s your problem?”| Familiar, "Hi auntie! It's me!"|Hurt, "That's no way to talk to your nephew!"|Professional, "I'm here to help cure the plague."|Naive, "I didn't mean to bother you, ma'am - I'm just here to help out!"}}}
When I go through the #Intro-DT-R&R macro, these are the two outputs I get: The leave option works fine, but the "Ok" option just prints the nested macro name as text. How do I get the "Ok" option to start the #1st-Visit-DT macro?    
1738422689
The Aaron
Roll20 Production Team
API Scripter
I love the idea of story trees! One problem with how you're implementing it is that players can't select NPCs, they can only select tokens they control. If you're ok with giving them control of a token/character that is an NPC, you could make that work, but I don't know how satisfactory it would be.  This is really something for which Mod (APIi) Scripts are ideally suited, but that requires a Pro subscription.  To do this at the Plus/Free level, you'd probably be better off using the default roll template and a menu of macro command buttons. That still leaves the problem of kicking off the dialog, but you could have a macro for each NPC which you use to whisper the conversation start to above player. 
1738427148
GiGs
Pro
Sheet Author
API Scripter
I would use the @{target| syntaz to trigger macros, and use a token state image to show which tokens are linked to characters with a dialog tree. That said, I don't think it's possible to do this in a satisfactory way without scripts. You have no way to mark a dialog option as used, so all dialog options will always be available no matter what the player has previously selected. Regarding your issue: it sounds like you're running into the demands of html substitution. You can't nest macro queries inside queries without them, and the nesting syntax gets increasingly arcane the more you try this. Honestly, I would just stick to talking things out with your players - roll20 isnt good for a lot of things that would seem straightforward in a computer rpg.
1738437864

Edited 1738438122
Try using chat menus instead of using the query function ?{}.  Display the descriptive text in the template description and also add command buttons to the descriptions for the various choices.  Each button references a different ability on the NCP sheet.  You can even add a [Back] button to go back to the previous description.  The default template doesn't have the best formatting so you might want to experiment with other templates if your sheet has them.  Here's an example using the default template (you'll need to change Test_NPC references to the name of the your NPC sheet.): &{template:default}{{name=Entering Roots & Remedies}}{{The smell of burnt earth and spicy incense chokes the air of the cramped, mud-tracked shop. Bunches of dried herbs hang from the ceiling, along with dangling pots, presses, alchemical apparatuses, and glassware of more arcane purposes. Pouches of rare plants, jars of colored glass, and all manner of dried, preserved, and jellied animal parts fill high shelves and tables doing double duty as displays and workspaces. In the shop’s rear, a rail-thin woman with severe-l­ooking spectacles and braided hair pulled back tightly busies herself between an overpacked rack of herbs, a table covered in stray powders and measuring equipment, and a pot loudly b­ubbling over with thick gray froth. [Ok](~Test_NPC|1st-Visit-DT) [Goodbye](~Test_NPC|Leaves)}} 
1738454313

Edited 1738455053
Damien V. said: Here's what I have so far #Intro-DT-R&R &{template:default}{{name=Entering Roots & Remedies}}{{?{The smell of burnt earth and spicy incense chokes the air of the cramped, mud-tracked shop. Bunches of dried herbs hang from the ceiling, along with dangling pots, presses, alchemical apparatuses, and glassware of more arcane purposes. Pouches of rare plants, jars of colored glass, and all manner of dried, preserved, and jellied animal parts fill high shelves and tables doing double duty as displays and workspaces. In the shop’s rear, a rail-thin woman with severe-l­ooking spectacles and braided hair pulled back tightly busies herself between an overpacked rack of herbs, a table covered in stray powders and measuring equipment, and a pot loudly b­ubbling over with thick gray froth.| Ok, #1st-Visit-DT| Goodbye, *Leaves*}}}  #1st-Visit-DT &{template:default}{{name=Response}}{{?{Over the din of her work and without looking up, the woman impatiently shouts, "And what’s your problem?”| Familiar, "Hi auntie! It's me!"|Hurt, "That's no way to talk to your nephew!"|Professional, "I'm here to help cure the plague."|Naive, "I didn't mean to bother you, ma'am - I'm just here to help out!"}}} If you don't want to give players control of your NPCs, go to the Attributes & Abilities tab of the NPC character sheet and give them an attribute called "INTERACTIONS".  Then fill the INTERACTION field with the name of their macro chain, preceded by a "#". Then, you can give your players access to a macro which uses the @{Target|INTERACTION} command in order to reference your macro in chat. The player can then copy/paste the name of the macro into chat and it will access the proper interaction macro from there.  So, for example, you create an innkeeper character sheet and give it an attribute titled: "#NPC-INTERACTIONS-BIG-CITY-INNKEEPER".  Once your player uses their macro and targets the innkeeper, their macro in chat will show the name of the macro is " #NPC-INTERACTIONS-BIG-CITY-INNKEEPER".  They then copy/paste it into chat and that will start the dialogue with the innkeeper.
wow! Thanks for all the advice! I'm going to try implementing a few of these options and get back to this thread with updates when/if I make headway.  
What about a social meta-macro that all players have that connects them to the conversation tree macros of NPCs they know? I could add the various NPCs they meet into their macros as they meet them, and players could activate their macro and the pulldown menu to discuss things with NPCs. I'd have to let them know when they can converse with NPCs, of course, because the social meta macro would always be available to the players, even when they're nowhere near the NPCs because I don't know how I'd implement proximity into this, but I think that might work. will experiment and get back to you.
1738469844

Edited 1738469881
I did something similar to this with a solo adventure i bought. I didn't do it with macros though. I did it wth handouts. since handouts can easily link to each other, it is simple to create a recursive story tree.
Alternatively, you could create a character sheet not visible to the players but give the players edit rights to it, save the dialogue tree macros as abilities on it under the name of the npc, give the macro sheet an attribute named prefix consisting of @{, (no comma), and give the players (assuming you named the macro sheet macro sheet) @{macro sheet|prefix}macro sheet|@{target|character_name}} As a macro to call. Then, if you're using a character sheet featuring repeating lists, you could co-opt one of those lists to contain the names of npcs, and build a dynamic list that loads those names, optionally only showing ones you've marked active, and sends out into the chat a list of buttons to initiate the relevant macros. This latter part is a little bit more complex, though, and I don't currently have access to a pc, so I can't really write it out right now.