[RMVX ACE] [RGSS] REPLACING EVASION WITH A STAT?

Posts

Pages: 1
Hey everyone- I recently made another thread in the Help Me section about reorganizing/retooling the basic stats of VX Ace to fit what I wanted for my project. I've since completed all but one of these retools with the help of the people in that thread. Evasion is what's eluding me right now.

The basic problem is: I want to use Magic Defense as my Evasion stat, for every Actor and Enemy in the game. I want it to be automatically converted from a 1-100 Stat value to the normal 1-100% value for the xparameter.

I'm not skilled at all with scripting, so my only attempts thus far have been to just plug in param(5) instead of xparam(1) in the BattlerBase class, which... Obviously doesn't work. All I've been able to do so far is to completely break Evasion so that either every attack hits or every attack misses, which is definitely not what I want.

Like so:


I'm figuring the solution will lie in editing the BattlerBase script (based on advice I got in the last thread), but since I clearly have no idea what I'm doing here and don't know a thing about RGSS or coding in general, any help or solutions would be greatly appreciated.

To reiterate: I want each actor's/enemy's Magic Defense to equal their Evasion and be used as it. If this can't be done within the confines of VXA or requires significant reworking, then I'll figure out another way to organize the stats and replace the ones that I wasn't going to use.

Thanks.
SunflowerGames
The most beautiful user on RMN!
13323

Doesn't Yanfly have a script that adds extras stat parameters.

https://yanflychannel.wordpress.com/rmvxa/core-scripts/extra-param-formulas/
All that script does is crash the game, and even in a battle test it doesn't solve my problem, as it seems to not use the Magic Defense as the Evasion rate even if I tell it to. Thanks, though.
I'm not on my computer right now, so I can't verify just yet, but I think the one you should edit is the item_eva method.

I'll look into it more when I get home...
Damn, I completely forgot about this >_<
Sorry...

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # ● スキル/アイテムの回避率計算
  #--------------------------------------------------------------------------
  def item_eva(user, item)
    #vv replace the 'eva' and/or 'mev' with 'mdf/100' (since eva and mev are percentages)
    return eva if item.physical?            # 物理攻撃なら回避率を返す
    return mev if item.magical?             # 魔法攻撃なら魔法回避率を返す
    return 0
  end
end


If that doesn't work for some reason, you can go to item_apply and force it there:
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # ● スキル/アイテムの効果適用
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    #vv this line's the one that determines whether an action is evaded or not
    # 'rand' returns a decimal number between 0 to 1, so make sure to use 'mdf/100' instead of just 'mdf'
    @result.evaded = (!@result.missed && rand < item_eva(user, item))
    #^^ this line's the one that determines whether an action is evaded or not
    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
Pages: 1