Phemus
Member
- Joined
- Jun 16, 2012
- Messages
- 150
- Solutions
- 2
- Reaction score
- 13
Hello! I have a script error.
What it is supposed to do is that when somebody eats it, the player changes outfit randomly. In the console, it tells me this:
Can somebody help me?
Thanks
LUA:
local outfits = {205,15,25,15,110,125,106,107,18}
local FOODS =
{
[6394] = {1, "Transformation!"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local food = FOODS[item.itemid]
if(not food) then
return false
end
if((getPlayerFood(cid) + food[1]) >= 400) then
doPlayerSendCancel(cid, "You are full.")
return true
end
doPlayerFeed(cid, food[1] * 4)
doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1)
doSetCreatureOutfit(cid, {lookType = outfits[math.random(#outfits)]})
doSendMagicEffect(getCreaturePos(cid), 17)
doRemoveItem(item.uid, 1)
return true
end
What it is supposed to do is that when somebody eats it, the player changes outfit randomly. In the console, it tells me this:
Code:
[Error - Action Interface]
[16/08/2013 20:58:33] data/actions/scripts/by phemus/cream cake.lua:onUse
[16/08/2013 20:58:33] Description:
[16/08/2013 20:58:33] attempt to index a number value
[16/08/2013 20:58:33] stack traceback:
[16/08/2013 20:58:33] [C]: in function 'doSetCreatureOutfit'
[16/08/2013 20:58:33] data/actions/scripts/by phemus/cream cake.lua:21: in function <data/actions/scripts/by phemus/cream cake.lua:8>
Can somebody help me?
Thanks
Last edited: