Hello, I created this quest so that when I pick up 10 items from the ground, I can exchange these 10 items for another one and remove the 10, but it only works when I log in to TP, it doesn't work directly when I pick up the 10 that I did wrong?
quest metins_quest begin
state start begin
when login with pc.level >= 1 begin
local item_count = pc.count_item(501009)
local exchange_count = math.floor(item_count / 10)
if exchange_count > 0 then
pc.remove_item(501009, exchange_count * 10)
pc.give_item2(501004, exchange_count)
end
end
when 501009.use or 501009.get begin
local item_count = pc.count_item(501009)
local exchange_count = math.floor(item_count / 10)
if exchange_count > 0 then
pc.remove_item(501009, exchange_count * 10)
pc.give_item2(501004, exchange_count)
end
end
end
end