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

[5e OGL] Perception / Passive Perception Macro

5e OGL Sheet Trying to create a token ability macro that will give me not only the rolled active perception check amount, but also give me the stat block for its passive perception. I'm working on this macro from the Taking20 YouTube guide, but cannot get this part to work for me. Here is the macro. Currently what it does is it gives me two active perception roll blocks.  %{Selected|npc_perception} @{selected|wtype}&{template:npc} {{name=@{selected|npc_name}}} {{rname=Perception}} {{mod=@{selected|npc_perception}}} {{r1=[[1d20+@{selected|npc_perception}]]}} @{selected|rtype}+@{selected|npc_perception}]]}}
%{Selected|npc_perception} /w GM **Passive Perception:** [[10 + @{selected|npc_perceptioni}]]
SkyCaptainXIII said: %{Selected|npc_perception} /w GM **Passive Perception:** [[10 + @{selected|npc_perception}]] That was adding a whisper in for passive perception, but it is not getting the stat right.. I'm using a Goblin for all of this testing, so the passive perception result should be 9. That amount is in the NPC attribute field as  npc_passiveperceptionbase but when I tried using that term it also did not work.
If the roll template is using 1d20 + @{selected|npc_perception} then 10 + @{selected|npc_perception} should be their passive. Otherwise there's a problem with the roll in the template and it's not using the correct modifier.
The  npc_perception attribute is blank on the NP character sheet, dragged and dropped in from the compendium for a Goblin. So the macro you noted is calculating as 10+0 and giving the incorrect result of 10.
When you roll perception does it show a -1 modifier?
1488761360

Edited 1488761500
Just tested this myself and the roll is not applying the wisdom modifier. This is a bug with the OGL sheet perhaps will test on some other monsters and see if it's widespread or only certain ones.
Nevermind... having nothing in the npc perception attribute screws up the roll. It doesn't apply any modifiers. >_<
1488762502

Edited 1488762945
npc_passive is only populated if the npc is skilled in it, otherwise it's blank. This is true for all skilled ability checks. For instance, Goblin will only have a value for npc_stealth. Here is how you can perform an npc perception check, not knowing if the monster is skilled at it. Use Wis mod or npc_passive if it is present. [[1d20+@{selected|wisdom_mod}+(@{selected|npc_perception}-@{selected|wisdom_mod})]] So your Perception macro would look like this ... [[1d20+@{selected|wisdom_mod}+(@{selected|npc_perception}-@{selected|wisdom_mod})]] /w gm Passive Perception @{selected|npc_passiveperceptionbase}
Doesn't work. If selected|npc_perception is blank, not even a zero... it will mess up the roll. 1d20 + + -1 (Goblin Wisdom) will end up only showing the base die roll. It won't apply any modifiers.
1488762989

Edited 1488763140
A workaround would be to use the @{selected|npc_passiveperceptionbase} to get the modifier... so 1d20 + [[@{selected|npc_passiveperceptionbase} - 10]] would properly apply the modifiers to the roll. -edit- Or not... changing the Perception skill on the goblin sheet doesn't adjust the passiveperceptionbase at all. Unless you dig into the list of attributes, you can't change it. Horrible design.
1488763416

