hi guys, i have a problem in a Critical HIT system on my server. TFS 1.2
I was testing it in-game , when i realized that the character was not taking hit monsters , not losing life, only mana (with utamovita ) .
I removed the line of Creaturescripts.xml and returned to normal functioning .
<event type="healthchange" name="CriticalSystem" script="critical.lua"/>
Script:
I do not know if the problem is that script or maybe it's something else, someone help me ?
I was testing it in-game , when i realized that the character was not taking hit monsters , not losing life, only mana (with utamovita ) .
I removed the line of Creaturescripts.xml and returned to normal functioning .
<event type="healthchange" name="CriticalSystem" script="critical.lua"/>
Script:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not isPlayer(attacker) then return false end
if (attacker:getCriticalLevel() * 3) >= math.random (0, 1000) then
if isInArray({ORIGIN_MELEE, ORIGIN_RANGED, ORIGIN_SPELL}, origin) and primaryType ~= COMBAT_HEALING then
primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if not isPlayer(attacker) then return false end
if (attacker:getCriticalLevel() * 3) >= math.random (0, 1000) then
if isInArray({ORIGIN_MELEE, ORIGIN_RANGED, ORIGIN_SPELL}, origin) and primaryType ~= COMBAT_HEALING then
primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
I do not know if the problem is that script or maybe it's something else, someone help me ?