Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
324
Reaction score
95
First Language
Enlish
Hello!

I'm trying to adjust the code in my game so that the accuracy formula is used as Success Rate of Skill X Hit Rate of User X Evasion Rate of Target = Chance of skill landing.

The only script I'm using that effects the item_apply that interacts with this hit rate is Craze Accuracy overflow.

That script modifies the hit rate formula so that only @result.missed is taken into account and changes the formula to item.hit - item.eva.

Below, you can see I edited the code so that edited the formula so that Rate = Item_hit * item_eva instead. Item_hit already multiplies the success rate of the skill against the hit rate, so theoretically, this change should yield the results I want.

Ruby:
class Game_Battler < Game_BattlerBase

  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    
    # ALL CHANGES BELOW HERE
    #rate = item_hit(user, item) - item_eva(user, item)
    rate = item_hit(user, item) * item_eva(user, item)
    @result.missed = (@result.used && rand < rate)
    #@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
    # ALL CHANGES ABOVE HERE
    
    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
 
end # Game_Battler

However, I'm finding that this formula isn't working as it says.

For example, I tested the formula with a 20% success rate.

.20 (success rate) X 1.0 (user hit) X 1.0 (eva) = should yield a 20% chance of the skill missing.

When I tested this, the skill missed everytime. Okay cool, 20% is low odds. That makes sense.

However, when I changed the success rate to 75%, the skill still missed every single time. Which is hard to believe.

Rand should calculate a number between 0 and 1.0, meaning 75% of the is should pull a number that is less than .75. However all the skills missed...

Skill set up and Player and Enemy State pages
1656774311264.png1656774327904.png1656774357477.png

I think I'm missing something here, but I can't put my finger on what it is. I can't find any other scripts that impact this part of them item_apply, so maybe I'm just misunderstanding how the script is written?
 

Latest Threads

Latest Profile Posts

Fun question - how do you manage the scope of your projects? All of my projects seem to balloon until they pop and they are suddenly nonexistent!
no I did not just have to write a song three different times because my music software doesn't support tempo changes!!
I WILL defeat this demonic USB connection notification bug
ScreenShot_8_15_2022_6_22_24.png
Mike trying to dodge the Memory Pawns invading Bantam Street. I like how the filters I used on the map almost make it look like the street is wet in a sense.
Come watch as Studio Blue plays OMORI live on the final RPG Maker Critiques stream!

Forum statistics

Threads
124,568
Messages
1,164,450
Members
163,385
Latest member
goonfuture
Top