• 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!

Lua Setting item attribute by lua

marcuz90

New Member
Joined
Apr 19, 2011
Messages
48
Reaction score
0
Hi I've been trying all day to add attribute to monster loot, but I can't fix it -.- it keeps saying: "doItemSetAttribute Item not found".

I've tried this code (with registered addLoot in login.lua, and creaturescripts.xml, and event tag in rotworm.xml):
Code:
function onDeath(cid, corpse, deathList)
	item = doAddContainerItem(corpse, 2180, 1) // also tried corpse.uid
	doItemSetAttribute(item, "description", "Hello")
	return true
end

And I've tried this code (with registered kill.lua in login.lua, creaturescripts.xml):
Code:
//this code should add actionid 15321 to corpse, so corpse gives random rare item.
function event(x)
	posit = x.posi
	item = getThingFromPos({x = posit.x, y = posit.y, z = posit.z, stackpos = 255})
	doItemSetAttribute(item, "aid", 15321)
end
function onKill(cid, target)
posi = getCreaturePosition(target)
local x = {target = target, posi = posi}
addEvent(event, 0, x)
return TRUE
end

Grateful for help !!
 
I've tried stackpos 1 2 and 255 and I get error:
Code:
[23/04/2011 13:11:45] [Error - CreatureScript Interface] 
[23/04/2011 13:11:45] In a timer event called from: 
[23/04/2011 13:11:45] data/creaturescripts/scripts/kill.lua:onKill
[23/04/2011 13:11:45] Description: 
[23/04/2011 13:11:45] (luaDoItemSetAttribute) Item not found
 
Back
Top