Edited 1488763479
Ahh, that's why I used wisdom_mod, it's a caclulated field, thus you'll see (floor((8-10)/2)) surrounding the skill attribute.  It works, give it a try :) Note you have to use [[ ]] to get the calcs.
Weird... it works when you leave the calculations in, but if you try to wrap them up in nested inline rolls... it fails. Feh.
Try using thing instead [[1d20+[[@{npcd_wis_mod}*{1@{npc_perception}0,0}=10+0@{npc_perception}]]]] What it does is try to use @{npc_perception} and if it does not exist or is blank, it will roll back to using the wisdom modifier. I don't know exactly how it works, it was something Silvrye came up with that I now use for npc saving throws.
Here is what I have that is working (a mishmash of many people scripts) /w gm The @{selected|token_name} attempts to sneak past @{target|token_name}, rolling a(n) ?{Advantage / Disadvantage|Neither, [[1d20+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]| Advantage, [[2d20k1+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]|Disadvantage, [[2d20kl+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]} vs @{target|token_name}'s passive perception score of [[10+[[@{target|npcd_wis_mod}*{1@{target|npc_perception}0,0}=10+0@{target|npc_perception}]]]].
Seems there is a bug in that above code that is not properly applying the modifier for stealt
1488768504

Edited 1488822341
Patrick B. said: Here is what I have that is working (a mishmash of many people scripts) /w gm The @{selected|token_name} attempts to sneak past @{target|token_name}, rolling a(n) ?{Advantage / Disadvantage|Neither, [[1d20+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]| Advantage, [[2d20k1+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]|Disadvantage, [[2d20kl+@{selected|npcd_dex_mod}+@{selected|npcd_stealth}]]} vs @{target|token_name}'s passive perception score of [[10+[[@{target|npcd_wis_mod}*{1@{target|npc_perception}0,0}=10+0@{target|npc_perception}]]]]. You could simplify the macro by using this instead. It will also fix the error you had for calculating the stealth modifier /w gm The @{selected|token_name} attempts to sneak past @{target|token_name}, rolling a(n) [[?{Advantage / Disadvantage|Neither,1d20| Advantage,2d20k1|Disadvantage,2d20kl}+[[@{selected|npcd_dex_mod}*{1@{selected|npc_stealth}0,0}=10+0@{selected|npc_stealth}]]]] vs @{target|token_name}'s passive perception score of [[10+[[@{target|npcd_wis_mod}*{1@{target|npc_perception}0,0}=10+0@{target|npc_perception}]]]]. EDIT: changed incorrect @{target|...} to @{selected|...}
I'm getting closer. I've been able to get the wisdom modify to apply for the Passive Perception field. Now I just need to get it to apply to the active roll check, and then get the second value from the Passive Perception box to disappear. Here is the code right now, where I need some help on how to fix the two items noted above. A screenshot of the current result is included too.  %{Selected|npc_perception}+@{npcd_wis_mod} @{selected|wtype}&{template:npc} {{name=@{selected|npc_name}}} {{rname=Passive Perception}} {{mod=@{selected|npc_perception}}} {{r1=[[10+@{npcd_wis_mod}]]}} @{selected|rtype}+@{selected|npc_perception}]]}}
1488808394

Edited 1488822280
The passive perception one is simple, get rid of  @{selected|rtype}+@{selected|npc_perception}]]}} and the second one will go away. You will also need to add {{normal=1}} otherwise it expects the two rolls and will not display the proper result. The first part is a little more difficult because as we have already found out, the npc character sheet does not do the calculation for the npc skills if they are not set. We can get around this in the macro by recreating the roll template inside of the macro instead of directly referencing the ability like you have done. Here is the updated macro for you. @{selected|wtype}&{template:npc} {{name=@{selected|npc_name}}} {{rname=Perception}} {{r1=[[1d20+([[@{selected|npcd_wis_mod}*{1@{selected|npc_perception}0,0}=10+0@{selected|npc_perception}]])]]}} @{selected|rtype}+([[@{selected|npcd_wis_mod}*{1@{selected|npc_perception}0,0}=10+0@{selected|npc_perception}]])]]}} @{selected|wtype}&{template:npc} {{name=@{selected|npc_name}}} {{rname=Passive Perception}} {{r1=[[10+([[@{selected|npcd_wis_mod}*{1@{selected|npc_perception}0,0}=10+0@{selected|npc_perception}]])]]}} {{normal=1}}
That worked! Thank you!
Kyle G. said: You could simplify the macro by using this instead. It will also fix the error you had for calculating the stealth modifier /w gm The @{selected|token_name} attempts to sneak past @{target|token_name}, rolling a(n) [[?{Advantage / Disadvantage|Neither,1d20| Advantage,2d20k1|Disadvantage,2d20kl}+[[@{target|npcd_dex_mod}*{1@{target|npc_stealth}0,0}=10+0@{target|npc_stealth}]]]] vs @{target|token_name}'s passive perception score of [[10+[[@{target|npcd_wis_mod}*{1@{target|npc_perception}0,0}=10+0@{target|npc_perception}]]]]. I appreciate the simpler code.  (Kind of wish there was a bit more documentation on the syntax for macros).  I am still getting the miscalculation.  A char with a stealth of 7 and a dex mod of 3 is still managing to return a result of 2 on a disadvantaged roll.  What precisely does the {1@{ mean?  Why are we putting an =10+0@{target|npc_stealth}. (Should that be selected?  Still why this other side of the equation?). What specifically does the 0,0 do?
Patrick B. said: Kyle G. said: You could simplify the macro by using this instead. It will also fix the error you had for calculating the stealth modifier /w gm The @{selected|token_name} attempts to sneak past @{target|token_name}, rolling a(n) [[?{Advantage / Disadvantage|Neither,1d20| Advantage,2d20k1|Disadvantage,2d20kl}+[[@{target|npcd_dex_mod}*{1@{target|npc_stealth}0,0}=10+0@{target|npc_stealth}]]]] vs @{target|token_name}'s passive perception score of [[10+[[@{target|npcd_wis_mod}*{1@{target|npc_perception}0,0}=10+0@{target|npc_perception}]]]]. I appreciate the simpler code.  (Kind of wish there was a bit more documentation on the syntax for macros).  I am still getting the miscalculation.  A char with a stealth of 7 and a dex mod of 3 is still managing to return a result of 2 on a disadvantaged roll.  What precisely does the {1@{ mean?  Why are we putting an =10+0@{target|npc_stealth}. (Should that be selected?  Still why this other side of the equation?). What specifically does the 0,0 do? Yes, you are right, that should be selected, not target. In regards to the [[@{selected|npcd_dex_mod}*{1@{selected|npc_stealth}0,0}=10+0@{selected|npc_stealth}]. I don't know how it works exactly it was some advice given out by Silvrye that I have used successfully in my macros. But what it does is try to use the selected NPC's stealth modifier, if the stealth modifier is not set or blank, it will default to using the dexterity modifier instead. 
1488829840
Silvyre
Forum Champion
{1@{npc_stealth}0, 0}=10 resolves to equal 1 if @{npc_stealth} does not exist (or has no Current value). More simply, {10, 0}=10 is a Grouped Roll that is appended with a  Grouped Roll Modifier , specifically for a Target Number . It resolves to equal 1 because one of its sub-roll expressions satisfies the Target Number condition.