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

Macro to run a Conditional Encounter


Edited 1620854701
First time poster, been having fun running macros and still very new at it. I'm running a campaign in Waterdeep D&D 5e. My players will be walking through the city. Some neighborhoods are more dangerous than others. 2nd edition has ratings of how dangerous a neighborhood is using a 1-5 rating, 1 safest, 5 most dangerous. I've created 5 separate encounter tables each one correlating to its respective neighborhood. "Encounter-Waterdeep-1" for the safest neighborhood to "Encounter-Waterdeep-5" being the most dangerous. *side note: Each encounter table is weighted so that possibly mundane things happen such as "a fishmonger shouts out his sale as you pass by"  or nothing happens at all. I have a map of the city and will ask players to draw their route from one location to another using the paint tool. In my screen I have the neighborhoods color coded based on how safe or dangerous they are. A player is likely going to run through multiple neighborhoods triggering possible multiple encounters. I'd like a macro that will pop up with questions similar to this all at once: ?{Neighborhood 1 Duration(in minutes):|} ?{Neighborhood 2 Duration(in minutes):|} ?{Neighborhood 3 Duration(in minutes):|} ?{Neighborhood 4 Duration(in minutes):|} ?{Neighborhood 5 Duration(in minutes):|} (So basically a quick questionnaire on how long a player was in each neighborhood.) ex. Player 1 spent 8 minutes in neighborhood 1, 3 minutes in Neighborhood 2 and 1 minute in neighborhood 5.  The answer to each query is where the "Condition" comes in. If Player 1 is in Neighborhood 1, for "x" minutes, then run [["x"t[Encounter-Waterdeep-1]]] So after plugging my answers in from the query: 8,2,0,0,1 So the above example would result in running the following: [[8t[Encounter-Waterdeep-1]]] [[3t[Encounter-Waterdeep-2]]] [[1t[Encounter-Waterdeep-5]]] All in an inline box preferably in the &{template:npcaction} {{rname=Encounters in Waterdeep}} {{name=As you make your way through...}} {{description="results of the macro"}} Pretty much creating a one time unique narrative as a player makes their way through a city. I kind of have a rough idea of the parts, but fitting it all together and having the macro recognize the answers to the query and using that info to run tables is kind of where i'm getting lost. I'm pretty sure I missed a lot of info i probably should have inlcuded so if you need more clarification, ask and I'd be more than happy to answer. Thanks all for your patience

