• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

GetItemAttribute. Item not found. Help

kermaxpl

Pora na Nonsens Scripter
Joined
Aug 21, 2012
Messages
121
Reaction score
7
Location
Poland
Hey guys, again me :D
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
Then add this spell:
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
Everything will be ok, but I have this and i don't know why:
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:
Back
Top