Hello, I have a trouble with Victor Custom hit formula script which you can find here You'll see, I tried this formula for magical based attacks like this one rand < 1 * [[((255 - b.mev * 2) + 1), 1].max, 255].min / 256.0 The problem is, I'm trying to make when the user has the state number 20, the formula works like this rand < 0.2 * [[((255 - b.mev * 2) + 1), 1].max, 255].min / 256.0 I even tried to create a script line for this class Game_Battler < Game_BattlerBase def magic_acc(a, b, base) x1 = base if a.state?(20) then x1 *= 0.2 end acc = rand < x1 * [[((255 - b.mev * 2) + 1), 1].max, 255].min / 256.0 return acc end end And I put this in the <hit formula> tags Code: <hit formula> a.magic_acc(a, b, base) </hit formula> Physical formula is this one, the same Victor uses as an example Code: rand < hit * ([[((255 - eva * 2) + 1), 1].max, 255].min / 256.0) I'm having some troubles, it's not checking the state to make the attack fails, it's not considering the target's magic evasion either, with physical based formula, it's not checking hit rate and target's evasion, the attack always hits Can someone please help me to fix those troubles? Thank you

Hmm... You're not passing a value to base here, but I won't dwell on it since it's not the primary concern... Code: <hit formula> a.magic_acc(a, b, base) </hit formula> Evasion doesn't actually do anything in your formula because you're subtracting a value of less than 1(usually) from 255. So even if a battler had 100% evasion, and the attacker had 95% Hit... 0.95 * ((255.0 - 1.0 * 2) + 1) / 256.0 = 0.9425 Basically, a 95% hit chance becomes 94% against 100% evasion. So maybe multiply by 200 instead. 0.95 * ((255.0 - 1.0 * 200) + 1) / 256.0 = 0.2078

Well, it DID fit the part of checking target evasion/magic evasion However, it doesn't fit the part where the state number 20 changes user's hit rate percent of the magical attack Do you have any idea about how to fix that? Thank you

The formula probably just needs a rewrite. Code: VE_DEFAULT_HIT_FORMULA = ' action = a.current_action.item if action.physical? acc = hit * ([[((255 - eva * 200) + 1), 1].max, 255].min / 256.0) elsif action.magical? if a.state?(20) acc = 0.2 * ([[((255 - b.mev * 200) + 1), 1].max, 255].min / 256.0) else acc = 1.0 * ([[((255 - b.mev * 200) + 1), 1].max, 255].min / 256.0) end else ; acc = 1.0 end #-- return rand < acc'

The troubles is there will be magic attacks with a lower (or higher) hit rate, so putting it as a plain 100% for magical based attacks won't work Hoewer, I did make a mistake when I put the hit formula in the attack, in the case of the 100% hit rate magical based attacks, it'd be like this Code: <hit formula> a.magic_acc(a, b, 1.0) </hit formula> So, when I put it this way, it recognize the target's magical evasion and it -seems- to recognize the attack's hit rate But it doesn't recognize the state's hit rate reduction, how do I fix that?

Aside from benefiting from some remediation, I didn't spot any issues with your magic evasion method that would cause it not to work. My rewrite works fine, but I didn't actually do much differently. #============================================================================== # ** Game_Battler #------------------------------------------------------------------------------ # A battler class with methods for sprites and actions added. This class # is used as a super class of the Game_Actor class and Game_Enemy class. #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # * New Method: Calculate Magic Evasion #-------------------------------------------------------------------------- def magic_acc(a, b, base) base = [base * 0.20, 0].max if state?(20) base * ([[((255 - b.mev * 200) + 1), 1].max, 255].min / 256.0) end # magic_acc end # Game_Battler The note tag requires a slight adjustment. <hit formula> rand < a.magic_acc(a, b, 1.0) </hit formula> May as well adjust the default formula... VE_DEFAULT_HIT_FORMULA = ' action = a.current_action.item if action.physical? acc = hit * ([[((255 - eva * 200) + 1), 1].max, 255].min / 256.0) elsif action.magical? acc = a.magic_acc(a, b, 1.0) else ; acc = 1.0 end #-- return rand < acc' My tests reveal that everything works as intended with this setup. If you wish to test something out yourself, printing to console is a pretty good way to go about it. <hit formula> acc = a.magic_acc(a, b, 1.0) print "#{acc}\n\n" rand < acc </hit formula> When state 20 is applied, you should see the printed value decrease substantially. The console can be turned on from the menu bar under 'Game'.