ralke
(҂ ͠❛ ෴ ͡❛)ᕤ
- Joined
- Dec 17, 2011
- Messages
- 1,713
- Solutions
- 31
- Reaction score
- 965
- Location
- Santiago - Chile
- GitHub
- ralke23
- Twitch
- ralke23
Hi guys! I have an alternative critical system, and I wonder if someone can help me adding a little enhancement into it.
I don't understand it really well. So what I need is to first, know why it is only sending the effect and the CRITICAL.PERCENT calculation when player hit other players. I would like it to trigger if the player is hitting monsters too. As a second request, would be nice if it could only be triggered if the player damage is higher than 150 (for example), so it doesn't have a chance to send this critical if player hit is lower than 150. Just for clarifying, my WATERCREATURE effect is the critical effect of my server.
Thanks in advance!
Regards
LUA:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if (not attacker or not creature) then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if primaryType == COMBAT_HEALING then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if (attacker:isPlayer() and (attacker:getCriticalLevel() * 3) >= math.random (0, 1000)) then
primaryDamage = primaryDamage + math.ceil(primaryDamage * CRITICAL.PERCENT)
creature:getPosition():sendMagicEffect(CONST_ME_WATERCREATURE)
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
I don't understand it really well. So what I need is to first, know why it is only sending the effect and the CRITICAL.PERCENT calculation when player hit other players. I would like it to trigger if the player is hitting monsters too. As a second request, would be nice if it could only be triggered if the player damage is higher than 150 (for example), so it doesn't have a chance to send this critical if player hit is lower than 150. Just for clarifying, my WATERCREATURE effect is the critical effect of my server.
Thanks in advance!
Regards
