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

Editing / Expanding macros from Compendium

Hello, forums. I'm trying to spice up the visuals of a DnD 5e game I DM (later pathfinder 2E, but I'll start with DnD 5e as the example for now) On a character sheet, I've added weapons from the compendium. I'm wondering if I can edit their integrated macros to add certain functionality, specifically I'm trying to add a FX macro to attacks with EG: longbows / spells, as it shows in the wiki documentation: /fx beam-smoke @{target|Caster|token_id} @{target|Foe|token_id} So I want to add the longbow to the character sheet, edit it's macro function to prompt the user to select their target's token, and pass this information to the above fx macro, so that there is a visual representation of their longbow shot, in addition to the standard attack roll posted to chat. The aim is for this to happen automatically when the player clicks the weapon in their character sheet. So basically how it works currently, with the addition of selecting a target and rendering an FX to represent the shot Similar concept for spells etc. Is there any way to do this?
1705772315

Edited 1705772992
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi cevune! Sort of. It might be achievable with something like the Customizable Roll Listener script, which automatically runs macros when it detects certain text strings in specific roll templates. That would be universal, and happen every time it is detected, which might get tedious in a large battle, YMMV. BTW, you can make the macro a little less step intensive. If you think that the attacker will always have their token selected at time of attack, you can put in @{selected|token_id}  instead of @{target|Caster|token_id}, but this is a matter of preference. Identifying the caster might make more sense in your case. My examples below use @selected, because it was faster for testing. You can make it an option at run time, by including a button in the attack. This is a several step process: 1) Put the attack in edit mode In the description put a command button that will generate the FX command. Normally, you would think you could put in the command like this: [blast](/fx beam-smoke @{selected|token_id} @{target|Foe|token_id} ) That won't work, because the references will try to resolve in the middle of the attack roll. Instead, you need to defer it. You can place the fx command in a macro or use an ability in a  Macro Character Sheet . We'll use a macro here for simplicity, but the Macro Character Sheet. has some advantages in portability. 2) So, create a macro called "Blast" in the collections tab. Make sure to scroll down and add "All Players" to the permissions. This will make it universal. 3) In the description field of the attack, add this text instead of the non-working text in example 1: [blast](`#blast) Note the back tick before the macro call. This ensures the macro will be called and resolved properly. By placing the command this way, we ensure the targeting syntax will wait until the attack is resolved and the button is pushed in order to run. Now whenever you roll that attack, a button will appear in the description field that will give the user the choice of running the fx command. Here are the parts laid out: Note that the work here is done up front, creating the macros. In the future, all you will need to do is add "[blast](`#blast)" to the description field of any attack you want to have this ability. I would finally advise looking into the  Macro Character Sheet  link. This will give you portability if you want to move the macros into another game without re-creating them all. Since they all use generic fx commands, and all you are using from the character sheet is the list of Abilities, this should work even if your game uses a different sheet, like Pathfinder.
You can add your /fx command to the attacks description.  Just edit the attack and add the following to the description: }} /fx beam-smoke @{target|Caster|token_id} @{target|Foe|token_id} {{ Make sure you hit enter after the double curly brackets so the /fx command is on it's own line.  Also you will need to have auto-roll damage turned on or the /fx command will execute twice, once with the attack is rolled and again when the damage is rolled.