alejandro762
Well-Known Member
- Joined
- Sep 6, 2021
- Messages
- 227
- Reaction score
- 64
Hello,
on a NPC, i want to check each StorageID Value if they are completed or not, if not, player cannot complete the delivery, if all storages are 1, so the delivery it's completed and player get a reward,
I got a table like this:
I add on npc a message that can verify if player get this storage Value completed:
Where XXXXX, how we can call on table items.xxx.storageID ?
as item[msg] it works, but only for One item im stuck on how call each line storageID and check if any storage is done before the reward and if is already done.
on a NPC, i want to check each StorageID Value if they are completed or not, if not, player cannot complete the delivery, if all storages are 1, so the delivery it's completed and player get a reward,
I got a table like this:
Lua:
local itemsDelivery = {
['royal helmet'] = {cost = 0, items = {{2498, 1}}, storageID = 29127},
['golden helmet'] = {cost = 0, items = {{2471, 1}}, storageID = 29128},
['legion helmet'] = {cost = 0, items = {{2480, 1}}, storageID = 29129},
}
local reward= 22222
I add on npc a message that can verify if player get this storage Value completed:
Code:
elseif msgcontains(msg, "complete") then
if getStorageValue(cid, reward) ~= -1 then
npcHandler:say('You have done the delivery', cid)
elseif getStorageValue(cid, reward) ~= 0 and getStorageValue(cid, XXXXXX --- itemsDelivery.StorageID ?? ) ~= 1
npcHandler:say('You completed the delivery', cid)
doPlayerAddItem(2160, 1)
else
npcHandler:say('You don\'t completed the delivery', cid)
end
Where XXXXX, how we can call on table items.xxx.storageID ?
as item[msg] it works, but only for One item im stuck on how call each line storageID and check if any storage is done before the reward and if is already done.