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

[5e OGL Sheet] [Macro Help] Tracking charges for Wand of Magic Missiles

1528213806

Edited 1528217207
I've got it all set up except I don't know of a way to deduct variable amounts of ammo. How do I make it deduct the amount of charges used, rather than just deducting one each time? Here's the current macro: @{Enid Ilphelkiir|wtype}&{template:atkdmg} {{mod=-}} {{rname=Magic Missile}} {{r1=[[0d20cs>20]]}} {{r2=[[0d20cs>20]]}} 0 {{range=120 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[3d4 + 3]]}} {{dmg1type=Force }} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[3d4 + 3[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}} {{hldmg=[[(1*?{How many Charges?|1,0|2,1|3,2|4,3|5,4|6,5|7,6})d4+(1*?{How many Charges?|1,0|2,1|3,2|4,3|5,4|6,5|7,6})]]}}}} ammo=Wand charges|-Kglj9IT-S9i_DN8248J @{Enid Ilphelkiir|charname_output}
1528234339

Edited 1528234402
vÍnce
Pro
Sheet Author
There's a script call  Ammo that can probably handle tracking resources.  Also, depending on the system(PF and 5e come to mind), there are a couple "Companion" scripts that have resource tracking built-in.
Yeah, I'm using the 5e OGL companion script.  It is tracking ammo already.  I just need to figure out if there's a way to decrement by more than one charge each cast.
1528236805
vÍnce
Pro
Sheet Author
Hmm. I don't think the 5e companion script can do this.&nbsp; Maybe ammo or ChatSetAttr script? example:&nbsp; <a href="https://app.roll20.net/forum/permalink/4174759/" rel="nofollow">https://app.roll20.net/forum/permalink/4174759/</a>
1528242474

Edited 1528242498
The companion script now (I think for at least 6 months) has the capability to detract multiple uses. You just need to put a comma ( , ) after the resource name. For example Arrows,2
1528242853
vÍnce
Pro
Sheet Author
Kyle G. said: The companion script now (I think for at least 6 months) has the capability to detract multiple uses. You just need to put a comma ( , ) after the resource name. For example Arrows,2 You're awesome Kyle!
That's great!&nbsp; Thanks Kyle.&nbsp; I should probably have just read the companion script documentation.
Follow up question. The amount of charges used are a variable number, not a static one.&nbsp; I've tried this: ammo=Wand charges,1+?{How many Charges?|1,0|2,1|3,2|4,3|5,4|6,5|7,6}|-Kglj9IT-S9i_DN8248J But I'm still only deducting one charge each time no matter how many I spend.&nbsp;
You aren't actually adding the two numbers together. Try putting it inside an inline calculation, however that probably won't work either. Looking at the code in the script, it can't handle an inline calculation like that. What you could do that is perform the calculation yourself, use this: ammo=Wand charges,?{How many Charges?|1|2|3|4|5|6|7} I imagine that you are using this query elsewhere in the attack, most likely to determine how many magical darts are created. If so, I would recommend only adding 2 to this value instead of the 3 that you are currently using. This will make it so that the number of darts is calculated correctly and should allow the companion script to decrement the proper number of charges.
Using your syntax by itself doesn't work. When I add the resource ID back onto it, it works well, except that it subtracts one fewer charges than it should: ammo=Wand Charges,?{How many Charges?|1|2|3|4|5|6|7}|-Kglj9IT-S9i_DN8248J Changing to ex. {How many Charges?|1,x|2,x|etc.}|-ID doesn't change the result no matter what number replaces x. Even changing it to: {How many Charges?|2|3|etc.}|-ID gives me zero charge use for 1 charge, 1 use for 2, etc. Finally, just using ammo=Wand Charges,?{How many Charges?}|-ID gives the same result (one too few charges used). We were so close! Finally, I figured out to just change how I used the query earlier in the macro.&nbsp; Ended up with this, which works perfectly: @{Enid Ilphelkiir|wtype}&{template:atkdmg} {{rname=Magic Missile}} {{range=120 ft}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[3d4 + 3]]}} {{dmg1type=Force }} {{hldmg=[[(?{How many Charges?|1|2|3|4|5|6|7}-1)d4+(?{How many Charges?}-1)]]}} ammo=Wand Charges,?{How many Charges?}|-Kglj9IT-S9i_DN8248J @{Enid Ilphelkiir|charname_output} Thanks for the help, Kyle.
Walrus said: Using your syntax by itself doesn't work. When I add the resource ID back onto it, it works well, except that it subtracts one fewer charges than it should: That is extremely strange. I'll dig a bit more into the code and see if there why that's happening. It's certainly is a bug though.
To be clear, the number of charges being deducted was due to the fact that I'd used that query earlier, so its value was defined already before I used it as the ammo argument.&nbsp; But yeah, it wouldn't deduct any ammo at all without the resource ID argument.&nbsp; (it had, the first time I'd used the macro, but every time I changed it afterward I had to include the ID or it would not deduct anything)
Walrus said: To be clear, the number of charges being deducted was due to the fact that I'd used that query earlier, so its value was defined already before I used it as the ammo argument.&nbsp; Ah OK. That is the expected functionality then. Walrus said: But yeah, it wouldn't deduct any ammo at all without the resource ID argument. (it had, the first time I'd used the macro, but every time I changed it afterward I had to include the ID or it would not deduct anything) This is also strange though because if there is no ID, then the script should add it in for you by looking for the name. Unless you removed the ID but left the pipe ( | &nbsp;) in the field. If there is a pipe in the field, the script assumes the ID is present, if there is no pipe the script is supposed &nbsp;to look for an ID using the resource's name.
I was pretty sure I was removing the pipe, but just double checked it.&nbsp; Here is the syntax I'm using that causes it to not deduct any ammo. ammo=Wand Charges,?{How many Charges?} Even if I remove everything after the comma, so it's just "ammo+Wand Charges" it deducts no charges. Does it matter that I'm using this macro from the Abilities section of the sheet, and as a token action?
Walrus said: Does it matter that I'm using this macro from the Abilities section of the sheet, and as a token action? Yes! Ok so that's why you are running in to this problem and need the ammo ID to get it to work. If the roll was set up in the ATTACKS & SPELLCASTING section of the character sheet, it would update the ammo section for you with the ID for the resource.
Kyle G. said: Walrus said: Does it matter that I'm using this macro from the Abilities section of the sheet, and as a token action? Yes! Ok so that's why you are running in to this problem and need the ammo ID to get it to work. If the roll was set up in the ATTACKS & SPELLCASTING section of the character sheet, it would update the ammo section for you with the ID for the resource. Hah!&nbsp; There you go.&nbsp; Sorry for the confusion, and thanks again for all the help.