QUOTE (47948201 @ Jan 14 2013, 11:55 PM)

Maybe this is better-suited for the development and support section? I'm not sure. Anyway...
This is hopefully a simple fix, but I'm trying to make actors' hit rates somewhat dependent on their level (so that when re-visiting old areas with inaccurate weapons, you won't have a hard time hitting super weak bats and bees). What I have in Game_Battler under the *Calculate Hit Rate of Skill/Item is
CODE
def item_hit(user,item)
rate=item.success_rate * 0.01
rate*= user.hit if item.physical?
rate+=user.level if user.actor? #THIS IS THE ADDED LINE
return rate
end
Testing a high-level character against a high-avoid enemy, however, that extra line seems to do nothing. Help?
Thanks!
Your code is right, but there's something you haven't considered...
Rate is a variable which ranges from 0 to 1, so if you add your character level, you'll always have a 100% success rate, the minimum being 1.
I suggest to modify the line this way:
CODE
def item_hit(user,item)
rate=item.success_rate * 0.01
rate*= user.hit if item.physical?
rate+=user.level/100.0 if user.actor? #THIS IS THE ADDED LINE
rate = [rate,1].min
return rate
end
So, if your character will be level 50 (for instances) default rate would be increased by 0.5.
Remeber that a rate greater than 1 will result in a never-missing attack.
Anyway, rate isn't the one thing which influences hit. If enemies has some sort of evasion, you can't be sure your attack will hit at a 100% rate. To prevent this, try this one:
CODE
#--------------------------------------------------------------------------
# * Apply Effect of Skill/Item
#--------------------------------------------------------------------------
def item_apply(user, item)
@result.clear
@result.used = item_test(user, item)
@result.missed = (@result.used && rand >= item_hit(user, item))
#insert here a modification:
if user.is_a?(Game_Actor)
@result.evaded = (!@result.missed && rand < [item_eva(user, item) - user.level/100.0,0].max)
else
@result.evaded = (!@result.missed && rand < item_eva(user, item))
end
if @result.hit?
unless item.damage.none?
@result.critical = (rand < item_cri(user, item))
make_damage_value(user, item)
execute_damage(user)
end
item.effects.each {|effect| item_effect_apply(user, item, effect) }
item_user_effect(user, item)
end
end
In practice, this will reduce enemies EVA by means of the attacker level.
I hope this can help,
Jens