Default formula for Accuracy/Evasion (HIT/EVA)?

Status
Not open for further replies.

TheLordThyGod

Warper
Member
Joined
Mar 22, 2018
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMVXA
I need some help understanding Accuracy/Evasion in RPG Maker VX Ace.



I know there are invisible "ex-parameters" called HIT and EVA which default to 0% but can be modified in the Features or Effects sections of various tabs; however I have thus far been unable to find the formula for how this affects chance to hit. The program's Reference Material says only "if accuracy on the attacking side is 90% and avoidance on the target side is 10%, avoidance will be 10% of 90%, resulting in the overall accuracy being calculated at 81%," which is unclear to me.



1. What is the default formula for HIT/EVA in VX Ace?



2. Can the HIT/EVA formula be modified (for instance to factor in AGI)?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
The default formula is as follows:

First, the engine rolls to see if you hit. The percent chance of that is your To Hit parameter.

Then, the engine rolls to see if the enemy evades. The percent chance of that is the EVA parameter of the enemy.

Because of the two rolls, the overall chance to hit the enemy is your to hit percent (in decimal form) * (1 - the enemy's EVA stat, in decimal form). So using your example of a 90% to hit and a 10% Evade, it is:

0.90 * (1 - 0.10) = 0.9 * 0.9 = 0.81, or 81%.

You can modify the formula but you'll have to code a script for it. I personally deleted the To hit check and changed the EVA check to be (To hit - EVA) is your chance to land a hit, as I felt the double rolling was a bad idea, but that is just me.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
There is no formula at all.

First there is a % roll on HIT%, if the result of 1-100 is power than the HIT% then the skill hits.
After that there is another roll on EVA%, again if the random number is lower than the EVA% then the attack is evaded.
 

TheLordThyGod

Warper
Member
Joined
Mar 22, 2018
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMVXA
The default formula is as follows:

First, the engine rolls to see if you hit. The percent chance of that is your To Hit parameter.

Then, the engine rolls to see if the enemy evades. The percent chance of that is the EVA parameter of the enemy.

Because of the two rolls, the overall chance to hit the enemy is your to hit percent (in decimal form) * (1 - the enemy's EVA stat, in decimal form).
Thanks, this is exactly the information I was looking for.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Andar's statement is kinda misleading. It does have formula while it's not explicitly written in script. Bgillisp explained how it works. And no, they are not really different.

I believe RMMV hold the same default rule as the previous RM series.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
I personally deleted the To hit check and changed the EVA check to be (To hit - EVA) is your chance to land a hit, as I felt the double rolling was a bad idea, but that is just me
That's interesting. Not knowing a whole lot of the inner workings of formulas in the engine, I would not be sure if one way is better than the other. But like you did, it's probably personal choice of how you would like it to be done.
So,... how attached are you to that script rewrite? is it something you can share with the community? Just curious as I'm interested in knowing if it really would be a better calculation for the attacks for myself.
Aside from that, I now wonder how many ways the formulas could be changed? Peaks interest some more. :)
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
There was a thread talking about changing hit/eva formula but I forgot the title. You can try to look at general discussion or game mechanic design. It wasn't even a year iirc.

But anyway, it sort of necro I guess?
 

Guanto

Auteur
Veteran
Joined
Jul 18, 2018
Messages
111
Reaction score
10
First Language
English
Primarily Uses
RMMV
Andar's statement is kinda misleading. It does have formula while it's not explicitly written in script. Bgillisp explained how it works. And no, they are not really different.
Yes, the second response threw me off quite a bit. Makes more sense upon re-read. So default is two opposing rolls on percentiles, got it.

I believe RMMV hold the same default rule as the previous RM series.
Excellent, thanks.

Apologies but there is so little info on this seemingly important aspect of any rpg game... but in terms>parameters>Hit Rate: & Evasion rate: can one directly effect these values? Like if one were to put To Hit: 0 that would be 0% chance of hitting with that skill? Or are these boxes modifying some other hidden baked in value?
 
Last edited:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Hit chance of skills is yes the chance of skills to hit. If 0% that skill shouldnt hit.

For physical-hit skills though, the formula becomes (Skill Hit Chance * Actor Hit Chance)

For sure hit skills, the chance doesnt matter
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Are you talking ACE? If so I don't see a terms -> parameters -> Hit Rate in the database, but I do see a terms tab, and all that happens if you change that is you change the name it is called by. However, in a skill you can change the success rate and that will be multiplied to the hit rate that is being used.

As for where to change the actual code, that is in the scripts themselves (for ACE) or the plug-ins (for MV). I don't use MV enough to tell how to change it in MV but I think Yanfly has a plug-in where you can set up a custom code. For ACE, For ACe though the code is in the Game_Battler Script, under the command item_apply, which starts on line 501 of my game. My changed code is as follows:

Code:
 #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    ctr = rand
    @result.missed = (@result.used && ctr > (item_hit(user, item) - item_eva(user, item)))
    store = item_hit(user, item) - item_eva(user, item)
  
    #@result.missed = (@result.used && rand >= item_hit(user, item))
    #@result.evaded = (!@result.missed && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end

The key lines are these two:

ctr = rand
@result.missed = (@result.used && ctr > (item_hit(user, item) - item_eva(user, item)))

That calculates the random number, then sees if the number is greater than to hit - EVA, if so, call it a miss. If not, it's a hit.

However, we would highly suggest not editing the default code (even though I did here, but I put a # by the original code so I could recover it if needed) and instead writing any changes as a code overwrite in the scripts, just because if you change your mind, getting back the original code is difficult if you overwrite the original code. I wrote this so long ago that I'm not 100% sure how to put this as a script snippet properly anymore but maybe someone else can help with that.

PS: I'm not sure why I have that store line anymore...maybe it isn't needed?
 

Guanto

Auteur
Veteran
Joined
Jul 18, 2018
Messages
111
Reaction score
10
First Language
English
Primarily Uses
RMMV
Are you talking ACE?
No, so sorry. I cant find anything even remotely similar in the MV section.

For physical-hit skills though, the formula becomes (Skill Hit Chance * Actor Hit Chance)
OK so there is a hidden "Actor Hit" chance then, not accessible via the editor itself (right?). And you're saying whatever % I pop in the To Hit: box multiplies this 'Actor Hit Chance' value? Whoa.

Can you point me anywhere that discusses this, any medium, any capacity? TBH I'm sort of stunned that "To Hit" is seemingly an under the hood thing in RM, it's so vital to this genre.

For sure hit skills, the chance doesnt matter
You mean if you tag a skill with "certain hit" correct?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
No, its not hidden. The actor's hit chance is basically the combination of the Hit chance feature of the actor, its current class and its equipments, all of which are viewable and editable in the editor's interface itself. TBH, the only material I ever used aside from experience and this forums is the help file of RPG maker itself. Also, if you hover your mouse into most things in the database, it actually shows a tooltip window describing that thing
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
So noob, so embarrassed, but...

I just don't understand/see where this is in the editor.


And skills correct?
1) then start a new project (just for checking) and you'll see that every default class has a HIT% trait of +95%. That is your to-hit-value, and there is no formula for calculating it, it's simply added through actors, class, equipment and (possibly) states.
2) and no, skills do not change the to hit because skills have no traits.
 

Guanto

Auteur
Veteran
Joined
Jul 18, 2018
Messages
111
Reaction score
10
First Language
English
Primarily Uses
RMMV
1) then start a new project (just for checking) and you'll see that every default class has a HIT% trait of +95%. That is your to-hit-value, and there is no formula for calculating it, it's simply added through actors, class, equipment and (possibly) states.
OK so I know where you can adjust TO HIT in "class", because the 95% is in my face, but this ACTOR reference threw me off, hence why I assumed it was hidden. Turns out it is, kind of. How hard would your judgement hammer come down on me if I said I had no idea you could double click in the blank traits panel of the ACTORS tab. Ugh.

So upon this discovery... for my s̶a̶n̶i̶t̶y̶ clarity... if I set that ACTOR TO HIT to 0%, said actor would never hit a target sans equipment/weapons/class/etc with their own inherent TO HIT ratings. Am I warm?

Also, if an actor had 0% To Hit, but was of a class that had 5% to hit, then the actor would have a total of 5% To Hit. Hoping I have this right so I can shut up.

I'm just so used to To Hit and To Evade being an upfront and center stat along side Strength (Attack) and HP, apparently to a blinding degree.

2) and no, skills do not change the to hit because skills have no traits.
OK I need to get used to the fact skills are basically types of attacks. I keep trying to make skills (in my mind) the area where I could give a character "a skill" (trait?) (like swordsman, sharpshooter, martial artist) where they would get a boost to their base TO HIT when a certain item is equipped or whatever.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
You got it pretty much spot on. The To hit of an actor is computed as follows:

To hit feature on the actor + to hit feature on the class +(or -) to hit bonuses from any states, weapons and armor.

Evade is computed the same way.

To make figuring it out easier, for what you wish to achieve what you should probably do is set the to hit you want on the class, and set all EVA to 0%. Then they either hit or they don't. And you can give bonuses then by adding the feature +to hit to any weapon or armor.

I actually did something like that with one of my weapons, in that if you equip this weapon, your to hit goes up 5%. It's not much, but since I use a default of 95%, that means this weapon never misses unless you are blinded or the enemy has high evade (and I use a default evade of 0%).
 

Guanto

Auteur
Veteran
Joined
Jul 18, 2018
Messages
111
Reaction score
10
First Language
English
Primarily Uses
RMMV
You got it pretty much spot on.
Whew, thanks.

To make figuring it out easier, for what you wish to achieve what you should probably do is set the to hit you want on the class, and set all EVA to 0%.
Totally going to do something like this. I think i am even going to go more stripped down and set the to hit to the actor (now that I've found the hidden parameter windows on Actors tab!) since my rough concept is more like "everyone starts out as a basic human" vs everyone having different archetype roles.

in that if you equip this weapon, your to hit goes up 5%. It's not much, but since I use a default of 95%, that means this weapon never misses unless you are blinded or the enemy has high evade (and I use a default evade of 0%).
I see how I could do this, my conundrum is I only want the weapon to grant the TO HIT bonus if the character equipping the weapon has a corresponding blanket "skill" with that weapon. But with the inability to make a skill grant "to hit" I'll have to think further. Basically "This character is just regular dude who has great aim (initially what i wanted to be a skill), and that's it (no levels or curves or additional fancy class bonuses, etc). If said regular dude picks up a gun he will be more accurate with it than if another character without the "great aim attribute" picked up the gun.

Maybe I could re-purpose classes to this effect. A very stripped down version of classes to just make it a simple one bonus trait someone can have. Of course then i'd have to figure out how to grant a class to a character. Another topic for another day.

Thanks all.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
an actor can only equip something if he has the correct equipment type trait - you could use that as a replacement for requiring a skill.
There are a lot of possible traits, and almost everything is handled through the trait options.
 

Guanto

Auteur
Veteran
Joined
Jul 18, 2018
Messages
111
Reaction score
10
First Language
English
Primarily Uses
RMMV
Hit chance of skills is yes the chance of skills to hit. If 0% that skill shouldnt hit.

For physical-hit skills though, the formula becomes (Skill Hit Chance * Actor Hit Chance)

For sure hit skills, the chance doesnt matter
Only because you forced me to look so hard at this stuff (appreciated), as Andar pointed out Skills don't actually have a 'to hit' trait/chance. I may have thrown you off because I was so confident they did.

Also, as far as formulas, I am under the impression (again after forum post inspired research) that To Hit, being an Ex-Param would actually be Additive, not Multiplicative.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top