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/API to recharge magic wand charges when player clicks the "Long Rest" button in D&D 5E 2014 character sheet

January 16 (4 weeks ago)

Edited January 16 (4 weeks ago)

I am a brand new pro user and have very little knowledge of the APIs. Currently the only API have in my campaign is the "5th Edition OGL by Roll20 Companion". My players have a few magic items that regain 1d6+x charges at dawn/dusk/etc. I wondering if there is an easy macro/api that will automatically update the charges in the resource tracker when the "Long Rest" button is clicked on the player's character sheet?

January 16 (4 weeks ago)

Edited January 16 (4 weeks ago)

That's a feature built into the sheet, you don't need any macros or scripts for that. Hover over the resource tracker, click the gear, and set it to reset on long rest, and you're done.

EDIT: nevermind, I was reading distracted, you want the random amount restored.

January 16 (4 weeks ago)
Gauss
Forum Champion

Hi Sam S., 

No, there is no Mod (API Script) that you can tie into the Long Rest button. Perhaps one can listen for it though, not sure. 

There are a number of API Scripts for use with resting that may be able to do what you want. Alternately I use ChatSetAttr and just define everything. 

Short Rest example:

/w GM &{template:default} {{name=Short Rest before-report}} {{HP=@{hp} / @{hp|max}}} {{Temp HP=@{hp_temp} / -}} {{Hitdice=@{hit_dice} / @{hit_dice|max}}} {{@{class_resource_name}=@{class_resource} / @{class_resource|max}}} {{@{other_resource_name}=@{other_resource} / @{other_resource|max}}} {{@{repeating_resource_$0_resource_left_name}=@{repeating_resource_$0_resource_left} / @{repeating_resource_$0_resource_left|max}}} {{@{repeating_resource_$0_resource_right_name}=@{repeating_resource_$0_resource_right} / @{repeating_resource_$0_resource_right|max}}}{{@{repeating_resource_$1_resource_left_name}=@{repeating_resource_$1_resource_left} / @{repeating_resource_$1_resource_left|max}}} {{@{repeating_resource_$1_resource_right_name}=@{repeating_resource_$1_resource_right} / @{repeating_resource_$1_resource_right|max}}} {{@{repeating_resource_$2_resource_left_name}=@{repeating_resource_$2_resource_left} / @{repeating_resource_$2_resource_left|max}}} {{@{repeating_resource_$2_resource_right_name}=@{repeating_resource_$2_resource_right} / @{repeating_resource_$2_resource_right|max}}} {{Level 1 spells=@{lvl1_slots_expended} / @{lvl1_slots_total}}} {{Level 2 spells=@{lvl2_slots_expended} / @{lvl2_slots_total}}} {{Level 3 spells=@{lvl3_slots_expended} / @{lvl3_slots_total}}} {{[Chef: +1d8 HP to 
people expending HD
1/short rest](~Grimdal|Chef)}} {{[Expend Hit Dice to heal (@{Grimdal|hit_dice}/@{Grimdal|hit_dice|max})](~Grimdal|Expend-HD)}} {{[After report button](~Grimdal|After-Short-Report)}}

!setattr {{
--name Grimdal
--nocreate
--evaluate
--hp_temp|[[{@{hp_temp},@{base_level}+@{Nalsar_charisma_mod}}kh1]]
}}

Long Rest example: 
/w GM &{template:default} {{name=Long Rest before-report}} {{HP=@{hp} / @{hp|max}}} {{Temp HP=@{hp_temp} / -}} {{Hitdice=@{hit_dice} / @{hit_dice|max}}} {{@{class_resource_name}=@{class_resource} / @{class_resource|max}}} {{@{other_resource_name}=@{other_resource} / @{other_resource|max}}} {{@{repeating_resource_$0_resource_left_name}=@{repeating_resource_$0_resource_left} / @{repeating_resource_$0_resource_left|max}}} {{@{repeating_resource_$0_resource_right_name}=@{repeating_resource_$0_resource_right} / @{repeating_resource_$0_resource_right|max}}}{{@{repeating_resource_$1_resource_left_name}=@{repeating_resource_$1_resource_left} / @{repeating_resource_$1_resource_left|max}}} {{@{repeating_resource_$1_resource_right_name}=@{repeating_resource_$1_resource_right} / @{repeating_resource_$1_resource_right|max}}} {{@{repeating_resource_$2_resource_left_name}=@{repeating_resource_$2_resource_left} / @{repeating_resource_$2_resource_left|max}}} {{@{repeating_resource_$2_resource_right_name}=@{repeating_resource_$2_resource_right} / @{repeating_resource_$2_resource_right|max}}} {{Level 1 spells=@{lvl1_slots_expended} / @{lvl1_slots_total}}} {{Level 2 spells=@{lvl2_slots_expended} / @{lvl2_slots_total}}} {{Level 3 spells=@{lvl3_slots_expended} / @{lvl3_slots_total}}} {{Level 1 spells=@{lvl1_slots_expended} / @{lvl1_slots_total}}} {{Level 2 spells=@{lvl2_slots_expended} / @{lvl2_slots_total}}} {{Level 3 spells=@{lvl3_slots_expended} / @{lvl3_slots_total}}} {{[After report button](~Grimdal|After-Long-Report)}}
/w Grimdal **May prepare different spells and change infusions**
/w GM **note: during a long rest you are immobile but conscious for 6 hours**

!setattr {{
--name Grimdal
--nocreate
--HP|@{hp|max}
--hp_temp|[[@{base_level}+@{Nalsar_charisma_mod}]]
--Hit_Dice|@{hit_dice|max}
--other_resource|[[{@{other_resource}-1,0}kh1]]
--repeating_resource_$0_resource_left|@{repeating_resource_$0_resource_left|max}
--repeating_resource_$0_resource_right|@{repeating_resource_$0_resource_right|max}
--repeating_resource_$1_resource_left|@{repeating_resource_$1_resource_left|max}
--repeating_resource_$1_resource_right|@{repeating_resource_$1_resource_right|max}
--lvl1_slots_expended|@{lvl1_slots_total}
--lvl2_slots_expended|@{lvl2_slots_total}
--lvl3_slots_expended|@{lvl3_slots_total}
}}

Note that I don't have it set to silent yet, as soon as my players don't like the gibberish notification I will do so.