DukeeH
Active Member
- Joined
- Dec 6, 2010
- Messages
- 550
- Solutions
- 3
- Reaction score
- 39
Hello, I'd like some help to fix this script, it is a Critical System, you have X% chance to deal more damage on attack/spells, everything.
The problem is, I have items with high absorbPercentAll stats, so if I put the critical to deal *2 damage (double), and I deal 100 damage on someone with 0 armor, it will deal 200 when I crit. But now, the players have 20~40% protection all, so (100-40=60) it does 60 damage normally, when it crit it should deal 120 (double) but it does an amount lower than the normal damage, it's weird.
Is there some way to fix this or make this system through sources or something?
The same happens on the second script, it's a dodge system, if you dodge an attack, you should get half the damage, but it does alot less than this because it counts your defense twice (I think) so I have to put a higher amount to try and balance, but it's not right.
Thanks!
The problem is, I have items with high absorbPercentAll stats, so if I put the critical to deal *2 damage (double), and I deal 100 damage on someone with 0 armor, it will deal 200 when I crit. But now, the players have 20~40% protection all, so (100-40=60) it does 60 damage normally, when it crit it should deal 120 (double) but it does an amount lower than the normal damage, it's weird.
Is there some way to fix this or make this system through sources or something?
The same happens on the second script, it's a dodge system, if you dodge an attack, you should get half the damage, but it does alot less than this because it counts your defense twice (I think) so I have to put a higher amount to try and balance, but it's not right.
Thanks!
Code:
--[[Critical System
------------------------- By Night Wolf]]
local lvlcrit = 48913
local multiplier = 2.0
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then
dano = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
return false
end
end
return true
end
Code:
local lvldodge = 48902
local percent = 0.5
function onStatsChange(cid, attacker, type, combat, value)
if type == STATSCHANGE_HEALTHLOSS and isCreature(attacker) then
if (getPlayerStorageValue(cid, lvldodge)*3) >= math.random (0,1000) then
value = math.ceil(value*(percent))
doTargetCombatHealth(attacker, cid, combat, -value, -value, 255)
doSendAnimatedText(getCreaturePos(cid), "DODGE", 6)
return false
end
end
return true
end