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

Create a macro that accesses an attack or ability from a player's character sheet.

I've set up some spell templates for my players by creating NPC character sheet that use cones, circles and line of appropriate sizes, and allowed permission for all players to pull them from the journal as needed. All good so far. What I'd like to do is add a token action to the spell templates of spells that have duration (such as Dust Devil, Insect Plague, Moonbean) so that when the player needs to roll the damage for that spell they can select the topken for spell's cone, sphere, etc., then click the token action to send the spell's effect to the chat - this, instead of having to open their character sheet and select the spell from there. I could just a create a macro for the spell, but they often require a spell's DC for a saving throw, and that depends on the PC that is activating the spell. I don't want to create a separate set of spell templates for each spell-casting PC, so how do I retrieve the spell DC from the character sheet controlled by the player that is triggering the macro? Here's an example of a Moonbeam spell: &{template:dmg} {{rname=Moonbeam}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[2d10]]}} {{dmg1type=Radiant}} {{save=1}} {{saveattr=Constitution}} {{savedesc=Half Damage}}    {{hldmg=[[(1*?{Cast at what level?|Level 2,0|Level 3,1|Level 4,2|Level 5,3|Level 6,4|Level 7,5|Level 8,6|Level 9,7})d10]]}}   {{savedc=savedc}} How do I modify this macro to create a token action that any player (who can cast this spell) can use and have it apply that player's  PC's spell save DC?
1760038221
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Unfortunately, that is not possible as far as I know. I'd recommend using a Mod script like Token Action Maker or Universal Chat Menus to create token actions for each of your player's characters so that then they access the spell macros from their character's token.
1760038779

