Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Skill Success Fix
#1
RMVXA Skill Success Fix
v 1.1a

Regardless of if certain skills/items worked, they will be marked as a success. As long as one has an effect - for example, ATK buff - it is considered successful even though you might hit the buff limit, instead of being a failure and so returning a sensible x was unaffected message. In fact, through my observation, an item/skill is only ineffective if it has a target and does nothing, which should never happen in a properly made skill. A skill like Wait is by default set to have no target, so it avoids this.

The purpose of this script is to make the failure message display under the following conditions: applying an already present state, removing a non-existent state, adding a buff at the buff limit, and adding a buff at the debuff limit. In addition, if a skill has many effects, it is only ineffective if all the effects are invalid.

Do note however that doing damage is still considered a success, so you cannot have damage followed by a failure message without perhaps a whole other script that adds effect success.

Script
PHP Code:
#==============================================================================
# ** Game_Battler
#==============================================================================

class Game_Battler Game_BattlerBase
  
#--------------------------------------------------------------------------
  # * Add State
  #--------------------------------------------------------------------------
  
def add_state(state_id)
    if 
state_addable?(state_id)
      
# Order of functions altered
      
unless state?(state_id)
        
add_new_state(state_id)
        @
result.added_states.push(state_id).uniq!
      
end
      reset_state_counts
(state_id)
    
end
  end
  
#--------------------------------------------------------------------------
  # * Remove State
  #--------------------------------------------------------------------------
  
def remove_state(state_id)
    if 
state?(state_id)
      
# Order of functions altered
      
revive if state_id == death_state_id
      
if state?(state_id)
        
erase_state(state_id)
        @
result.removed_states.push(state_id).uniq!
      
end
      refresh
    end
  end
  
#--------------------------------------------------------------------------
  # * Add Buff
  #--------------------------------------------------------------------------
  
def add_buff(param_idturns)
    return 
unless alive?
    
# Functions wrapped in condition
    
unless buff_max?(param_id)
    @
buffs[param_id] += 1
      erase_buff
(param_id) if debuff?(param_id)
      @
result.added_buffs.push(param_id).uniq!
    
end
    overwrite_buff_turns
(param_idturns)
    
refresh
  end
  
#--------------------------------------------------------------------------
  # * Add Debuff
  #--------------------------------------------------------------------------
  
def add_debuff(param_idturns)
    return 
unless alive?
    
# Functions wrapped in condition
    
unless debuff_max?(param_id)
      @
buffs[param_id] -= 1
      erase_buff
(param_id) if buff?(param_id)
      @
result.added_debuffs.push(param_id).uniq!
    
end
    overwrite_buff_turns
(param_idturns)
    
refresh
  end
  
#--------------------------------------------------------------------------
  # * [Add State] Effect: Normal Attack
  #--------------------------------------------------------------------------
  
def item_effect_add_state_attack(useritemeffect)
    
user.atk_states.each do |state_id|
      
chance effect.value1
      chance 
*= state_rate(state_id)
      
chance *= user.atk_states_rate(state_id)
      
chance *= luk_effect_rate(user)
      if 
rand chance
        
# Only success if valid action
        
@result.success true if state_addable?(effect.data_id) && !state?(effect.data_id)
        
add_state(state_id)
      
end
    end
  end
  
#--------------------------------------------------------------------------
  # * [Add State] Effect: Normal
  #--------------------------------------------------------------------------
  
def item_effect_add_state_normal(useritemeffect)
    
chance effect.value1
    chance 
*= state_rate(effect.data_id) if opposite?(user)
    
chance *= luk_effect_rate(user)      if opposite?(user)
    if 
rand chance
      
# Only success if valid action
      
@result.success true if state_addable?(effect.data_id) && !state?(effect.data_id)
      
add_state(effect.data_id)
    
end
  end
  
#--------------------------------------------------------------------------
  # * [Remove State] Effect
  #--------------------------------------------------------------------------
  
def item_effect_remove_state(useritemeffect)
    
chance effect.value1
    
if rand chance
      
# Only success if valid action
      
@result.success true if state?(effect.data_id)
      
