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

Class Resource management with Staff of Striking macro

I am using a modified version of @john-g's Staff of Striking macro, and would like to have the macro remove the number of charges selected in the Staff of Striking macro's pull down menu @(repeating_resource_right_name). Here is the current state of the macro without any class resource code. @{Gwyth Millithor|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Staff of Striking}} {{r1=[[@{Gwyth Millithor|d20}cs>20 +3[STR] + 2[PROF] + 3[MAGIC]]]}} @{Gwyth Millithor|rtype}cs>20 + 2[PROF] + 3[MAGIC]]]}} {{attack=1}} {{range=}} {{dmg1=[[1d6+ ?{Charges|0,0|1,1|2,2|3,3}d6 + 3[MOD] + 3[MAGIC]]]}} {{dmg1type=Bludgeoning }} {{damage=1}} {{dmg2flag=1}} {{dmg2=[[1d8+ ?{Charges}d6 + 3[MOD] +3[MAGIC]]]}} {{dmg2type=Bludgeoning }} {{crit1=[[1d6[CRIT]]]}} {{crit2=[[1d8[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Gwyth Millithor|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=Bonus Damage}} ammo= @{Gwyth Millithor|charname_output} Thanks in advance
1626546664
timmaugh
Pro
API Scripter
A macro can't modify an attribute on its own, so that will require an API script. There are some that deal with ammo, inventory, or resources that you might be able to use to get to your goal, but they might change your command line (above) to allow them to handle decrementing your charge count. On the other hand, metascripts can work right in your macro. You would need to add three basic things to your command line... 1) start with an exclamation point 2) include a {& simple} in the line (because although you are starting with the ! to make it an API call and trigger the metascripts, you want to end with a basic output again) 3) include an {& eval} block (from the Plugger metascript) to run a ChatSetAttrs macro line. The only thing I can't do without more information is exactly name and reference the repeating attribute for the charges... You can muck about and find it yourself, then supply it to the below EVAL block, or you can use Fetch (a metascript) to find it for you. The following Fetch construction looks for a sub-attribute called "resource_right" in the "resource" list for an entry where the "resource_right_name" of the element includes "Staff": *(Gwyth Millithor.resource.[resource_right_name~Staff].resource_right) Then your EVAL block would be: {& eval}setattr --charid @(Gwyth Millithor.character_id) --*(Gwyth Millithor.resource.[resource_right_name~Staff].resource_right_name)|[\][\]*(Gwyth Millithor.resource.[resource_right_name~Staff].resource_right)-?{Charges}\]\].value{& /eval} Add that to your command line (at the end will do), and it should take the answer you give to your ?{Charges} roll query and feed it to a math operation where those charges are decremented from the specified resource. The finished product of your macro would be something like: !@{Gwyth Millithor|wtype}&{template:atkdmg} {{mod=+5}} {{rname=Staff of Striking}} {{r1=[[@{Gwyth Millithor|d20}cs>20 +3[STR] + 2[PROF] + 3[MAGIC]]]}} @{Gwyth Millithor|rtype}cs>20 + 2[PROF] + 3[MAGIC]]]}} {{attack=1}} {{range=}} {{dmg1=[[1d6+ ?{Charges|0,0|1,1|2,2|3,3}d6 + 3[MOD] + 3[MAGIC]]]}} {{dmg1type=Bludgeoning }} {{damage=1}} {{dmg2flag=1}} {{dmg2=[[1d8+ ?{Charges}d6 + 3[MOD] +3[MAGIC]]]}} {{dmg2type=Bludgeoning }} {{crit1=[[1d6[CRIT]]]}} {{crit2=[[1d8[CRIT]]]}} 0 {{desc=}}   {{spelllevel=}} {{innate=}} {{globalattack=@{Gwyth Millithor|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=Bonus Damage}} ammo= @{Gwyth Millithor|charname_output} {&simple}{& eval}setattr --charid @(Gwyth Millithor.character_id) --*(Gwyth Millithor.resource.[resource_right_name~Staff].resource_right_name)|[\][\]*(Gwyth Millithor.resource.[resource_right_name~Staff].resource_right)-?{Charges}\]\].value{& /eval} Scripts required: ZeroFrame , Fetch , Plugger , ChatSetAttr, and probably SelectManager (I'm not completely familiar with the sheet you're using to identify the repeating attribute exactly. What sheet is that?)
Thanks @timmaugh. The sheet is the 5e OGL sheet. You might not recognize the "repeating_resoure_right" box, as they are the Class Resource boxes when you add more resource boxes. The sheet automatically uses the first couple of boxes for Channel Divinity and the War Priest ability, so extra boxes were added to record other resource.
1627144808
timmaugh
Pro
API Scripter
Ok, I think that macro should be what you need. If it doesn't work, post back and we'll figure it out.