Exiled Pain
Fervid Learner
- Joined
- Jan 8, 2008
- Messages
- 552
- Reaction score
- 4
Sup everyone.
I'm trying to use surprise bags but I'm getting some errors.
I'm using TFS .3preAlpha latest REV but I'm getting this error:
[19/06/2008 11:08:44] data/actions/scripts/other/surprisebag.lua:18: attempt to index global 'randomPresent' (a nil value)
[19/06/2008 11:08:44] stack traceback:
[19/06/2008 11:08:44] data/actions/scripts/other/surprisebag.lua:18: in function <data/actions/scripts/other/surprisebag.lua:1>
In the surpricebag.lua I got:
Thanks in advance
I'm trying to use surprise bags but I'm getting some errors.
I'm using TFS .3preAlpha latest REV but I'm getting this error:
[19/06/2008 11:08:44] data/actions/scripts/other/surprisebag.lua:18: attempt to index global 'randomPresent' (a nil value)
[19/06/2008 11:08:44] stack traceback:
[19/06/2008 11:08:44] data/actions/scripts/other/surprisebag.lua:18: in function <data/actions/scripts/other/surprisebag.lua:1>
In the surpricebag.lua I got:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = 1
if item.itemid == 6570 then
local randomPresent = {2687, 6394, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114}
local randomChance = math.random(1, 11)
if randomChance == 1 then
count = 10
elseif randomChance == 2 then
count = 3
end
elseif item.itemid == 6571 then
local randomPresent = {2152, 2152, 2152, 2153, 5944, 2112, 6568, 6566, 2492, 2520, 2195, 2114, 2114, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574}
local randomChance = math.random(1, 22)
if randomChance > 0 and randomChance < 4 then
count = 10
end
end
doPlayerAddItem(cid, randomPresent[randomChance], count)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
return TRUE
end
Thanks in advance
Last edited: