Hi,
I don't remember exactly where the state application is implemented, but you could look up where state_rate is actually used by using the built in search function (CTRL + SHIFT + F). You should find it either within Game_BattlerBase or Game_Battler.
# * [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 add_state(state_id) @result.success = true 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 add_state(effect.data_id) @result.success = true end endHere? If I change the asterisks to + signs, that would do the trick you think?
Since you want to reduce the chance for state rates less than 100% (=1.0) you'd also have to subtract 1 from the result, but yes, that would be a way to go.
Whenever you want to modify certain methods from the standard scriptset in order to implement a feature I'd recommend to copy these methods into a new script (along with the class declaration) and only modify the copy. If you ever want to disable the feature or want to make sure it doesn't cause a certain bug you can simply remove the new script and don't have to search the scriptset for modifications (running the risk of missing one). This will also remind you what script features your project currently uses:
class Game_Battler
def item_effect_add_state_normal(user, item, effect)
# New Implementation of this Method
end
end
(On the downside, by defining a method again, the new method will replace the previous definition, so you'd have to merge multiple modifications of the same method, unless you use aliasing.)
I'm really sorry but I'm not a programmer and can't really understand the first or last part of your post (I understand the part about using a new script so as not to mess with the default configuration).
I tried changing the asterisks to + signs but there were still some problems; should I add a -1 to each of those lines? and to be clear, we're talking about all the chance lines except for chance = effect.value1 right?
Sorry,
I meant something like this (and yes, those lines exactly):
class Game_Battler
def item_effect_add_state_attack(user, item, effect)
user.atk_states.each do |state_id|
chance = effect.value1
chance += state_rate(state_id) - 1
chance += user.atk_states_rate(state_id) - 1
#chance *= luk_effect_rate(user)
if rand < chance
add_state(state_id)
@result.success = true
end
end
end
end
Since you want the chance to not change when the target has a state rate of 100% (=1.0) and to be reduced by 100% when the state rate is at 0.
Thanks, I'll try that and let you know how it goes.
So, this definitely works to an extent, but I am still having an issue.
Actor with 50% chance to stun vs. Enemy with 50% stun rate: enemy is never stunned: success
Actor with 100% chance to stun vs. Enemy with 50% stun rate: enemy is stunned about half the time: success
Actor with 100% chance to stun vs. Enemy with 50% stun rate AND a state that gives +50% stun rate: enemy is never stunned: success
Actor with 100% chance to stun vs. Enemy with 50% stun rate AND a state that gives +25% stun rate: enemy is never stunned: failure
In the above case, enemy should be stunned once in a while (25% of the time) but that isn't happening. Any ideas?
-EDIT- OHHH wait, you said it's reduced by 100 at 0, and reduced by 0 at 100...so if I wanted to give 25% state resistance, I would set the state rate to 75?
and if there were 2 sources of resistance that added up to say 30% resistance...I'd make one state rate 90, and the other state rate 80?
Did you eventually set the state rate to *25% ?
This attribute is still centered around 100%, so a state rate of *25% would mean a 75% resistance.
Sorry I didn't want to double post so not sure if you caught my edit...I think I understand now.
So if I wanted an actor with 20% innate resistance, plus a weapon that gave 10% resistance, and an armor that gave 30% resistance,
I would do State Rate 80% for the Actor, State Rate 90% for the weapon, and state rate 70% for the armor, and this would give an effective 60% resistance to the state?
State rate is the chance of state success against the actor, not the resistance, so to define resistance, you reverse it... 🙂
I Think, based on how everyone explained it so far...
Hmm I see, but by default doesn't everyone have 0? Or does this script reverse that as well, and that's why we added the -1 to those chance values?
I do think default is 100%, same with elemental rates... If you don't put anything, it's automatically, 100%.