remove_state(effect.data_id)
    
end
  end
  
#--------------------------------------------------------------------------
  # * [Buff] Effect
  #--------------------------------------------------------------------------
  
def item_effect_add_buff(useritemeffect)
    @
result.success true if !buff_max?(effect.data_id)
    
add_buff(effect.data_ideffect.value1)
  
end
  
#--------------------------------------------------------------------------
  # * [Debuff] Effect
  #--------------------------------------------------------------------------
  
def item_effect_add_debuff(useritemeffect)
    
chance debuff_rate(effect.data_id) * luk_effect_rate(user)
    if 
rand chance
      
@result.success true if !debuff_max?(effect.data_id)
      
add_debuff(effect.data_ideffect.value1)
    
end
  end
  
#--------------------------------------------------------------------------
  # * [Remove Buff] Effect
  #--------------------------------------------------------------------------
  
def item_effect_remove_buff(useritemeffect)
    return 
unless @buffs[effect.data_id] > 0
    remove_buff
(effect.data_id
    @
result.success true
  end
  
#--------------------------------------------------------------------------
  # * [Remove Debuff] Effect
  #--------------------------------------------------------------------------
  
def item_effect_remove_debuff(useritemeffect)
    return 
unless @buffs[effect.data_id] < 0
    remove_buff
(effect.data_id
    @
result.success true
  end
end

#==============================================================================
# ** Window_BattleLog
#==============================================================================

class Window_BattleLog Window_Selectable
  
#--------------------------------------------------------------------------
  # * Display Affected Status
  #--------------------------------------------------------------------------
  
alias :tayruu_successfix_windowbattlelog_affectstatus :display_affected_status
  def display_affected_status
(targetitem)
    return if !
target.result.success && target.result.used
    tayruu_successfix_windowbattlelog_affectstatus
(targetitem)
  
end
end 

Compatibility Notes
This script is only for RMVXAce. This script replaces a number of item_effect_* definitions in Game_Battler, as well as the sub-definitions of add_/remove _state/_buff/_debuff, so should be placed above any scripts that alias these.

The script also alters part of the Battle Log window. As the edit is rather simple, feel free to take the return condition line and place it in whatever edits you may have made yourself, and it should avoid the alerts still showing up.

The script leaves the actual addition of the states/buffs alone. While a skill might be considered ineffective, the state/buff's turn counter will still be reset. Perhaps in a future version I will add a message for x's [state] timer was extended!, however that might require more invasive incompatibility.

Credits
Credits should go to myself "Taylor".

(PS: By default VXAce displays failure messages for spells missing, which I think is silly. But that's additional edits not really related to this issue.)
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Fast Skill Grouping DerVVulfman 2 2,139 06-16-2021, 02:47 AM
Last Post: DerVVulfman
   DoubleX RMMV Skill Hotkeys DoubleX 2 3,785 02-13-2021, 04:59 AM
Last Post: DoubleX
   DoubleX RMMZ Skill Item Cooldown DoubleX 4 3,329 02-07-2021, 04:11 PM
Last Post: DoubleX
   DoubleX RMMZ Skill Item Triggers DoubleX 3 2,977 12-26-2020, 04:00 PM
Last Post: DoubleX
   MicKo's Skill Tree - Revised DerVVulfman 49 42,052 12-17-2019, 04:13 AM
Last Post: DerVVulfman
   DoubleX RMMV Skill Hotkeys Compatibility DoubleX 0 1,980 09-06-2019, 09:56 AM
Last Post: DoubleX
   Skill Casting Delay DerVVulfman 1 5,815 11-20-2018, 05:38 AM
Last Post: DerVVulfman
   MicKo's Skill Tree DerVVulfman 48 71,136 11-08-2016, 08:04 PM
Last Post: DerVVulfman
   Skill Shop Legacy 1 6,016 06-30-2012, 07:36 PM
Last Post: KasperKalamity
   Vampyr's SBABS DVV Addon #1: HUD Item Counter & Skill Delay Bar DerVVulfman 1 5,144 06-19-2012, 03:15 AM
Last Post: DerVVulfman



Users browsing this thread: