Regarding hit chance using dice rolls?

So, I have an idea for a game. Have the master plot planned out. Have the assets. But what I need is some help with a dice roll plug in.

Here's what needs to happen - entity A rolls a d100 and needs to roll under a certain number for example 45. At the same time entity B needs to roll under it's own specific number for example it's 35. So when entity A rolls under the number 45 the attack is considered successful. However if the entity B also rolled under it's number 35 his roll is also successful. This is a parry, and nothing happens to either entity. So the mathetimatical formula can be defined as: if(dice(1,100)<User.agi+User.acc&&dice(1,100)>Target.agi+Target.eva,100,0) - this is a Jace.NET expression but it should bring more understanding as to what I want out of this parry system. So here's a question, what plug in I can use to achieve this? And furthermore, what expression or JavaScript code snippet do I need to utilise to get the desired effect? Thanks in advance.


PS
If I understand correctly, this plug in (https://victorenginescripts.wordpress.com/rpg-maker-mv/hit-formula/) is what I need to use.

PPS

(Math.randomInt(20) + 1 + Math.floor((a.agi – 10) * 0.5) >= b.def) ? 100 : 0 -- so this is a more of a DnD style of roll, but I am guessing it's possible to implement d100 in a way I have described?
You've located the right plugin and you have the syntax, so I'm a little unsure what your actual question is at this point.

If you want to generate a number based on 100, you would just put randomInt(100) rather than randomInt(20).

Is there something else you don't know/understand?

In your original formula, is "acc" supposed to be their hit rate or something else? Just adding a decimal value is not going to have much effect on the result of the comparison - same thing with the opponent's evasion.
You've located the right plugin and you have the syntax, so I'm a little unsure what your actual question is at this point.

If you want to generate a number based on 100, you would just put randomInt(100) rather than randomInt(20).

Is there something else you don't know/understand?

In your original formula, is "acc" supposed to be their hit rate or something else? Just adding a decimal value is not going to have much effect on the result of the comparison - same thing with the opponent's evasion.
Thanks for answering. My question is that I am really not sure how to write an expression even though I have all the information. So I need to have both entities to roll randomint(100) and roll it under a specific number. In my original formula "acc" is a flat number corresponding to a core skill not a percentage. So to break down the original formula it rolls a d100 and checks the result against the flat number of two core skills added up. Let's say dexterity and strength. The calculator uses a simple "<". At the same time it does the same thing for the second entity and checks it's resulted roll. Then, the calculator basically checks these two rolls against each other and if the conditions are met - the character's roll is under his number and the enemy rolls over his number then the attack goes through. So how do I write an expression with randomint(100) to achieve similar results? My real question is that I don't know how to write an expression?
My question is that I am really not sure how to write an expression even though I have all the information.
Well - exactly the way you already pasted it at the bottom of your first post. 😉

In my original formula "acc" is a flat number corresponding to a core skill not a percentage.
Okay - that's not something that's in RPG Maker by default, but I'll take your word that you know how to add it and have done so 🙂

My comment still stands for the target's eva, that decimal value isn't going to have any effect on the result of the attack.

So, what you already posted:
(Math.randomInt(20) + 1 + Math.floor((a.agi – 10) * 0.5) >= b.def) ? 100 : 0

Just change the numbers to be what you said you wanted.
Code:
(Math.randomInt(100) + 1 < a.agi + a.acc && Math.randomInt(100) + 1 > b.agi + b.eva) ? 100 : 0
Well - exactly the way you already pasted it at the bottom of your first post. 😉


Okay - that's not something that's in RPG Maker by default, but I'll take your word that you know how to add it and have done so 🙂

My comment still stands for the target's eva, that decimal value isn't going to have any effect on the result of the attack.

So, what you already posted:


Just change the numbers to be what you said you wanted.
Code:
(Math.randomInt(100) + 1 < a.agi + a.acc && Math.randomInt(100) + 1 > b.agi + b.eva) ? 100 : 0
Okay, I will try it out later. 🙂
Okay - that's not something that's in RPG Maker by default, but I'll take your word that you know how to add it and have done so
I actually haven't done this. Is there something I need to implement here? Like custom skills?


My comment still stands for the target's eva, that decimal value isn't going to have any effect on the result of the attack.
Can you please elaborate, if I take strength and dexterity for example, and put them in the expression you have helped me with, it won't work? Those are flat numbers aren't they? Also, I thought when using this plug in the default formula for hit detection wasn't used?
I humbly suggest that you take a step back and start over from the beginning.

You seem to have misunderstandings between what's a parameter, what's an ex-parameter, what's an integer, and what's a decimal.

You also seem to have some kind of misunderstanding about what is actually in RPG Maker. That means you're throwing out these ideas for a formula that isn't going to do what you think it is.

It's also causing your question to become a confusing mash-up of asking how to make a formula and asking how to add custom parameters.

if I take strength and dexterity for example, and put them in the expression you have helped me with, it won't work? Those are flat numbers aren't they?
No, because there's no such thing in RPG Maker as strength and dexterity. But that also has nothing to do with my sentence that you quoted.
what's a parameter, what's an ex-parameter, what's an integer, and what's a decimal
Okay. Is there documentation on this particular topic? Or what...
Have you done anything with RPG Maker? Made a project, done tutorials? It's not clear what your skill/knowledge level is.

The documentation comes with the software - you can click Help -> Contents to get to the manual.

The default parameters are displayed in the Class tab of the database, where you choose what their growth curves are as you level in that class.

Sp- and ex-parameters are defined in Traits, which can be attached to any database object. You should see several default settings for these Traits, again, on each class.
To be completely honest, I am coming off of a different engine. Thanks for the input, I should really dig into the RMMV tutorials and come back after I have some experience under my belt.
I strongly recommend that - it doesn't make much sense, to me, to try to mod an engine with plugins and custom formulae if you don't even know what numbers it uses.

There's a tutorial built into MV, and you can also look up and follow along with any of, like, half a dozen video series on YouTube.
I strongly recommend that - it doesn't make much sense, to me, to try to mod an engine with plugins and custom formulae if you don't even know what numbers it uses.

There's a tutorial built into MV, and you can also look up and follow along with any of, like, half a dozen video series on YouTube.
I will do that. But also I am adamant about trying to implement the parry system. It's a core system for what I have in mind. RMMV works in Linux, right?
RMMV works in Linux, right?
It does, although as far as I am aware you have to access it through Steam.🙁 Until my hard disk crash last summer, I used to use Linux (Ubuntu distro). The only things that didn't work for me were the help file and the built-in tutorials. (For people who need tutorials there are plenty out there.)
default parameters
Okay I looked it up, and did the tutorial. Can the default parameters be used in the hit chance formulae instead of ex-params? And if so, wouldn't it make sense to make the ex-param hit chance% to be 100 and evasion chance to be 0%? I mean we are deciding everything via d100 dice roll, why add what is not necessary to the table?
Can the default parameters be used in the hit chance formulae instead of ex-params?
You're writing something code, why wouldn't you be able to use something else in the same code? 😉

And if so, wouldn't it make sense to make the ex-param hit chance% to be 100 and evasion chance to be 0%? I mean we are deciding everything via d100 dice roll, why add what is not necessary to the table?
Wouldn't it make more sense to just not reference those parameters if you don't want them to factor into the formula?

The whole point is that you're changing how hitting works.
Honestly, you don't even need scripts or plugins to do that. You can do it with variables and conditional branches. You roll the attacker dice by designing a variable to a random number. Conditional branch to see if number is below what you want.
If so, you roll the defender's dice, same thing. If successful -> parry. If not -> hit.
Honestly, you don't even need scripts or plugins to do that. You can do it with variables and conditional branches.
Where would you put the event that has those conditional branches?

If you're attaching it to a skill, then the common event is going to execute after the entire skill has resolved. So it will show whatever you wanted for the skill with its animations and such, and then your event runs.

- How would the event know who you're attacking?
- How would the event know who is attacking?
- How would the event produce any of the attack motions or animations or damage with popups?

I'm not saying you're flat out wrong, you might be thinking of something that hasn't occurred to me, but I can't envision how what you're describing would work.
Mmmm probably my bad. I never use the default battle system, so I guess if you're using it, you'd need to change the main scripts of the game where such calculations are made.
Wouldn't it make more sense to just not reference those parameters if you don't want them to factor into the formula?
I need to think about this, tbh

Original thread: https://forums.rpgmakerweb.com/threads/regarding-hit-chance-using-dice-rolls.166652/