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 .
×
May your rolls be merry + bright! 🎄
Create a free account

set('current') is not working on global_attack_active_flag attributes

Im trying to set 1 at repeating_tohitmod_.* atributes. I can set the value and the checkbox is marked. But, when I attack, the Hit or Damage bonus doesn't the global modifier selected. This work only if I manualmente check and uncheck again.  My code is like this: findObjs({_type: 'attribute', name: "repeating_tohitmod_-MYSflpHX9wmJ4K8Z4eQ_global_attack_active_flag"}).set('current', "1"); ____ I tried ChatSetAttr and doesn't work too.
Sorry I wrote "manualmente". It's "manually". I found several old threads (like this ) with this subject saying this is not possible. But I could not understand if this status is occurring until now.
1618768131
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
the basic .set() does not trigger sheetworkers. You need to use .setWithWorker or the API version of setAttrs to trigger sheetworkers with an API script. I prefer setAttrs for this. That code would look something like: //Assuming you have the character you would like to set the attributes on already in the script and it is stored in a variable named character setAttrs(character.id,{attribute object});
WOW this saved my API! Thank you Scott!