Dice damage formula

Anyone know how can I use dice for damage?


Ex: You rolled a 7 you've dealt some damage. Kind of like D&D.
This was a fun one.


First of all, head over to Yanfly's and grab the Random Skill Invoke Script. Using this, you can probably create a pretty efficient system for dice (though I leave animations and such up to you, this was just a simple test to see if it was possible to create what you're looking for using this script). Place the script under Materials, and that's about it for that section. This script doesn't require customization. Quickly, though, if you don't want to go back to it, select the tag "<random invoke: x, x>" and copy it so you can paste it into your skill later.


Now then, pop open the database and let's start the skill work. First, create a normal everyday skill and call it what you want. Here, I dubbed it, "Gamble". I changed its occasion to "Only in Battle" to avoid people using up their MP pool rapidly for no reason. (However, you'll also notice I left the Costs at 0. For your game, make sure to change it, unless you want the skill to be completely free, which is an option too.) For the message, I simply put " rolls dice!" so it appears as "Mark rolls dice!" (Mark was the name of the character in this little test project.)


DiceSkill2.png


You may notice in the bottom right hand corner that I have pasted the tag previously mentioned into the Notebox, and that it uses skills 10-15. Similarly, I have created enough skills for what would be a six-sided die. 10-15 are the IDs of the other skills, in case that wasn't clear. ^^ So, now, if this skill were to be used in battle, the "Gamble" would choose randomly from the pool of skills you have created for it.


Now, here is a screenshot of what one of the skills looks like...


DiceSkill3.png


If this skill activates, it will tell you that you have rolled a 3, and will deal exactly the damage I have allowed it. Of course, in your project, you can change the values to whatever you want. 🙂 What I have also done here is changed the Variance from 20 to 0, making sure that whenever 3 is "Rolled", 100 will always be the damage. If you want it to vary slightly, or even a lot, make sure to change that variance first! (Obviously, you can make critical hits too, it was only off because that's how it defaults.)


You can make several of these, as I have, or perhaps even more. It really depends on what kind of die you want your hero to roll! And you would also change the amount of damage dealt for each one. For example, rolling a 1 would not deal as much damage as a 5 or 8.


But yeah, that's pretty much how it goes! I'm always open to any questions you may have about this. ^^ If you find anything that seems off, I can try and help you with it. Otherwise, I hope this works for you! Enjoy! <3
It's not a skill it's a script or formula for a skills. It determines how much damage you deal with on attack mobs.
Hmm. Is this more of what you're looking for?
just make the skill damage formula's work like the dice system...


so like for example:


base_damage + damage_per_dice*dice_roll


or 


damage_per_dice*dice_roll


You could do a "dice roll" using rand(maximum output)


rand returns from 0 to max output so if you do like


rand(5), it will return a number from 0 to 4


for a six sided die from 1-6 you could do


*(rand(6)+1) this way rand will return from 0 to 5 and add 1 so the end result will be from 1 to 6

Original thread: https://forums.rpgmakerweb.com/threads/dice-damage-formula.64277/