is possible do a random function in lua script?
LUA:
make a script read this part
if not creature:isPlayer() then
doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, 0, 0)
position:sendMagicEffect(CONST_ME_BLOCKHIT)
or this part 50/50 % chance
if not creature:isPlayer() then
doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -1, -15)
position:sendMagicEffect(CONST_ME_POFF)
or exist other way to do it? i need that script check if damage 0 do position:sendMagicEffect(CONST_ME_BLOCKHIT) if not is damage 0, execute this
if not creature:isPlayer() then
doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -1, -15)
position:sendMagicEffect(CONST_ME_POFF)