Edited 1620859414
Sheet Author
It looks like you are most of the way there to me.  You just need to throw your first query (number of minutes) in the place of the x in your first table roll example. [[?{Neighborhood 1 Duration(in minutes)?|0}t[Encounter-Waterdeep-1]]] I did insert a 0 for the default value.  Having blank values can break macros, so it is good to have a default. I am not very familiar with the roll templates you have access to with the 5E sheet (since I don't play it), so maybe someone else will come forward with a prettier template to put this in, but using the default template might look like this: &{template:default} {{name=Encounter Generator}} {{Neighborhood 1=[[?{Neighborhood 1 Duration(in minutes)?|0}t[Encounter-Waterdeep-1]]]}} {{Neighborhood 2=[[?{Neighborhood 2 Duration (in minutes)?|0}t[Encounter-Waterdeep-2]]]}} Just continue that pattern for the other neighborhoods. Edit: Depending on how much text there is with each one of these entries, you may end up wanting a separate macro for each neighborhood.  It just depends on how much scrolling you might be in for with (from your example) 11 rolls on the tables in one chat output.

Edited 1620908509
Beautiful! It worked. I never considered embedding the query into the encounter macro. What a great idea! Thanks for the tip. As for the formatting, I can work with that. Cheers -N
Here's a couple options for the D&D 5E by Roll20 sheet: If your players will travel through one neighborhood at a time (or you want to roll each neighborhood one at a time): !?{Which Neighborhood?|1|2|3|4|5} !?{Duration? (in minutes)|0} &{template:npcaction} {{rname=Encounter Generator}} {{description=**Neighborhood ?{Which Neighborhood?}:** [[?{Duration?}t[Encounter-Waterdeep-?{Which Neighborhood?}]]]}} A version that rolls all 5 neighborhoods at the same time: &{template:npcaction} {{rname=Encounter Generator}} {{description=**Neighborhood 1:** [[?{Neighborhood 1 Duration (in minutes)?|0}t[Encounter-Waterdeep-1]]] **Neighborhood 2:** [[?{Neighborhood 2 Duration (in minutes)?|0}t[Encounter-Waterdeep-2]]] **Neighborhood 3:** [[?{Neighborhood 3 Duration (in minutes)?|0}t[Encounter-Waterdeep-3]]] **Neighborhood 4:** [[?{Neighborhood 4 Duration (in minutes)?|0}t[Encounter-Waterdeep-4]]] **Neighborhood 5:** [[?{Neighborhood 5 Duration (in minutes)?|0}t[Encounter-Waterdeep-5]]]}} If you want to use the names of the neighborhoods, you can still do the same thing if you label your tables with their names (based on the Wiki page which has 11 Wards): Waterdeep-CastleWard-Encounter Waterdeep-CityoftheDead-Encounter Waterdeep-DockWard-Encounter Waterdeep-Downshadow-Encounter Waterdeep-FieldWard-Encounter Waterdeep-Mistshore-Encounter Waterdeep-Mountainside-Encounter Waterdeep-NorthWard-Encounter Waterdeep-SeaWard-Encounter Waterdeep-SouthernWard-Encounter Waterdeep-TradesWard-Encounter Waterdeep-Undercliff-Encounter To roll each neighborhood one at a time: !?{Which Neighborhood?|Castle Ward,CastleWard|City of the Dead,CityoftheDead|Dock Ward,DockWard|Downshadow,Downshadow|Field Ward,FieldWard|Mistshore,Mistshore|Mountainside,Mountainside|North Ward,NorthWard|Sea Ward,SeaWard|Southern Ward,SouthernWard|Trades Ward,TradesWard|Undercliff,Undercliff|} !?{Duration? (in minutes)|0} &{template:npcaction} {{rname=Encounter Generator}} {{description=**?{Which Neighborhood?}:** [[?{Duration?}t[Waterdeep-?{Which Neighborhood?}-Encounter]]]}} To rolls all neighborhoods at the same time: &{template:npcaction} {{rname=Encounter Generator}} {{description=**Castle Ward:** [[?{Castle Ward Duration (in minutes)?|0}t[Waterdeep-CastleWard-Encounter]]] **City of the Dead:** [[?{City of the Dead Duration (in minutes)?|0}t[Waterdeep-CityoftheDead-Encounter]]] **Dock Ward:** [[?{Dock Ward Duration (in minutes)?|0}t[Waterdeep-DockWard-Encounter]]] **Downshadow:** [[?{Downshadow Duration (in minutes)?|0}t[Waterdeep-Downshadow-Encounter]]] **Field Ward:** [[?{Field Ward Duration (in minutes)?|0}t[Waterdeep-FieldWard-Encounter]]] **Mistshore:** [[?{Mistshore Duration (in minutes)?|0}t[Waterdeep-Mistshore-Encounter]]] **Mountainside:** [[?{Mountainside Duration (in minutes)?|0}t[Waterdeep-Mountainside-Encounter]]] **North Ward:** [[?{North Ward Duration (in minutes)?|0}t[Waterdeep-NorthWard-Encounter]]] **Sea Ward:** [[?{Sea Ward Duration (in minutes)?|0}t[Waterdeep-SeaWard-Encounter]]] **Southern Ward:** [[?{Southern Ward Duration (in minutes)?|0}t[Waterdeep-SouthernWard-Encounter]]] **Trades Ward:** [[?{Trades Ward Duration (in minutes)?|0}t[Waterdeep-TradesWard-Encounter]]] **Undercliff:** [[?{Undercliff Duration (in minutes)?|0}t[Waterdeep-Undercliff-Encounter]]]}}