Jump to content
TheoAllen

Ace Battle Engine (Critical Popup FIX)

Recommended Posts

YEA - Battle Engine (Critical Popup FIX)

Original Script : YEA - Battle Engine

 

Introduction :

dinhbat3 has noticed that YEA Battle Engine itself has a bug that critical never shown up. Since I also fans of Yanfly's script, then here is the bugfix

 

Screenshot :

 

 

yea-crit02.jpg

On before fix

 

yea-crit01.jpg

On after fix

 

 

 

Script 

Put this script on after Yanfly's

class Game_Battler
  
  def make_damage_value(user, item)
    game_battler_make_damage_value_abe(user, item)
    rate = item_element_rate(user, item)
    make_rate_popup(rate) unless $game_temp.evaluating
    if @result.critical
      text = YEA::BATTLE::POPUP_SETTINGS[:critical]
      rules = "CRITICAL"
      create_popup(text,rules) 
    end
  end
  
end

Credit :

- Yanfly as original scripter

- I take no credit by doing this. But if you feel grateful, you may put my name in special thanks.

Share this post


Link to post
Share on other sites

This seems to directly conflicy with Yanfly's Lunatic Damage. I'll spoiler the script since his site is having difficulties.

 

 

#==============================================================================## â–¼ Yanfly Engine Ace - Lunatic Damage v1.01# -- Last Updated: 2011.12.22# -- Level: Lunatic# -- Requires: n/a##==============================================================================$imported = {} if $imported.nil?$imported["YEA-LunaticDamage"] = true#==============================================================================# â–¼ Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2011.12.22 - Small bugfix on notetags and Ace Battle Engine compatibility.# 2011.12.20 - Started Script and Finished.##==============================================================================# â–¼ Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Lunatic mode effects have always been a core part of Yanfly Engine scripts.# They exist to provide more effects for those who want more power and control# for their items, skills, status effects, etc., but the users must be able to# add them in themselves.## At first, I thought the need for Lunatic Damage tags would be no longer# needed due to RPG Maker VX Ace's custom damage formula box, but after# realizing that it's limited in size (100 characters max), Lunatic Damage will# have to take over if needed.##==============================================================================# â–¼ Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below â–¼ Materials/ç´ æ but above â–¼ Main. Remember to save.##==============================================================================# â–¼ Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.##==============================================================================class Game_Battler < Game_BattlerBase   #--------------------------------------------------------------------------  # â— Welcome to Lunatic Mode  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  # Lunatic Damage Formulas allows skills and items to use custom damage  # formulas that allow for more than 100 characters. Use the following  # notetag to assign the formulas to be used.  #  #	 <custom damage: string>  #  # The string used will refer to the formula used below. Also, note that  # through this script, all items and skills will run through this method  # even if the <custom damage> notetag isn't used.  #  # "NORMAL FORMULA" will be the formula used if no custom damage formulas  # are inserted. In addition to that, you may also insert "NORMAL FORMULA"  # to have the custom damage formula add on the normal damage formula used  # in "Formula Calculation" within the database editor.  #  # If multiple tags of the custom damage notetags are used in the same  # skill/item's notebox, then the calculations will occur in that order.  # Replace "string" in the tags with the appropriate flag for the method  # below to search for. Note that unlike the previous versions, these are  # all upcase.  #  # Should you choose to use multiple lunatic formulas for a single skill or  # item, you may use these notetags in place of the one shown above.  #  #	 <custom damage>  #	  string  #	  string  #	 </custom damage>  #  # All of the string information in between those two notetags will be  # stored the same way as the notetags shown before those. There is no  # difference between using either.  #--------------------------------------------------------------------------  def lunatic_damage_formula(user, item)    formulas = item.custom_damage    @calc_element = true    @calc_pdr = true    @calc_mdr = true    @calc_rec = true    @calc_cri = true    @calc_var = true    @calc_guard = true    a = user    b = self    value = 0    for formula in formulas	  case formula.upcase	  #----------------------------------------------------------------------	  # Damage Formula: Normal Formula	  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	  # This formula uses/adds on the normal formula displayed in the	  # database editor. If no custom damage formulas are used, this will	  # take effect.	  #----------------------------------------------------------------------	  when /NORMAL FORMULA/i	    value += item.damage.eval(user, self, $game_variables)	    	  #----------------------------------------------------------------------	  # Damage Formula: Common Damage	  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	  # This is a part of the damage formulas that will run every time damage	  # is calculated. This step will always occur at the end but right	  # before the Finalization step.	  #----------------------------------------------------------------------	  when /COMMON DAMAGE/i	    # No common after effects added.					    	  #----------------------------------------------------------------------	  # Custom Critical Chance Formula	  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	  # Adjusts the attack's critical hit rate by the amount specified.	  # Formula notetag:	  #   <custom damage: crit +x%>	  #   <custom damage: crit -x%>	  #----------------------------------------------------------------------	  when /CRIT+[ ]([\+\-]\d+)([%ï¼…])/i	    rate = $1.to_i * 0.01	    @result.critical = (rand < rate)	    value += item.damage.eval(user, self, $game_variables)	    	  #----------------------------------------------------------------------	  # Damage Formula: Finalization	  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	  # All damage calculations will run "FINALIZATION" after calculating.	  # Adjust whatever settings you want done here. By default, this setting	  # will correct certain values in case they go under specific amounts	  # under specific conditions (like HP draining).	  #----------------------------------------------------------------------	  when /FINALIZATION/i	    value *= item_element_rate(user, item) if @calc_element	    value *= pdr if item.physical? && @calc_pdr	    value *= mdr if item.magical? && @calc_mdr	    value *= rec if item.damage.recover? && @calc_rec	    value = apply_critical(value) if @result.critical && @calc_cri	    value = apply_variance(value, item.damage.variance) if @calc_var	    value = apply_guard(value) if @calc_guard	    #---	    if formulas.include?("NORMAL FORMULA")		  if item.damage.to_mp?		    value = [b.mp, value].min		  elsif item.damage.to_hp? && item.damage.drain?		    value = [b.hp, value].min		  end	    end # formulas.include?("NORMAL FORMULA")	    	  #----------------------------------------------------------------------	  # Stop editting past this point.	  #----------------------------------------------------------------------	  else	    value += lunatic_damage_extension(formula, a, b, item, value)	  end    end    return value.to_i  end # lunatic_damage_formula(user, item) end # Game_Battler#==============================================================================# â–¼ Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================module YEA  module REGEXP  module USABLEITEM        CUSTOM_DAMAGE_STR = /<(?:CUSTOM_DAMAGE|custom damage):[ ](.*)>/i    CUSTOM_DAMAGE_ON  = /<(?:CUSTOM_DAMAGE|custom damage)>/i    CUSTOM_DAMAGE_OFF = /<\/(?:CUSTOM_DAMAGE|custom damage)>/i      end # USABLEITEM  end # REGEXPend # YEA#==============================================================================# â–  DataManager#==============================================================================module DataManager   #--------------------------------------------------------------------------  # alias method: load_database  #--------------------------------------------------------------------------  class <<self; alias load_database_ldmg load_database; end  def self.load_database    load_database_ldmg    load_notetags_ldmg  end   #--------------------------------------------------------------------------  # new method: load_notetags_ldmg  #--------------------------------------------------------------------------  def self.load_notetags_ldmg    groups = [$data_items, $data_skills]    for group in groups	  for obj in group	    next if obj.nil?	    obj.load_notetags_ldmg	  end    end  end end # DataManager#==============================================================================# â–  RPG::UsableItem#==============================================================================class RPG::UsableItem < RPG::BaseItem   #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_accessor :custom_damage   #--------------------------------------------------------------------------  # common cache: load_notetags_ldmg  #--------------------------------------------------------------------------  def load_notetags_ldmg    @custom_damage = []    @custom_damage_on = false    #---    self.note.split(/[\r\n]+/).each { |line|	  case line	  #---	  when YEA::REGEXP::USABLEITEM::CUSTOM_DAMAGE_STR	    @custom_damage.push($1.to_s)	  #---	  when YEA::REGEXP::USABLEITEM::CUSTOM_DAMAGE_ON	    @custom_damage_on = true	  when YEA::REGEXP::USABLEITEM::CUSTOM_DAMAGE_OFF	    @custom_damage_on = false	  #---	  else	    @custom_damage.push(line.to_s) if @custom_damage_on	  end    } # self.note.split    #---    @custom_damage.push("NORMAL FORMULA") if @custom_damage == []    @custom_damage.push("COMMON DAMAGE")    @custom_damage.push("FINALIZATION")  end end # RPG::UsableItem#==============================================================================# â–  Game_ActionResult#==============================================================================class Game_ActionResult   #--------------------------------------------------------------------------  # overwrite method: make_damage  #--------------------------------------------------------------------------  def make_damage(value, item)    @critical = false if value == 0    @hp_damage += value if item.damage.to_hp?    @mp_damage += value if item.damage.to_mp?    @hp_drain += @hp_damage if item.damage.drain?    @mp_drain += @mp_damage if item.damage.drain?    @success = true if item.damage.to_hp? || @mp_damage != 0  end end # Game_ActionResult#==============================================================================# â–  Game_Battler#==============================================================================class Game_Battler < Game_BattlerBase   #--------------------------------------------------------------------------  # overwrite method: make_damage_value  #--------------------------------------------------------------------------  def make_damage_value(user, item)    value = lunatic_damage_formula(user, item)    @result.make_damage(value.to_i, item)    return unless $imported["YEA-BattleEngine"]    rate = item_element_rate(user, item)    make_rate_popup(rate) unless $game_temp.evaluating  end   #--------------------------------------------------------------------------  # new method: lunatic_damage_extension  #--------------------------------------------------------------------------  def lunatic_damage_extension(formula, a, b, item, total_damage)    # Reserved for future Add-ons.    value = 0    return value  end end # Game_Battler#==============================================================================## â–¼ End of File##==============================================================================

 

 

 

