Quote from: akkrin on September 20, 2008, 11:33:19 am
Thanks but there is one problem I can't find that piece of code, is it in one of blizzard's scripts or is it just in the original ones and I just can't find it for some reason?
No, it is not in any of Blizzard's scripts. This is the use of Shift + Ctrl + F, doing a global search of all sections in the script database.
Here are the instructions
:
Go to Game_Battler3 and find Line 42. Line 42 should contain this piece of code:
def attack_effect(attacker)
# Clear critical flag
self.critical = false
# First hit detection
hit_result = (rand(100) < attacker.hit)
# If hit occurs
if hit_result == true
# Calculate basic damage
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage = atk * (20 + attacker.str) / 20
# Element correction
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
This is the battle algorithm that determines how much damage your hero will deal to the enemy.
Find Line 51, here is the code of line 51:
self.damage = atk * (20 + attacker.str) / 20
As you can see, if the atk (Physical Attack) is 0, then multiplying a number by zero is completely useless, resulting in Zero. Replace Line 51 with this new piece of code.
self.damage = (atk + 1) * (20 + attacker.str) / 20
This will never result in the end number being 0 because a number multiplied by itself is...itself.
So we're all good.