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

[D&D5E] Need help making a complicated-ish Weapon Macro that uses Reused Rolls

Going to start blunt by saying this weapon aims to mimic the arm cannon from metroid, blatantly. The thing i need help right away with is, I set the "Spazer Beam" to multiply the damage outputs of the other beams by 1d3 since it shoots 3 beams instead of 1, but for some attempt at balance, being a 1d3, two of the shots could miss, leaving the multiple at a simple 1 per shot. Now, I could very easily just do [[1d3*(every other beam damage combined)]], but I do not want to do that, and instead want to integrate said 1d3 within the actual beam damage rolls themselves. The issue is I can't simply do [[1d3*(powerbeam damage)]] + [[1d3*(ice beam damage)]], since those will roll 2 1d3s separately, therefore having inconsistent results. I have made attributes for each beam, and if desired will post how they work in full (it's a bit, so I don't want to spam the post on the first message if not necessary). For a basic idea on what I did, I made a Resource on my character sheet for each beam, and have their values be either 0 or 1. Then in Attributes and Abilities under the Attributes field, I created a reference to it (example, Ice Beam) that will output two different things dependant on if the resource value is 0 or 1. I have attributes for this for the damage type, and the actual damage roll itself. Another beam I have is the Charge Beam, which is a flat multiple of 3, should its resource value be 1. I have integrated this into the other beams damage values as it would be consistent throughout. (ie the attribute ChargeBeamDamage1: "*3", and under IceBeamDamage: "1d4@{ChargeBeamDamage}[Ice] + " (making it 1d4*3 if the Chargebeam Resource = 1) (the + at the end is for chaining beams together, up to the [MODS] section of the damage roll) The goal I have in mind would be similar to the charge beam, but for the Spazer Beam. However, I cannot simply make @{SpazerDamage} a 1d3 and put that into a beam damage field, as it would simply run 1d3 several times and won't be consistent. Might there be a way I can re-use a single 1d3 to get the same value in each beam damage field? Here is my current attack damage macro for the cannon: &{template:dmg} {{attack=1}} {{dmg1flag=1}} {{dmg1=[[@{ACSBD} ([[1d6@{ACCBD}]][Power] + @{ACIBD}@{ACWBD}@{ACPBD}@{ACNBD}[[@{spell_attack_bonus}-@{pb}]][SPELL] + [[1[Crafted] + 1[Adamantine] + 1[Magic] + (floor(@{level}/10)+1*@{repeating_resource_$1_resource_left})[Infused]]][MOD])]]}} {{dmg1type=@{ACCBT}@{ACSBT}Force@{ACIBT}@{ACWBT}@{ACPBT}@{ACNBT}}} {{globaldamage=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} (spazer (@{ACSBD}) is still in its old place, multiplying everything within the parenthesis) (For clarification, I acronym my beam attributes as "AC?BT" or "AC?BD" (AC = Arm-Cannon, ? = weapon (Power, Ice etc), B = Beam, T = damagetype, D = damageroll. C = Charge, S = Spazer, I = Ice, W = Wave, P = Plasma, N = Nova) I appreciate any assistance, if you want me to display my attributes in whole, let me know and I'll do so.
1712583622
timmaugh
Pro
API Scripter
In general Roll20 syntax (without bringing scripts into the frame), while you can reference a roll to get its value when you're *outside* another roll, you can't reference that roll to get its value while you're *in* another roll. That is, you can't use a roll outside of its own roll geneology (increasing depths of double brackets). The best you can do is to nest rolls within each other in such a way that each successive expansion un-does the math of the previous roll, and then refer to the rolls later, outside of any roll, as necessary. For instance... imagine wanting to re-use a d3 to multiply by 4 different attributes (attrA, attrB, attrC, attrD)... The basic roll would be: [[ 1d3 * @{attrA} ]] So then the next encompassing roll (for attrB) would have to undo the math of attrA: [[ [[1d3 * @{attrA} ]] * @{attrB} / @{attrA} ]] In that case, if you had to refer to them later, $[[0]] would refer to the attrA result, while $[[1]] would refer to the attrB result. (I understand in your case you probably don't want to refer to them later, you want the math correct to begin with... that's next.) The next expansion would be the attrC roll (it will be $[[2]]), and will undo the math of attrB: [[ [[ [[1d3 * @{attrA} ]] * @{attrB} / @{attrA} ]]  * @{attrC} / @{attrB} ]] And then finally attrD would undo the math of attrC: [[ [[ [[ [[1d3 * @{attrA} ]] * @{attrB} / @{attrA} ]]  * @{attrC} / @{attrB} ]] * @{attrD} / @{attrC} ]] That works for non-0 attributes. The problem with this is if you have a 0 in one of the attributes, you'd be producing a 0 by the multiplication but also you'd be dividing by zero elsewhere so you'd throw an error. The way around this (as long as you're dealing with integer valued attributes) would be to use a keep-high formation. For instance, taking just a binary choice between attrA and attrB, where you would only have 1 of them activated (eg, one is activated while the other is inactive), you can change the divisor into a 1 if it is 0: [[ [[1d3 * [[ {1, @{attrA} }kh1 ]] ]] * @{attrB} / [[ {1, @{attrA} }kh1 ]] ]] That's the general idea... and I'm not saying this is specifically going to fix your problem... I'm not sure I understand what you're trying to do. What I'm saying is that this "building out" construction is the way you have to think about constructing complex rolls like this. Of course, if scripts are available, this is fairly trivial to accomplish with metascripts, so post back if scripts are available and I'll show you how.
Hello, thank you for the informal post. I'll likely have to take a few reads to fully comprehend it since this is a bit more advanced than I am yet learned, but it is neat. Scripts at this time are uncertainly unavailable, as I am currently limited to using macros from the character sheet (I do not know/think the API is enabled in the game I am playing in, and Rolltables also are not set up). I have been essentially on a learning grind w/ macros alone for quite some time (and I admit, it's cool all you can actually do using them) I'm not certain if this will help, but I will try to clarify my overall goal - I may end up sending repeated information, but I will try to bring clarity with the idea I have My ultimate goal is this: I want to make my damage roll look nicer by integrating the damage multipliers of the Charge and Spazer Beam into the actual rolls of each beam, so that when the roll is output, I only see "[[1d6]][power] + [[1d4]][ice] + etc etc", rather than needing the initial "[[3[Spazer] * ([[1d6]][Power] + [[1d4]][Ice] + etc)]]" (primarily with the goal of being able to determine resistance/vulnerability damages with seeing the damage of each beam type) Having the final damage number would be much easier than having to do the math on how much the spazers resulting 1d3 multiplies each beams damage, plus it may be more visually pleasing to look at the inline roll this way as well, since there would be less information to have to read. As said, I was able to get this working with the Charge Beam due to that being a consistent number - either nothing at all (@{chargebeam0}) or 3 (@{chargebeam1}), but due to the inconsistent nature of 1d# die, the spazer is certainly more complicated to work with in this way I am looking to do this via Attributes somehow, but am not against using normal macro stuff as well to do so. One thing I enjoy about the setup I have now is that if I disable any beam I have (setting its sheet resource value to 0 over 1), it vanishes from all instances of the attack roll (damage roll, damage type, etc), which is very neat imo. So if it is something that can be done while keeping this functionality, that would also be good.