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:
<?php 
#==============================================================================
# ** 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_id, turns)
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_id, turns)
refresh
end
#--------------------------------------------------------------------------
# * Add Debuff
#--------------------------------------------------------------------------
def add_debuff(param_id, turns)
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_id, turns)
refresh
end
#--------------------------------------------------------------------------
# * [Add State] Effect: Normal Attack
#--------------------------------------------------------------------------
def item_effect_add_state_attack(user, item, effect)
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(user, item, effect)
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(user, item, effect)
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(user, item, effect)
@
result.success = true if !buff_max?(effect.data_id)
add_buff(effect.data_id, effect.value1)
end
#--------------------------------------------------------------------------
# * [Debuff] Effect
#--------------------------------------------------------------------------
def item_effect_add_debuff(user, item, effect)
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_id, effect.value1)
end
end
#--------------------------------------------------------------------------
# * [Remove Buff] Effect
#--------------------------------------------------------------------------
def item_effect_remove_buff(user, item, effect)
return
unless @buffs[effect.data_id] > 0
remove_buff
(effect.data_id)
@
result.success = true
end
#--------------------------------------------------------------------------
# * [Remove Debuff] Effect
#--------------------------------------------------------------------------
def item_effect_remove_debuff(user, item, effect)
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
(target, item)
return if !
target.result.success && target.result.used
tayruu_successfix_windowbattlelog_affectstatus
(target, item)
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
   Skill Roulette VX + ACE kyonides 0 130 10-04-2024, 06:43 AM
Last Post: kyonides
   Skill Item Kost ACE kyonides 0 988 01-03-2024, 12:07 AM
Last Post: kyonides
   Vampyr's SBABS DVV Addon #1: HUD Item Counter & Skill Delay Bar DerVVulfman 1 6,706 06-19-2012, 03:15 AM
Last Post: DerVVulfman
   Custom Skill Algorithms Lowell 0 4,845 12-07-2008, 05:45 PM
Last Post: Lowell
   Skill Delay VX DerVVulfman 0 4,884 03-06-2008, 04:29 AM
Last Post: DerVVulfman



Users browsing this thread: 1 Guest(s)