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

[SmartAoE] Cannot Add Immunities

Smart AoE is a great script. For some reason, I cannot add immunity conditions. I am using the fairly old but still very good Creature Generator API, which creates a character sheet and token from a Pathfinder_1 stat block. When I apply the AoE, those creatures roll their save and get damage, as normal. But when I try to settle an immunity condition, I get " Unexpected argument identifier (immunityrule)."   The creature does not have an "immunity" attribute. I tried to use another one. Here is my macro: !smartaoe {{ --title|Cono de Hielo --leftsub|Cold Damage --rightsub|DC 21 Reflex --aoeType|PFcone --forceIntersection|0 --radius|60ft --origin|nearest, face --minGridArea|0.5 --minTokArea|0.5 --fx|burn-frost --dc|21 --saveFormula|<<1d20+a{REF}>> --damageFormula1|[[15d6]] --damageType1|cold --ignore|SmartAOE_ignore,1 --instant|1 --autoApply|1 --bar|1 --zeroHPmarker|dead --immunityAttr|CGen_CGEN --immunityRule|*0 --desc|El famoso cono de hielo. }} Later I created an attribute "cold_immunity" and put it instead of "CGenCGEN", but I got the same error. Any help is much appreciated.
1656875843
David M.
Pro
API Scripter
Ack! That's an oversight in the documentation. If you remove the --immunityRule line then it should work. The "default" immunity rule used internally by the script is damage*0 because, well, they're immune. I probably dropped that user syntax at some point since immune is always x0 but forgot to remove it from the documentation. I just tried your macro after dropping that line and with the CGenCGEN attribute set to "cold" and it worked for me. Let me know if you still have issues. Thanks for bringing this to my attention!
That worked perfectly. Your script is great! Thank you very much!
1656877616
David M.
Pro
API Scripter
Glad to hear it! Thanks for the confirmation
1656933353

Edited 1656934250
Sorry to disturb you further. I came to notice that, if the AoE has no save, then the damage is not auto applied to the tokens. This is easily worked around by assigning a save with an impossible DC. It would be nice, though, if the save entry were not required for damage to be applied. (I believe that in 5e every spell/effect has either a save or an attack roll, but in other systems there are several effects with none). Also, if in the saveFormula I introduce two arguments separated by a comma, it rolls both, and if any of those is below the DC, the character is considered to have failed the save. If the attribute called in an argument does not exist, then it rolls a plain d20. Is there a way of making this work as a fallback, so that an argument is ignored if the attribute called does not exist? Then both would be rolled and taken only if the character has both attributes. Thanks again!
1656939064
David M.
Pro
API Scripter
You found another oversight in the documentation! This script has so many commands haha. There is a --noSave|1 command that will do the hardcoding for you and will "roll" a 0 for all targets (and silently sets the DC to 99999). The Aura of Vitality example macro in the wiki uses it but it was missing from the list of commands. I just updated the wiki. Can you post your saveFormula line? 
Great! The --noSave command is exactly what I was looking for. For the other thing, it is the same macro above, I only modified this line: --saveFormula|<<1d20+a{REF}>>, <<1d20 a{CGen_Ref}>> What I would like is to roll, for each token, only the one(s) including an attribute present in its character sheet.
Just to clarify two details: 1) To avoid modifying the sheet generated by CreatureGenerator, I set the damage type to "true", which is the value of the attribute I used for --immunityAttr. I brought it back to "cold" in the macro, to avoid confusion, since it had nothing to do with the issue itself. 2) In the second argument of --saveFormula, the "+" sign is missing, since CreatureGenerator puts it automatically, so if I do too it will be duplicated and won't work. I hadn't mentioned this because it is irrelevant to the issues at hand, but just in case those details are generating any noise...
1657023264
David M.
Pro
API Scripter
The --saveFormula example you presented is definitely an unsupported and unintended "feature" of the script. I'm surprised it even kinda works at all! I might suggest instead using a Scriptcards macro to check for the existence of the attribute, then dynamically build the SmartAoE macro syntax to then be fired off by Scriptcards. This shouldn't be too difficult. I'll try to get you an example later today. 
Thank you very much!
One thing I'd like to see added: There are a handful of creatures (I think mostly in non-WoTC modules) where the creature is not just immune to a certain data type but is actually healed when receiving damage of that type. It'd be nice if the script could handle that. Other changes I'd like to see, not related to immunities:    - Hiding the creature name; this often gives meta-gaming information to the players that they shouldn't yet have.    - The ability to whisper the results to the GM only    - The ability to have the rolls made with advantage or disadvantage; some creatures, such as those with Magic Resistance get advantage on rolls against spells.    - The ability to ignore tokens on the GM layer, or "invisible".
1657070989

