
js file (Save As > File Type: All Files, File Name: whateverYouLike. The ability to add your own Battle Commands is now possible thanks to the combine force of Damage Calculation Formulas and Traits (Commands like Steal. If you're interested in a basic plugin for die rolls you could try saving one of these as a. Also, 2d20 isn't valid syntax, you'd need the * in there, i.e. If you rolled a 15 at first, then d20 * 2 would return 30. I just named it d20 for ease of recognition. See below for a couple of examples~Īnd if so, is it proper structure to do multiple d20s as (d20 * 2) or can I type it as 2d20? As implied, that var I used is a static value, it doesn't "re-roll" its value every time it's referenced. =PĬould be done with a plugin: define a new function and call that function when needed. Is there a way to store that inside the database somewhere to simplify coding going forward? So I can just type d20 every time it comes up?You'd want it to be a function call rather than a static value, so that it rolls a new value each time, otherwise you'd be basically rolling it once and using that value repeatedly. On your note about var d20 = Math.randomInt(20) + 1. As mentioned, you can simply add a new line (semi-colon) followed by a zero at the end to ensure the damage output is always zero. Stuff not designed to return a value, like addState, will return undefined instead, which can cause errors when unhandled. The last value in the formula is the one used as the result. I actually prefer note tag route and setting damage to none if it works using yep skillcore.It should be OK as long as you don't let your damage formula return a non-numerical value. Do I need to disable damage core for it to work right? If I understand you correctly, that only applies if I'm putting this into the damage formula, not the other notetag options you gave me.

I was indeed using yep damage and skill cores. You're correct: camelCase is the recommended standard, but not strictly required. Will give this a try.Actually it's simply because the function is defined with that name, and JavaScript is case-sensitive.

Please note that if an actor is dual wielding, it will only run the damage formula for the item in the primary hand. If you want a weapon that targets all enemies or a weapon with a different damage formula and different use message, then you can do that too. I thought camelCase was "best practice" but not actually required. If you want a weapon that does MP damage, for instance, this script lets you make it. Originally posted by BigRockWall:Thanks so much! I think my mistake might have been the case on Math.randomInt.
