nanduzenho
Member
Good morning, i have this critical damage script and i would like the word "Critical!" appear as a one hit number. I don't know if I explained it right, the word "Critical!" should appear with the same animation as a normal hit. Can anyone help me with this?
Lua:
local config = {
magic_effect = 15, -- magic effect you want to send when critical hit lands
damage_multiplier = 1.8 -- default damage * 10 = critical damage
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if attacker == nil then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if not attacker:isPlayer() then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
local skill = attacker:getEffectiveSkillLevel(SKILL_SWORD)
local skill = attacker:getEffectiveSkillLevel(SKILL_AXE)
local skill = attacker:getEffectiveSkillLevel(SKILL_CLUB)
local skill = attacker:getEffectiveSkillLevel(SKILL_FIST)
local skill = attacker:getEffectiveSkillLevel(SKILL_DIST)
local chance = (skill * 0.5)
if math.random(100) <= chance then
attacker:getPosition():sendMagicEffect(config.magic_effect)
attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
return primaryDamage * config.damage_multiplier, primaryType, secondaryDamage, secondaryType
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end