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

Little Help? Changing NPC attributes, shows changed, but doesn't take effect.

Hey, I bought a new module for PF2, but the NPCs are set to roll critical damage, and to not show notes. I prefer otherwise, so I wrote this. The thing is, though, it does set no whisper, and it sets show notes. It says it sets not rolling critical damage (attribute is set to none, drop down shows correctly), but it still rolls critical damage. Any thoughts? on ( "ready" ,  function () {      on ( "chat:message" ,  function  ( msg ) {          if  ( msg . type  ===  "api"  &&  msg . content  ===  "!NoAutoShowNotesNoWhisper" )  {              noAutoShowNotesNoWhisper ()         }     }) }) function   noAutoShowNotesNoWhisper () {      let   chars  =  findObjs ({ type :   'character' })      chars . forEach ( char   =>  {                   let   sheet_type  =  findObjs ({ type :   'attribute' ,  characterid :   char . id ,  name :   'sheet_type' })[ 0 ]          // make sure sheet is NPC          if  ( sheet_type  &&  sheet_type . get ( 'current' ) ===  'npc' ) {              // set no whisper              let   whisperAttr  =  findObjs ({ type :   'attribute' ,  characterid :   char . id ,  name :   'whispertype' })[ 0 ]              if  (! whisperAttr ) {                  createObj ( 'attribute' , {                      name :   'whispertype' ,                      current :   '0' ,                      characterid :   char . id                 })             }              else   whisperAttr . set ( 'current' ,  0 )              // set show notes              let   showNotes  =  findObjs ({ type :   'attribute' ,  characterid :   char . id ,  name :   'roll_show_notes' })[ 0 ]              if  (! showNotes ) {                  createObj ( 'attribute' , {                      name :   'roll_show_notes' ,                      current :   '[[1]]' ,                      characterid :   char . id                 })             }              else   showNotes . set ( 'current' ,  '[[1]]' )                           // set no roll critical damage              let   noCrit  =  findObjs ({ type :   'attribute' ,  characterid :   char . id ,  name :   'roll_option_critical_damage' })[ 0 ]              if  (! noCrit ) {                  createObj ( 'attribute' , {                      name :   'roll_option_critical_damage' ,                      current :   'none' ,                      characterid :   char . id                 })             }              else   noCrit . set ( 'current' ,  'none' )         }     }) }
BTW, just playing around now, I see there is an option to apply game default settings. I tried on my non-testing game, and it had the same effect as the script: showed the attribute correctly, but still rolled critical damage.
1596141868
timmaugh
Pro
API Scripter
I had a problem with a different character sheet where sheetworkers were not firing properly to update computed fields, even when I tried to set a value using the setWithSheetWorkers() function (whatever the name is). Confirm that the roll you are making (where it rolls the critical damage) is really reading the attribute you are setting, and not an adjunct attribute that is set if you perform the change on the character sheet rather than through code. Query that adjunct attribute after you run your NoAutoShowWhisperNoNotes script, but before you make that roll. I bet there's something out of sync.
1596152232

Edited 1596152254
Bast L.
API Scripter
Hmm, tried messing about a bit, changed another attr that looked promising, but no dice (er, actually, dice, was the problem :). Ah well.