If I put the Critical Popup fix anywhere ABOVE Lunatic Damage, the popup breaks. If I put it anywhere BELOW Lunatic Damage, critical MP restoration breaks (ie someone casts an ability that gives them MP points, that ability can crit but if it does, the amount of MP restored is unchanged)

 

This is weird because all this is supposed to do is define a popup category. Why is it screwing up MP restoration?

 

 

Believe it or not I actually managed to piece together a fix! Since I still can't even see my previous post, feel free to merge them for me.

 

If you are using Lunatic Damage, you need to take parts of TheoAllen's fix, and add them in to Yanfly's script at the very end. You want that portion of the script to look like this:

 

 

  #--------------------------------------------------------------------------  # overwrite method: make_damage_value  #--------------------------------------------------------------------------  def make_damage_value(user, item)    value = lunatic_damage_formula(user, item)    @result.make_damage(value.to_i, item)    return unless $imported["YEA-BattleEngine"]    rate = item_element_rate(user, item)    make_rate_popup(rate) unless $game_temp.evaluating    	    if @result.critical	  text = YEA::BATTLE::POPUP_SETTINGS[:critical]	  rules = "CRITICAL"	  create_popup(text, rules)    end      end 

 

 

 

That seems to have done the trick!

Share this post


Link to post
Share on other sites