Edited 1760039056
Gauss
Forum Champion
Rick A., Which character sheet are you using? If D&D 5e 2014, @{spell_save_dc} is the attribute you need.  You can add a chat menu button in the spell description that calls the macro.  BTW, there are a number of folks (myself included) who have created dynamic chat menu spell lists. (Dynamic = only shows prepared spells)
Yes, that's what I do now. I was just wondering if there was a way to do it from the spell template token. Some of my players don't care for the clutter of having too many token actions strung out across their screen every time they select their PC's token, and for some reason they don't like chat menus <shrug>. Scott C. said: Unfortunately, that is not possible as far as I know. I'd recommend using a Mod script like Token Action Maker or Universal Chat Menus to create token actions for each of your player's characters so that then they access the spell macros from their character's token.
1760039152
Gauss
Forum Champion
The problem with doing it from a Spell Template Token is that it wouldn't know which character is the caster.  Selecting the token for the spell template would bring up the token action, but from there we cannot use selected for the character name for any attributes. Target would work, or you could set up a query. 
The query idea would likely work. I would just ask the player for there PC's save DC when they use the spell but none of them can ever remember it :/ Gauss said: The problem with doing it from a Spell Template Token is that it wouldn't know which character is the caster.  Selecting the token for the spell template would bring up the token action, but from there we cannot use selected for the character name for any attributes. Target would work, or you could set up a query. 
There's no way for a regular macro to know which character(s) a player controls. It could be done with a Mod script - I think Metascripts could insert the appropriate character ID based on the controlling player, but I'd have to dig into the documentation if Timmaugh doesn't weigh in. Otherwise, there's a few convoluted options if your players are not willing to use Token Actions on their character sheets or chat menus. FYI, if clutter is an issue, one approach is to use Stylus so that the Token Action toolbar does not take up so much room.      1. Macro Overloading  (this is your best option, but I haven't tested it so there may be an Order of Operations issue; it can also add a lot of items to your Collections macros if you use it for multiple things) Create several identically named Collections macros (such as 'SaveDC') and in the current spell macro you are using put in {{savedc=#SaveDC}} Each SaveDC Collections macro will look like: @{CHARACTERNAME| spell_save_dc}      2. Query (your players will have to select their character from a dropdown each time they use one of the spell templates) Replace the savedc section with: {{savedc=?{Which Character?|Character Name 1, @{CHARACTERNAME1| spell_save_dc}| Character Name 2, @{CHARACTERNAME2| spell_save_dc}| Character Name 3, @{CHARACTERNAME3| spell_save_dc}}   }}      3. Target (your players will run the command and then have to click on their token when prompted) Replace the savedc section with: {{savedc=@{target | spell_save_dc}   }}      4. Separate Spell Template characters for each player (which you said you didn't want to do) Create duplicate identical Spell Templates for each player, and substitute the  savedc section in each one with their character's  spell_save_dc  attribute. 
Since you are Pro sub, Mods are a possibility, ScriptCards could also help with this depending upon your setup and preferences for your table. If you are curious about a ScriptCards method for this, I can possibly help out. I would just need to know a little bit more about the setup of the spell templates but I do something similar in my games. I will use ScriptCards to summon the spell template onto the table top and then with that ScriptCards can fill in the bar values of the template token with useful info about the level the spell is cast, spell save DC, etc; that sort of information. I have older ScriptCards that used SpawnDefaultToken Mod but ScriptCards now has the capability to create tokens I need to go through and update those to replace !Spawn with a pure ScriptCards version. Well no thread in these forums is complete without me pushing ScriptCards as a possible solution. Let me know if you are interested in that line.
Wow! First, thanks for the thought and effort you put in that post :)  The thing is, creating dedicated spell templates would be simpler: all I'd have to do is take the one I have, duplicate and rename the dupes (e.g., Mist's Moonbeam, Abner's Moonbeam, etc), then restrict permissions for each copy to the specific players. I could then dedicate the spell save DC to those specific character sheets. My goal was simplification and reducing clutter in the journal. Still, this discussion is coming up with options that could be useful in other cases, and that's always a good thing! Jarren said: There's no way for a regular macro to know which character(s) a player controls. It could be done with a Mod script - I think Metascripts could insert the appropriate character ID based on the controlling player, but I'd have to dig into the documentation if Timmaugh doesn't weigh in. Otherwise, there's a few convoluted options if your players are not willing to use Token Actions on their character sheets or chat menus. FYI, if clutter is an issue, one approach is to use Stylus so that the Token Action toolbar does not take up so much room.      1. Macro Overloading  (this is your best option, but I haven't tested it so there may be an Order of Operations issue; it can also add a lot of items to your Collections macros if you use it for multiple things) Create several identically named Collections macros (such as 'SaveDC') and in the current spell macro you are using put in {{savedc=#SaveDC}} Each SaveDC Collections macro will look like: @{CHARACTERNAME| spell_save_dc}      2. Query (your players will have to select their character from a dropdown each time they use one of the spell templates) Replace the savedc section with: {{savedc=?{Which Character?|Character Name 1, @{CHARACTERNAME1| spell_save_dc}| Character Name 2, @{CHARACTERNAME2| spell_save_dc}| Character Name 3, @{CHARACTERNAME3| spell_save_dc}}   }}      3. Target (your players will run the command and then have to click on their token when prompted) Replace the savedc section with: {{savedc=@{target | spell_save_dc}   }}      4. Separate Spell Template characters for each player (which you said you didn't want to do) Create duplicate identical Spell Templates for each player, and substitute the  savedc section in each one with their character's  spell_save_dc  attribute.
Thanks for the suggestion Joshua, but as I said above in reply to Jarren, my goal was to simplify things. :)  I'm not a programmer (writing macros that use built-in and MOD functions and using already designed templates are my limit) and having looked into Scriptcards a while ago I decided then that it's too close to actual "coding" for my slowly calcifying brain to tackle :D. I may look into it again later. Joshua N. said: Since you are Pro sub, Mods are a possibility, ScriptCards could also help with this depending upon your setup and preferences for your table. If you are curious about a ScriptCards method for this, I can possibly help out. I would just need to know a little bit more about the setup of the spell templates but I do something similar in my games. I will use ScriptCards to summon the spell template onto the table top and then with that ScriptCards can fill in the bar values of the template token with useful info about the level the spell is cast, spell save DC, etc; that sort of information. I have older ScriptCards that used SpawnDefaultToken Mod but ScriptCards now has the capability to create tokens I need to go through and update those to replace !Spawn with a pure ScriptCards version. Well no thread in these forums is complete without me pushing ScriptCards as a possible solution. Let me know if you are interested in that line.
1760407342
timmaugh
Forum Champion
API Scripter
If the player is "Speaking As" their character, Fetch (part of the MetascriptToolbox) offers a way to get that data. As an exercise in conversion, here is your original macro: &{template:dmg} {{rname=Moonbeam}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[2d10]]}} {{dmg1type=Radiant}} {{save=1}} {{saveattr=Constitution}} {{savedesc=Half Damage}}  {{hldmg=[[(1*?{Cast at what level?|Level 2,0|Level 3,1|Level 4,2|Level 5,3|Level 6,4|Level 7,5|Level 8,6|Level 9,7})d10]]}} {{savedc=savedc}} I take it the part that you need to update is the last bit: {{savedc=savedc}} Assuming you're using the 2014 sheet, we'll follow Gauss & Jarren's direction that the attribute we need from the appropriate sheet is called: spell_save_dc The way we get this using Fetch is to require the players to speak as the character (setting the dropdown value at the bottom of the chat panel), then reference it off of the speaker: @(speaker.spell_save_dc) Now we just put that into the appropriate template field: {{savedc=@(speaker.spell_save_dc)}} ...and we wrap the whole command in an exclamation point and a {&simple} tag. The final product is VIRTUALLY your same command, just 1) turning it into an API command (the exclamation point), 2) using the Fetch construction to get the value, and 3) outputting the message (using the {&simple} tag). The new command line would be: !&{template:dmg} {{rname=Moonbeam}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[2d10]]}} {{dmg1type=Radiant}} {{save=1}} {{saveattr=Constitution}} {{savedesc=Half Damage}}  {{hldmg=[[(1*?{Cast at what level?|Level 2,0|Level 3,1|Level 4,2|Level 5,3|Level 6,4|Level 7,5|Level 8,6|Level 9,7})d10]]}}  {{savedc=@(speaker.spell_save_dc)}} {&simple}
Hi, I use character sheets for spell templates and set up separate token actions for each character capable of casting the spell eg cast by char A, cast by char B etc. You could then enter the specific character's Spell Save DC in their specific token action. Only players whose characters can cast the spell have permissions for the spell character sheet. You may end up with a few token actions but the player just clicks the one with their character name. Hope that helps
Outstanding, thanks! I have the Fetch MOD loaded (probably brought in when I loaded another script) but didn't know how to implement for other macros. I'm saving your post as a reference for future situations of this type. timmaugh said: If the player is "Speaking As" their character, Fetch (part of the MetascriptToolbox) offers a way to get that data. As an exercise in conversion, here is your original macro: ....
I hadn't thought of that! This would result in less Journal clutter than separate character sheets for each player. Neet idea. FFR said: Hi, I use character sheets for spell templates and set up separate token actions for each character capable of casting the spell eg cast by char A, cast by char B etc. You could then enter the specific character's Spell Save DC in their specific token action. Only players whose characters can cast the spell have permissions for the spell character sheet. You may end up with a few token actions but the player just clicks the one with their character name. Hope that helps