[RMVX ACE] NEED HELP! GET AN EXTRA TURN WHEN YOU GET A CRITICAL HIT
Posts
Pages:
1
I've been trying to modify and add a new script that if your character get's an critical hit on an enemy you get an extra turn. I'm using the Free Turn Battle System made by yanfly and I tried using things such as
You're going to have to redefine apply_critical a bit to make it work.
def apply_critical(user, damage)
user.add_state(id)
return damage * 3
end
and
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(user, value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
@result.make_damage(value.to_i, item)
Both of them crash the game when either my character get's a critical hit on an enemy or the other way around can anyone help me out with this?
You're going to have to redefine apply_critical a bit to make it work.
def apply_critical(user, damage)
user.add_state(id)
return damage * 3
end
and
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(user, value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
@result.make_damage(value.to_i, item)
Both of them crash the game when either my character get's a critical hit on an enemy or the other way around can anyone help me out with this?
The question that occurs to me by looking at this is what is the value of "id" in the "user.add_state(id)" line? It doesn't appear to be defined, which means it's using the default value of nil. Which, in turn, would generate an error when trying to access the add_state function, as it's probably looking for a specific state ID to apply.
I did apply a state to it, that state boosts a characters agility hence get him/her an extra turn since i'm using the Yanfly Free Turn Battle System, it just when someone get's a critical this message pops up
Script 'Game_Battler' line 357:: ArgumentError Occurred wrong number of arguments (2 for 1)
Also I'm using this script
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Get Element Modifier for Skill/Item
#--------------------------------------------------------------------------
def item_element_rate(user, item)
if item.damage.element_id < 0
the_rate = (user.atk_elements.empty? ? 1.0 : elements_max_rate(user.atk_elements))
else
the_rate = (element_rate(item.damage.element_id))
end
if the_rate >= 2
user.add_state(26)
end
return the_rate
end
end
This script works in getting an extra turn when I hit an enemy with an element that it's weak against is there a chance that I can modify this so get an extra turn when any of my characters get's a critical on an enemy?
Script 'Game_Battler' line 357:: ArgumentError Occurred wrong number of arguments (2 for 1)
Also I'm using this script
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Get Element Modifier for Skill/Item
#--------------------------------------------------------------------------
def item_element_rate(user, item)
if item.damage.element_id < 0
the_rate = (user.atk_elements.empty? ? 1.0 : elements_max_rate(user.atk_elements))
else
the_rate = (element_rate(item.damage.element_id))
end
if the_rate >= 2
user.add_state(26)
end
return the_rate
end
end
This script works in getting an extra turn when I hit an enemy with an element that it's weak against is there a chance that I can modify this so get an extra turn when any of my characters get's a critical on an enemy?
If a battler hitting a weak spot via elemental attributes applies the state, which also allows for an extra turn, then applying that same state when a battler performs a critical should also work. It's just a question of figuring out why this error message is popping up.
Which is an interesting point onto itself. It's looking for one argument, but is receiving two. Line 357 in Game_Battler is where apply_critical normally executes in the make_damage_value function, and only sends one parameter. So, for some reason, it's not reading the apply_critical function correctly.
Where you doing a battle test via the database? Personally speaking, I've noticed that if I'm doing a battle test via the database, it doesn't necessarily recognize whatever changes I've made to the code-base. So, the best suggestion I can give would be to try starting a playtest, quitting, then do a battle test to see if the error persists.
In the case that you're getting this error outside of a battle test, in all honesty, I'm not sure where to go from here!
Which is an interesting point onto itself. It's looking for one argument, but is receiving two. Line 357 in Game_Battler is where apply_critical normally executes in the make_damage_value function, and only sends one parameter. So, for some reason, it's not reading the apply_critical function correctly.
Where you doing a battle test via the database? Personally speaking, I've noticed that if I'm doing a battle test via the database, it doesn't necessarily recognize whatever changes I've made to the code-base. So, the best suggestion I can give would be to try starting a playtest, quitting, then do a battle test to see if the error persists.
In the case that you're getting this error outside of a battle test, in all honesty, I'm not sure where to go from here!
Pages:
1