Hello. I have a problem with this script.
It works on a human but doesn't work on monsters. I want it to work also on mosnters.
It works on a human but doesn't work on monsters. I want it to work also on mosnters.
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local player = Player(attacker)
if not player then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
local multiplier = 100
if (attacker:getSkillLevel(axe)) >= math.random (1, 100) and isPlayer(attacker) then
if isInArray({ORIGIN_MELEE, ORIGIN_RANGED}, origin) and primaryType ~= COMBAT_HEALING then
primaryDamage = math.ceil(primaryDamage*(multiplier))
attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT)
end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end