I want to make a sword that has the chance that, instead of making the normal attack, make an area attack, like an "exori".
So I made the script, and put as area, the same as the spell (AREA_SQUARE1X1), but it gives an error (LuaScriptInterface :: luaCombatSetArea (). Area not found), so I tried to do it using the Burst Arrow scripts as a base, but, when it attacks, the "exori" area is centered on the target, and not the attacker.. Can someone help me? I'll put the script I made below
Sorry for my English, this was translated by google.
So I made the script, and put as area, the same as the spell (AREA_SQUARE1X1), but it gives an error (LuaScriptInterface :: luaCombatSetArea (). Area not found), so I tried to do it using the Burst Arrow scripts as a base, but, when it attacks, the "exori" area is centered on the target, and not the attacker.. Can someone help me? I'll put the script I made below
Lua:
local combat = createCombatObject()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)
local combat2 = createCombatObject()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
local area = createCombatArea(AREA_SQUARE1X1)
combat2:setArea(area)
function onGetFormulaValues(player, skill, attack, factor)
local skillTotal = skill * attack
local levelTotal = player:getLevel() / 5
return -(((skillTotal * 0.07) + 7) + (levelTotal)), -(((skillTotal * 0.09) + 11) + (levelTotal))
end
setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var, player, creature)
local target = getCreatureTarget(cid)
local chance = math.random(2)
if chance <= 2 then
doCombat(cid, combat2, var)
else
doCombat(cid, combat, var)
end
return true
end