Edited 1657071097
David M.
Pro
API Scripter
A couple of these can already be done: You can hide names from players by using --hideNames|1 There is an undocumented feature that just automatically happens for 5e sheets: creatures with magic resistance automatically make saves with advantage. You can try it out with a satyr, for example, and it should roll saves twice and take the better. The script looks at the npc_resistances attribute and rolls with advantage if it contains the string "magic resist". Otherwise, you could have all creatures roll with adv/disadv by adjusting the --saveFormula accordingly. Nick Olivo's YouTube video details this for his custom Shatter spell.  GM-only output is on my list of things to add. I can add an --ignoreLayer command to my list, as well. By default, invisible tokens are still affected, but those results are whispered to the gm separately. Certain damage healing: I'll have to think on that. Shambling Mound comes to mind. 
1657073910

Edited 1657075521
David M.
Pro
API Scripter
Algunillo, running into some hiccups on this scriptcard. Seeing some weird behavior for something I've done many times before. I haven't forgotten about this, but unlikely to get this out to you tonight due to troubleshooting. Ah, NM! I was being stupid and forgot about an interaction with SelectManager/libinline/SmartAoE that required a deferral character (the multiple "^"s in the forselected code block). Here's a scriptcard that checks for the existence of the REF attribute. If it exists, it is used for the saveFormula. If it doesn't exist, then it builds the saveFormula using the CGen_Ref attribute. There's some probably weird looking syntax in there which I can explain later if you're interested, but right now I'm going to get some sleep! Script Dependencies: SmartAoE, Scriptcards, and SelectManager (all available on 1-click). !script {{ --#hidecard|1 --/USING VARIABLES FOR SPECIAL CHARACTERS SHARED BY THE SCRIPTS SO SCRIPTCARDS DOESN'T GET CONFUSED --&lbrack|{ --&rbrack|} --&lsqbrack|[ --&rsqbrack|] --&lt|< --&gt|> --/DETERMINE SAVEFORMULA BASED ON EXISTENCE OF ATTRIBUTE --&REF|[*@{selected|token_id}:REF} --?X[&REF]X -eq XX|[ --&saveFormula|[&lt][&lt]1d20+a[&lbrack]REF[&rbrack][&gt][&gt] --]|[ --&saveFormula|[&lt][&lt]1d20+a[&lbrack]CGen_Ref[&rbrack][&gt][&gt] --]| --/DYNAMICALLY BUILD SMARTAOE SYNTAX AND RUN USING SELECTMANAGER --@forselected(^)|smartaoe [&lbrack][&lbrack] _title|Cono de Hielo _leftsub|Cold Damage _rightsub|DC 21 Reflex _aoeType|PFcone _forceIntersection|0 _radius|60ft _origin|nearest, face _minGridArea|0.5 _minTokArea|0.5 _fx|burn-frost _dc|21 _saveFormula|[&saveFormula] _damageFormula1|[&lsqbrack]^[&lsqbrack]15d6[&rsqbrack]^[&rsqbrack] _damageType1|cold _ignore|SmartAOE_ignore,1 _instant|1 _autoApply|1 _zeroHPmarker|dead _immunityAttr|CGen_CGEN _desc|El famoso cono de hielo. [&rbrack][&rbrack] }}
Thank you very much, David M! However, the macro does not work well because it doesn't recognize the attribute REF in the characters that have it, so it tries to roll with CGen_Ref modifier for all tokens. I tried to play with the syntax where you define &REF, since the expression begins with "[" and ends with "}", which I found strange, but to no avail. I also swapped "REF" for "Ref", which is the current name of the attribute (I copied the formula from some other macro, unaware of the change, but fortunately it worked in the original smartAoE macro). I thank you for all your extra work and helpfulness. If you happen to know why this macro is not working by just looking at it, please tell me. If it seems ok, just tell me so and I will try to make it work later.
1657124860
David M.
Pro
API Scripter
[Facepalm] You're totally right. Not sure what I was thinking. This approach is totally not going to work for you because the saveFormula will end up using the same attributes for each target (though individual attribute values are respected). I should have thought that through more. Ugh, sorry.
Thanks a lot, anyway, for all your help. If all creatures have the REF attribute, or all don't, then the macro should work. You might consider in the far future adding some kind of "fallback" feature (that is, roll X, but if Y doesn't exist, then roll Z) to SmartAoE, since it is not rare for PCs and NPCs to have different attributes.
1657220239
David M.
Pro
API Scripter
Hey, I think I may have a solution for you? I just saw a post from RainbowEncoder  that used a nested inline trick to get around attributes that don't exist. In their example,  [[0@{selected|boost}]]  returns a "0" if the "boost" attribute doesn't exist. We can modified the --saveFormula in your macro in a similar fashion, resulting in something like this:   --saveFormula|<<1d20 + <<0a{Ref}>> + <<0a{CGen_Ref}>>>> If either the "Ref" or "CGen_Ref" attributes doesn't exist, then the formula just returns 0 for that nested component. I just tried it on two creatures (each having only one of the attributes) and it seemed to work.  The only issue would be if both of the attributes exist for some reason. I don't know anything about this CreatureGenerator you are talking about to know if this might ever occur.
It worked perfectly! That trick is great. Thank you very much for all your help!