Yanfly Damage Core and D20 system

So I'm not 100% sure if this deserves it's own thread, but I'm at a loss here.  We are trying to implement a D20 system into our game and I do not have the Javascript skills to perform these calculations.  We want to use Yanfly's damage core to perform the calculations, but I am not sure how to get the dice roll in there for the determining if we even do damage, and then how to apply the damage from the Attack formula.  We are adding in Hime's Weapon Damage script so we can have the weapons use D20.  What I want help with figuring out is combining this all together to make it work.  My Javascript is very limited, but here is what I came up with so far as far as steps.  I know that I would have to roll a D20 so that would be(Math.randomInt(20) + 1) + a.atk +  because I want to use the players attack as a modified for chance to hit. Then, I would need to evaluate it and determine if it was a hit or a miss.  This is where I'm a little lost, because I would use 10 + b.def, but how would I write that in Javascript?  Also, how would I include critical hits, because in D20, you have a chance to crit if you roll a 20, once a 20 is rolled, you roll again to see if the hit is a crit, so I'm not sure how these steps would look.  If anyone can help me sort all of this out into the right steps, it would be greatly appreciated.
I'm kinda noob since i barely know JS, but i had to crack my skull about those things a couple of months ago and this is where i've landed.

"user.parameter" for users
"target.parameter" for targets


Do not use comas. Replace "parameter" with the parameter you want such as atk or def.

Remember that for damage calculations you can use any parameter so be careful when choosing for your skills.

Anything else is up to D20 rules, i guess.


To avoid the unnecessary upgrade of parameters through items to increase damage try to use YEP Weapon Unleash to make each weapon have their own damage, the only bad side would be that you'd need to make a skill for every weapon in the game. You can use it for both Enemies and Actors.
Thank you, I figured out a little bit more.   What I really need to know is how to stop an eval.  So if they do not roll something high enough to hit the enemy, it says miss, but if they do, it continues.
On this case you need YEP Extra Parameter Formula and maybe VE Damage Pop Up


http://yanfly.moe/2016/02/12/yep-69-extra-parameter-formula/


https://victorenginescripts.wordpress.com/rpg-maker-mv/damage-popup/
I was wondering if you can use YEP Skill Core and its <Before Eval> to set the hit formula for specific attacks, lending YEP Hit Accuracy for the more common ones, but I'm no JScripter. For the weapon damage, I think Hime have the best plugin for that.


You should check my sign. It is severely outdated (as of 21/AUG/16), but can guide you. And please, let us know about your project!


Good luck.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-damage-core-and-d20-system.66989/