Well, as long as the @result.critical returns true, so there is a popup. Even it means that the damage is zero. Damage number and critical are different thing. And, are their confusion skill allow critical hit?

Share this post


Link to post
Share on other sites

Derp I posted that in the wrong thread.  Sorry!

 

Free bump for you I guess!

 

Edit:  Though I do wonder if there was a similar ommision for State Resist?  If I have resistance to an element, I get a popup that says "Resist". but if I'm immune to a state, (or a boss enemy is immune to Stun, for example), there is no such popup for State Resistance.

Edited by XPhater

Share this post


Link to post
Share on other sites

This will likely be the closest I can find to the Dragon Quest / Dragon Warrior battle system. The original game is pretty dated..but this shall do~

 

http://i.imgur.com/6JLabaR.png 

 

I don't care for the old press the menu to talk, search, etc like they have in the menu in the original and the others. 

 

EDIT:

 

Woops, this isn't quite like that system

Edited by Kuronekox

Share this post


Link to post
Share on other sites

Edit:  Though I do wonder if there was a similar ommision for State Resist?  If I have resistance to an element, I get a popup that says "Resist". but if I'm immune to a state, (or a boss enemy is immune to Stun, for example), there is no such popup for State Resistance.

Yes, I could make that. But that would be look untidy. Some of state resistance should not be poped up. So, YF don't do that.

 

This will likely be the closest I can find to the Dragon Quest / Dragon Warrior battle system. The original game is pretty dated..but this shall do~

 

http://i.imgur.com/6JLabaR.png 

 

I don't care for the old press the menu to talk, search, etc like they have in the menu in the original and the others. 

 

EDIT:

 

Woops, this isn't quite like that system

What did you try to say? another free bump? xD

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×