Hey guys, again me
I want to do spell which will do aoe every 3 player's autoattacks. I add this in actions.
Then add this spell:
Everything will be ok, but I have this and i don't know why:
-- Edit
This doesn't work too:
--Edit2
ok, my mistake, wrong "if",
But now is is something wrong with onUse script. It don't change storage value
--Edit3
onUse changed to onUseWeapon and it works
I want to do spell which will do aoe every 3 player's autoattacks. I add this in actions.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerVocation(cid) == 4 then
if getCreatureStorage(cid, 99996) ~= 3 then
doCreatureSetStorage(cid, 99996, getCreatureStorage(cid, 99996) + 1)
else
doCreatureSetStorage(cid, 99996, 0)
end
end
return true
end
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(param)
local min = -(param.damage * 0.61)
local max = -(param.damage * 0.75)
return min, max
end
function thirdAA(param)
if (getCreatureStorage(param.cid, 99996) == 3) then
doCombat(param.cid, param.combat, param.var)
end
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local weapon = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
local weapon2 = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
local param = {}
param.cid = cid
param.var = var
param.combat = combat
if (getItemAttribute(weapon.uid, 'attack') == 0) then
param.damage = getItemAttribute(weapon2.uid, 'attack')
else
param.damage = getItemAttribute(weapon.uid, 'attack')
end
for i = 1, 40 do
addEvent(thirdAA, i * 500, param)
end
return true
end
Code:
[14:26:03.437] [Error - Spell Interface]
[14:26:03.437] data/spells/scripts/buffy/ThirdAA.lua:onCastSpell
[14:26:03.437] Description:
[14:26:03.437] (luaGetItemAttribute) Item not found
-- Edit
This doesn't work too:
Lua:
getItemAttribute(getPlayerWeapon(cid, true).uid, "attack")
--Edit2
ok, my mistake, wrong "if",
But now is is something wrong with onUse script. It don't change storage value
--Edit3
onUse changed to onUseWeapon and it works
Last edited: