
Hi All, One of my players requested an API that will adjust his constitution, constitution modifier and health every time he uses his ability. So I have quickly whipped this up and would like to share it with you all. This API will also allow you to quickly determine any Ability Score damage or gain and will calculate the modifier decrease or increase and reflect this in temporary adjustment to HP (if CON damage). Just make sure your character sheet attributes for Hit points = HP Hit dice = HD Constitution score = constitution Constitution modifier = con You can change these in the script under tagHP, tagHD etc. but just make sure they are the same in the script and in your character sheet on roll20. How it works: There are four functions to this API 1. Straight stat modifier - !stat HP 10 This will either add or subtract a specific value, or dice roll, to or from the characters attribute. eg. Add 15 or 3d5 temporary hitpoints or 1 temporary AC. 2. Ability Score + ability score modifier calculator and editor - !ability constitution 4 This will change an ability score eg. Dexterity and calculate the change in modifier using (Ability Score - 10)/2 rounding down. This function can also store the modifier to the character if you choose (see example macros). 3. Temporary hit point calculator and editor - !ability constitution 4 con If you specify the character Hit Dice (total level) and Hit Points (health) as attributes AND edit the code in the "Edit Here" section to match these attributes. The code will calculate the total temporary current and max hitpoints gained or lost due to constitution damage. (This is only called if "con" is present in your attribute). 4. Stat Resetter - !resetStats This function will reset the characters stat to their original thus removing the temporary modifiers. This is done by taking the Max attribute value and equating it to the current. Usage: 1. Select token that to have their stats or ability scores modified. 2. Either type in chat or add the following to a macro: "!stat [name of stat] [number or roll]" or "!ability [name of ability] [number or roll] [name of modifier(OPTIONAL)]" (without quotation marks and square brackets). 3. The name of the stat/ability must be in the tokens character sheet attribute. 4. To reset stats type !resetStats to reset all OR !resetStats [name of stat 1] [name of stat 2] .... etc (current value attributes will be reset to max value). eg. macros /em gains temporary hitpoints! !stat hp 1d5 *** This will roll 1d5 in the API and add the result to your hp attribute*** /em takes 4 damage to constitution! !ability constitution -4 *** This will decrease the constitution attribute by 4 and tell you what the new modifier is in chat*** *** If attributes for Hit Points and Hit Dice exists and they correspond
to the tagHP and tagHD in the code, temporary health will be calculated
too** /em gains ?{roll?|1d4} temporary constitution! !ability constitution ?{roll?|1d4} CON *** This will increase your constitution ability score (constitution) by 1d4 and calculate the modifier (CON) outputting to chat AND store the new modifier to the CON attribute*** *** If attributes for Hit Points and Hit Dice exists and they correspond
to the tagHP and tagHD in the code, temporary health will be calculated
too** This one is my favourite: /emas @{selected|character_name} takes ?{how much?} damage to ?{What ability?}! !ability ?{What ability?} ?{how much?} ?{modifier?} ***This allows you to specify any type of stat damage as a GM and as long as you're selecting the player's token it will take it from their character. You can type 1d4 in the ?{how much?} prompt or specify a flat damage.*** /emas rests and recovers !resetStats effects of rage wears off. !resetStats constitution strength AC nb. This code does not take inline roles (omit the [[ ]] around your roll eg. [[1d4]] becomes 1d4). Good Luck, GM-King Preview seems to be old code. For updated code click here.