Okay scroll down in that little section till you hit something that looks like this:
# Critical correction
if rand(100) < 4 * attacker.dex / self.agi
self.damage *= 2
self.critical = true
end
Now I don't know how you want this exactly, but from your example change it to this:
# Critical correction
if rand(100) < 4 + attacker.agi / 100
self.damage *= 2
self.critical = true
end
Having it like this would make it so when YOU attack an enemy, you have a (4% + 1% per 100 agi) chance to score a critical.
If you have any math skills, you can change the '4 + attacker.agi / 100' to anything else.
(attacker.agi represents the attacking unit's agility. You can change attacker.agi to attacker.dex or attacker.str, etc.
If you want the attacked unit to be represented, use self instead of attacker. Example: self.agi, self.maxhp etc.)