now it just doesn't give it to you hahaha
local config = {
needStorageKey = 77756, -- storage key required to open the chest?
needStorageValue = 1, -- storage value required to open the chest?
giveStorageKey = 50033, -- storage key given after chest opened?
giveStorageValue = 1, -- storage value given after chest opened?
itemId = 36266, -- give this item
itemCount = 1 -- give this amount
}
local a = Action()
function a.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local p = player
if not p then
return false
end
local reward = ItemType(config.itemId)
if player:getStorageValue(config.giveStorageKey) ~= config.giveStorageValue then
if...
with this storage you can open the chest "50039, 1"I don't think I understand what you are saying.
The following line is only going to allow you if you have 4+
if you want it to allow when you have 3 then changeLUA:if player:getStorageValue(config.STORAGE_PERMISSION) <= 3 then
toLUA:<= 3
LUA:< 3
if msgcontains(msg, "mission") and player:getStorageValue(Storage.Kilmaresh.Twelve.Boss) == 3 then
if player:getStorageValue(Storage.Kilmaresh.Twelve.Boss) == 3 then
npcHandler:say({"Could you help me with some more work?"}, cid)-- needs review, this is not the speech of the global
npcHandler.topic[cid] = 5
npcHandler.topic[cid] = 5
end
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 5 and player:getStorageValue(Storage.Kilmaresh.Twelve.Boss) == 3 then
if player:getStorageValue(Storage.Kilmaresh.Twelve.Boss) == 3 then
npcHandler:say({"Kill 300 members of the Fafnar cult, help me find Ivory Lyre and help me find an animal to stone."}, cid)-- needs review, this is not the speech of the global
player:setStorageValue(Storage.Kilmaresh.Twelve.Boss, 4)
player:setStorageValue(Storage.Kilmaresh.Thirteen.Fafnar, 1)
player:setStorageValue(Storage.Kilmaresh.Thirteen.Lyre, 1)
player:setStorageValue(Storage.Kilmaresh.Thirteen.Presente, 1)
npcHandler.topic[cid] = 6
else
npcHandler:say({"Sorry."}, cid)
npcHandler.topic[cid] = 0
end
end
if msgcontains(msg, "report") and player:getStorageValue(Storage.Kilmaresh.Thirteen.Fafnar) == 300 then
if player:getStorageValue(Storage.Kilmaresh.Thirteen.Fafnar) == 300 then
npcHandler:say({"Have you finished killing the 300 members of Fafnar's cult?"}, cid)-- needs review, this is not the speech of the global
npcHandler.topic[cid] = 7
end
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 7 and player:getStorageValue(Storage.Kilmaresh.Thirteen.Fafnar) == 300 then
if player:getStorageValue(Storage.Kilmaresh.Thirteen.Fafnar) == 300 then
npcHandler:say({"Thanks. You killed the 300 members of the Fafnar cult."}, cid)-- needs review, this is not the speech of the global
player:setStorageValue(Storage.Kilmaresh.Thirteen.Fafnar, 301)
npcHandler.topic[cid] = 8
else
npcHandler:say({"Sorry."}, cid)
npcHandler.topic[cid] = 0
end
end
if msgcontains(msg, "report") and player:getStorageValue(Storage.Kilmaresh.Thirteen.Lyre) == 3 then
if player:getStorageValue(Storage.Kilmaresh.Thirteen.Lyre) == 3 then
npcHandler:say({"Did you manage to find Lyre?"}, cid)-- needs review, this is not the speech of the global
npcHandler.topic[cid] = 9
end
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 9 and player:getStorageValue(Storage.Kilmaresh.Thirteen.Lyre) == 3 then
if player:getStorageValue(Storage.Kilmaresh.Thirteen.Lyre) == 3 and player:getItemById(36282, 1) then
player:removeItem(36282, 1)
npcHandler:say({"Thanks. I was looking for Lyre for a long time."}, cid)-- needs review, this is not the speech of the global
player:setStorageValue(Storage.Kilmaresh.Thirteen.Lyre, 4)
else
npcHandler:say({"Sorry."}, cid)
npcHandler.topic[cid] = 0
end
end
STORAGE_CHEST_OPENED
and STORAGE_PERMISSION
seem to be using the same key 50039
, I removed one of them.local config = {
STORAGE_CHEST_OPENED = 50039,
itemId = 36282,
itemCount = 1
}
local a = Action()
function a.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local reward = ItemType(config.itemId)
if player:getStorageValue(config.STORAGE_CHEST_OPENED) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You haven't completed task ABC.")
return true
end
if player:getStorageValue(config.STORAGE_CHEST_OPENED) >= 3 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The chest is emtpy.")
return true
end
if player:getCapacity() < reward:getWeight(config.itemCount) then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You need at least "..reward:getWeight(config.itemCount).." capacity to open this chest.")
return true
end
player:addItem(config.itemId, config.itemCount)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You find "..reward:getArticle().." "..reward:getName().." at the bottom of the blood-filled basin.")
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
player:setStorageValue(config.STORAGE_CHEST_OPENED, 3)
return true
end
a:aid(36292)
a:register()