- Joined
- Jul 12, 2019

- Messages
- 8

- Reaction score
- 3

- First Language
- English

- Primarily Uses
- RMMV

"b.mp <= Math.RandomInt(20) + 1 + (Math.floor((a.atk - 10)/2)) + (Math.floor(a.level/2))) ? Math.randomInt(4) + 1 + (Math.floor((a.atk - 10)/2)) : 0;"

To simulate a D20 roll to check if I hit an enemy based on their Armor Class. if "b.mp is less than or greater than 20 + modifier than 1D4 + modifier else 0" The only issue is that I want to add in critical and fumble for a natural 20 and a 1 respectively. To do this I know I need to use lunatic mode with yanfly's damage core but I am having trouble setting up a conditional branch for it.

{if Math.RandomInt(20)+1

= 1 then <Replace Attack: 1> <Replace Attack: Fumble> "The attack is replaced with a fumble skill using YEP_WeaponUnleash"

= 20 then Math.randomInt(8) + 1 + (Math.floor((a.atk - 10)/2)) "it ignores the Armor Class check and you roll 2d4 instead of 1d4"

= 2-19 then b.mp <= (2-19) + (Math.floor((a.atk - 10)/2)) + (Math.floor(a.level/2))) ? Math.randomInt(4) + 1 + (Math.floor((a.atk - 10)/2)) : 0; "The original damage formula goes off as usual using a 2-19 value given from the D20 roll at the start"}

I'm don't really know javascript so I am not sure how to set this up with a variable and conditional branches for the variable value. Any help would be greatly appreciated as this is my entire combat system.