Hello, I'm trying to improve the well known script of Dodge.
It's pretty simple. Formerly, this script allows you to "avoid" part of the damage. It works as a new skill.
It reads x storage but that doesn't matter because the scripts works.
You have to skill up, so:
Storage X: 1
Storage X: 2 (the value of the storage is the skill level)
What I want to do is to increase the damage that you do if you have Dodge at level 100:
Please help me to fix my script.
It's pretty simple. Formerly, this script allows you to "avoid" part of the damage. It works as a new skill.
It reads x storage but that doesn't matter because the scripts works.
You have to skill up, so:
Storage X: 1
Storage X: 2 (the value of the storage is the skill level)
What I want to do is to increase the damage that you do if you have Dodge at level 100:
Please help me to fix my script.
PHP:
local lvldodge = 48902
local percent = 0.5
local chance_percent = 30
local extra_damage_percent = 250
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)
doCreatureSay(cid, "DODGE", TALKTYPE_ORANGE_1)
if type ~= STATSCHANGE_HEALTHLOSS then
if getPlayerStorageValue(cid, lvldodge) == 100 and getPlayerStorageValue(cid, 71257) < 1 then
if math.random(100) <= chance_percent then
local dmg = value * (extra_damage_percent / 100)
setPlayerStorageValue(cid, 71257, 1)
doTargetCombatHealth(attacker, cid, type, -dmg, -dmg, 255)
setPlayerStorageValue(cid, 71257, -1)
doCreatureSay(cid, "CRITICAL", TALKTYPE_ORANGE_1)
return false
end
end
end
end
end
return true
end