Will it be possible for a creature to hit you with critical damage, just like the players?
I am creating a script, but it works and there is no error in the log or crash.
I am creating a script, but it works and there is no error in the log or crash.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE, 10)
condition:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE, 50)
combat:addCondition(condition)
local area = createCombatArea(AREA_CIRCLE2X2)
combat:setArea(area)
combat:addCondition(condition)
local spell = Spell("instant")
function spell.onCastSpell(creature, var)
if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT) then
creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
end
return combat:execute(creature, var)
end