Weapon Hit %
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Here is "Part 2" of the weapon statistics that was in RM2K/3 and booted out of RMXP. Part 1 is Weapon Critical%.
Here in Part 2, we bring back a weapon's own hit rate. Well, sort of. It's not perfect, and you'll see why later.

Start a new project, make copies of Game_Actor, Game_Enemy, and Game_Battler 1 and paste them right below the originals. This is in case things go wrong. Put "WeaponHit" or something beside them to differienate between them better.

In Game_Actor (WeaponHit), scroll down until you hit "def base_eva" section. Paste this right below it:

Code:
#--------------------------------------------------------------------------
  # ● Weapon Hit %
  #--------------------------------------------------------------------------
  def base_hit
    case @weapon_id
    # PhotonWeapon: Set weapons' hit %. If no weapon
    # is equipped, Hit% is automatically 90 (default).
    #
    # Arshes' Weapons (swords)
    when 1
      weapon_hit = 90
    when 2
      weapon_hit = 85
    when 3
      weapon_hit = 90
    when 4
      weapon_hit = 90
    # Basil's Weapons (spears/lances)
    when 5
      weapon_hit = 90
    when 6
      weapon_hit = 85
    when 7
      weapon_hit = 90
    when 8
      weapon_hit = 90
    # Gloria's Weapons (maces)
    when 25
      weapon_hit = 85
    when 26
      weapon_hit = 80
    when 27
      weapon_hit = 85
    when 28
      weapon_hit = 90
    # Hilda's Weapons (staves/rods)
    when 29
      weapon_hit = 90
    when 30
      weapon_hit = 85
    when 31
      weapon_hit = 90
    when 32
      weapon_hit = 90
    end
    weapon = $data_weapons[@weapon_id]
    weapon_hit = weapon != nil ? weapon_hit : 90
    return weapon_hit
  end

What that case statement does is set a weapon's hit% according to its ID in the Database. For example, the Bronze Sword is Weapon ID #1 (001 in Database), so its hit rate is 90%. The Iron Sword is Weapon ID #2; its hit rate is 85%. If a character has no weapon equipped, hit rate is automatically 90%.

It does not exactly have to be this way, you can change the default hit rate back to 100%, or whatever. And there are probably ways to shorten that, like setting the weapon_hit variable to 90 first before the case statement and only using cases for weapons that have hit rates other than 90.


Go to Game_Enemy (the one that you will edit), scroll until you hit "def base_eva". Paste this below it:

Code:
#--------------------------------------------------------------------------
  # ● Monster's Hit %
  #--------------------------------------------------------------------------
  def base_hit
    # PhotonWeapon: Set enemy's default hit rate to 90%.
    enemy_hit = 90
    return enemy_hit
  end

You'll have to do this or the game will crash when an enemy attacks.


Go to Game_Battler 1 (the new one), and in the "def hit" section here:

Code:
#--------------------------------------------------------------------------
  # ● 命中率の取得
  #--------------------------------------------------------------------------
  def hit
    n = 100
    for i in @states
      n *= $data_states[i].hit_rate / 100.0
    end
    return Integer(n)
  end

Change the "100" to "base_hit". This will take the "base_hit" of a character (which is the weapon's hit rate) and of an enemy (which was set in Game_Enemy).


And there you go. It should work, I tried it myself and purposely gave myself and the enemy 1% Hit. They kept missing over and over again. But like I said, it's not perfect. Mostly because of that whole agility/dexterity/evasion accuracy thing. The accuracy formulas in Game_Battler 3 may or may not have to be changed, I'm not sure.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Actor's Weapon Skill Leon Westbrooke 0 2,815 09-21-2006, 01:00 PM
Last Post: Leon Westbrooke
  Weapon Proficiency Leon Westbrooke 0 2,504 08-07-2006, 01:00 PM
Last Post: Leon Westbrooke
  New Weapon System Spiritus 0 2,418 09-26-2005, 01:00 PM
Last Post: Spiritus
  Equip Weapon Gain Skill makeamidget 0 2,417 08-17-2005, 01:00 PM
Last Post: makeamidget



Users browsing this thread: 1 Guest(s)