I'm trying to put the PresentBox prize together with the Doll, but nothing happens, the other three chests work normally, but Bear's doesn't.Any solution ?
LUA:
local storage_id = 2000
local rewards = {
[2000] = {reward_id = 2494, reward_count = 1}, -- [chest uid] = {reward item id, reward item count},
[2001] = {reward_id = 2400, reward_count = 1},
[2002] = {reward_id = 2431, reward_count = 1},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = player:getStorageValue(storage_id)
if storage > 0 then
return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.")
end
local reward = rewards[item.uid]
local reward_type = reward and ItemType(reward.reward_id)
if reward_type then
if itemUid == 2003 then
player:addItem(1990, 1):addItem(2326, 1)
player:setStorageValue(storage_id, 1)
end
if player:addItem(reward.reward_id, reward.reward_count, false, 1, CONST_SLOT_WHEREEVER) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a " .. reward_type:getName():lower() .. ".")
player:setStorageValue(storage_id, 1)
else
local weight = reward_type:getWeight()
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found an item weighing ' .. weight / 100 .. ' oz it\'s too heavy or you do not have enough room.')
end
end
return true
end