[RPGM VXACE] USING AGI IN HIT FORMULA

Posts

Pages: 1
Hello all. I'm currently looking for a way to change how the hit formula works. I want to make it a very simple formula:

(Class Hit % + AGI) - Enemy AGI = Hit Chance

Example - Class has a 90% chance to hit and has 20 AGI. That would give them a 110% chance to hit. Now subtract the enemy AGI which is 22. Now they would have a 88% chance to hit.

I don't want to have any evasion or any other formula to hit or miss. Only that.

I have the Accuracy Overflow script added but I'm not sure exactly how to change the formula. I'm using I would change this to something:

rate = item_hit(user, item) - item_eva(user, item)
@result.missed = (@result.used && rand >= rate)
if @result.missed and rate < item_eva(user, item) and CRZ::ACC_OVER::USE_EV
@result.missed = false; @result.evaded = true
end

but I'm not sure how to change it to use the characters AGI in a way I'm looking for. What is the correct syntax I would use to add in a characters current AGI as well as the enemies?
Marrend
Guardian of the Description Thread
21781
I could be wrong, but, I think what you want to do involves something that looks like...

def item_hit(user, item)
  rate = item.success_rate * 0.01       # Get success rate
  rate *= user.hit if item.physical?    # Physical attack: Multiply hit rate
  rate += (self.agi - user.agi) * 0.01  # Adds user's Agility, then subtracts target's Agility
  return rate                           # Return calculated hit rate
end

...this, not mess with the scripts in any other way, then see what happens!
Its not working. Am I supposed to replace the accuracy overflow script or create a new script with this in it?
Marrend
Guardian of the Description Thread
21781
Where, exactly, did you do to insert it? Was there an error message? How did you determine that it didn't work?

Anyway, making that a new script was the intention. Sorry for not being 100% clear about that!

*Edit: Oh, crap, I just realized something that was missing! Derp-fail!

class Game_Battler < Game_BattlerBase
  def item_hit(user, item)
    rate = item.success_rate * 0.01       # Get success rate
    rate *= user.hit if item.physical?    # Physical attack: Multiply hit rate
    rate += (self.agi - user.agi) * 0.01  # Adds user's Agility, then subtracts target's Agility
    return rate                           # Return calculated hit rate
  end
end

This should be the complete code.

*Slobad at this game*
I'd rather not use the subtractive formula for calculating hit rates - having too high AGI can easily make your character become impossible to hit! Instead, you could use (self.agi+10)/(user.agi+10) as a multiplier to add to the hit rate. It makes a difference depending on whose AGI is higher and prevents AGI stacking from going out of control. The +10 is there to prevent an advantage at low levels from being too severe.
Craze
why would i heal when i could equip a morningstar
15170
He's using my Accuracy Overflow script. Miinkee, put Marrend's code as a new script above most battle scripts, but below Yanfly's Battle Engine Core (if you're using it).

for example

>Craze Accuracy Overflow
>Yanfly Battle Engine Core
>Marrend's item_hit
>all other battle-related scripts

or use this script by yanfly instead of Marrend's:

https://yanflychannel.wordpress.com/rmvxa/core-scripts/extra-param-formulas/

Use these snippets in the appropriate places:

:hit_n_value => "agi * 0.01",

:hit_formula => "base_hit + n",


:eva_n_value => "agi * 0.01",

:eva_formula => "base_eva + n",


This will work with my overflow script to produce the values you wish. =)

LightningLord: I'd agree in general, but for all we know his AGI stat might go from 5-40 or something and nothing higher. Context!
Pages: 1