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 .
×
Advertisement Create a free account Compendium in Game, Join Today

[Script] Pathfinder 2E Character Adjustments

1611158386

Edited 1614236695
Mark S.
Pro
API Scripter
Character Adjustments Source: <a href="https://bitbucket.org/desertwebdesigns/roll20/src/master/PF2Adjustments/" rel="nofollow">https://bitbucket.org/desertwebdesigns/roll20/src/master/PF2Adjustments/</a> Introduction Character Adjustments allows for quick/simple applications of the Weak and Elite templates from the PF2E Core Rulebook. Simply call the API command passing in a character token, and the script will make all necessary adjustments to HP, Skills, Saves, Weapon modifiers and Damage, and Perception. The script will make the adjustments to the character represented by the token passed in IMPORTANT NOTE: &nbsp;The script does not currently make adjustments to spells and other "limited time use" abilities due to the number of varied ways to represent this damage within the abilities and in the character sheet. Due to this restriction, this script will not currently be submitted to the official script library. Requirements Character Adjustments relies on the modifiers and bonuses taken from the character sheet (developed using the Roll20 PF2E Character Sheet). The token ID passed to the API must represent a character to be modified. The weapon strike damage modifier just runs a simple regular expression on the damage field. It will split the damage into three parts: dice (1d4), symbol (+, -, or neither), and modifier (2,4,etc). If the field doesn't match that expression, it won't work, e.g: 1d4+2, 3d6-1, 2d8 Commands !elite &lt;&lt;Token ID|Character Name&gt;&gt; !weak &lt;&lt;Token ID|Character Name&gt;&gt; Both commands only take one parameter: Token ID|Character Name - (str) The Token ID (likely passed from @{target|token_id} or @{selected|token_id}) representing the character to adjust.&nbsp; Updates Version 0.1 (2021-01-20) Initial release Planned Updates These changes may or may not happen as I continue to work on, and use, the script depending on whether I think it's necessary and/or player feedback Adjust name of character to apply name of adjustment being applied (if applicable) Add option to apply "level bump" for Pathfinder Society purposes Notes Feedback, bug reports, and suggestions for improvement are all welcome.
Do I have the correct syntax for the command? !adjust elite @{selected|token_id} I'm testing this with the token selected when entering the command, but not seeing any changes to the values in the sheet.
1612423246

Edited 1612423383
Mark S.
Pro
API Scripter
Persephone said: Do I have the correct syntax for the command? !adjust elite @{selected|token_id} Sorry about that. I developed it using&nbsp; !adjust elite @{selected|token_id} &nbsp;initially, but then changed it. It should just be&nbsp; !elite @{selected|token_id} &nbsp;or&nbsp;&nbsp; !weak @{selected|token_id} I'll change the docs above
Oh, awesome, it's working great now! Thank you! Only bug I've noticed so far is the Weak adjustment doesn't seem to lower Perception. I did have a crash the first time I ran it, but I'm pretty certain it was because the NPC had a ranged attack and I include math in those fields for calculating range penalties. It crashed after altering the first melee attack, before it could alter the first ranged attack or the second melee attack. Here's the error generated, in case you want to put in some way to prevent the crash if the mod value is too complicated for the script to alter: Error: Firebase.update failed: First argument contains NaN in property 'current' at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186) at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at J.update (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave (/home/node/d20-api-server/api.js:878:27) at later (/home/node/d20-api-server/node_modules/underscore/underscore.js:1134:31) at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:1071:19) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)
1612461482
Mark S.
Pro
API Scripter
Oh, awesome, it's working great now! Thank you! Only bug I've noticed so far is the Weak adjustment doesn't seem to lower Perception. Weak adjustment doesn't change Perception, only Elite (Bestiary p. 6) I did have a crash the first time I ran it, but I'm pretty certain it was because the NPC had a ranged attack and I include math in those fields for calculating range penalties. It crashed after altering the first melee attack, before it could alter the first ranged attack or the second melee attack. Yes, the math would cause it to break. The weapon strike damage modifier just runs a simple regular expression on the damage field. It will split the damage into three parts: dice (1d4), symbol (+, -, or neither), and modifier (2,4,etc). If the field doesn't match that expression, it won't work. I do need to add better crash logic, but I wasn't too worried about it at the time since I wasn't planning on putting this script in the Library. Kind of just out there for whoever stumbles across it :D
Oh! I hadn't noticed that about Weak. I was going off AoN's GM Screen which says it does affect Perception, but the full rules for it do not. Thanks for pointing that out! And the crash isn't a big issue either way, I can just add the math in after adjustments in the future :)
1614095086

Edited 1614095771
So I am new to PFS API - I am need to add the elite template to three separate baddies.&nbsp; I understand how to add different API's but I'm not sure which API script this one would be based off.&nbsp; Using more PFS 2E API would be awesome for init spell effects.&nbsp; I currently play in a Earthdawn campaign where the entire character sheet is API driven so everything runs off it and as long as the token is linked to the sheet - all rolls are rolled against armor and the outcome is already determined, damage is known and taken from your HP.&nbsp;&nbsp; ***Update - doh!&nbsp; I followed your link and figured out how to add the script.&nbsp; *embarrassed blush* But when I try to execute the command I get the following errors.&nbsp; So I am still not sure what I am doing wrong.&nbsp; *le sigh* No attribute was found for @{selected|Ygracix Elite} Incorrect number of parameters sent to '!elite' Scripts are cool when I see what other people have done with them and once I get comfy with them.&nbsp; Buuuut........I struggle
@Shannon, you should just need to select the token that represents the npc you want to adjust, then run the following command !elite @{selected|token_id} Is that what you already tried?
1614236966
Mark S.
Pro
API Scripter
@Shannon P, as Persephone mentioned, the command is literally just&nbsp; !elite @{selected|token_id}&nbsp; while you have the token selected for the character you want to adjust (remember, the token has to represent a character in the journal). I'm guessing based on your command that "Ygracix Elite" is the name of your character. @{selected|token_id} is a Roll20 method for grabbing the internal ID of the selected token, which is how the API script identifies the character and makes adjustments (you pass in the token id, the script looks up the token for that ID, then gets the character that token represents, then makes all the necessary changes).&nbsp; Let me know if you still have problems.