OldschoolTibia
Member
- Joined
- Sep 4, 2015
- Messages
- 22
- Reaction score
- 5
I have double quest script and when I put it in my server it gives no errors when I click on it aswell. But I get no item.
function onUse(cid, item, frompos, item2, topos)
if item.uid == 10027 then
queststatus = getPlayerStorageValue(cid,10027)
if queststatus == -1 and getPlayerAccess(cid) == 0 then
doPlayerSendTextMessage(cid,22,"You have found a doublet.")
item_uid = doPlayerAddItem(cid,2485,1)
setPlayerStorageValue(cid,10027,1)
else
doPlayerSendTextMessage(cid,22,"The barrel is empty.")
end
else
return 0
end
return 1
end
-- this might be overkill but its easier to test if you have a table to control everything :p
local c = {
idToCheckFor = 10027,
itemToGive = 2485,
amount = 1,
minAccess = 0,
returnFalse = 0, -- this might need to be set to false
returnTrue = 1 -- this might need to be set to true
}
function onUse(cid, item, frompos, item2, topos)
if item.actionid == c.idToCheckFor then
queststatus = getPlayerStorageValue(cid, c.idToCheckFor)
if queststatus == -1 and getPlayerAccess(cid) == c.minAccess then
doPlayerSendTextMessage(cid, 22, "You have found a doublet.")
doPlayerAddItem(cid, itemToGive, c.amount)
setPlayerStorageValue(cid, idToCheckFor, c.amount)
else
doPlayerSendTextMessage(cid, 22, "The barrel is empty.")
end
else
return c.returnFalse
end
return c.returnTrue
end
What does the number 10027 represent?
If it is a common item like a chest or tree or something then this will effect all items with the same item.uid.
You should be checking for the actionid, this is normally on an item / tile that is assigned a script for a specific purpose.
Code:-- this might be overkill but its easier to test if you have a table to control everything :p local c = { idToCheckFor = 10027, itemToGive = 2485, amount = 1, minAccess = 0, returnFalse = 0, -- this might need to be set to false returnTrue = 1 -- this might need to be set to true } function onUse(cid, item, frompos, item2, topos) if item.actionid == c.idToCheckFor then queststatus = getPlayerStorageValue(cid, c.idToCheckFor) if queststatus == -1 and getPlayerAccess(cid) == c.minAccess then doPlayerSendTextMessage(cid, 22, "You have found a doublet.") doPlayerAddItem(cid, itemToGive, c.amount) setPlayerStorageValue(cid, idToCheckFor, c.amount) else doPlayerSendTextMessage(cid, 22, "The barrel is empty.") end else return c.returnFalse end return c.returnTrue end
if item.uid == 10027 then
item.uid is the uniqueid of the item, not the itemid. An uniqueid is supposed to stay unique and therefore should only be used once, so there won't be more items with the same uniqueid since that will give errors.What does the number 10027 represent?
If it is a common item like a chest or tree or something then this will effect all items with the same item.uid.
Thanks for the explanation Limositem.uid is the uniqueid of the item, not the itemid. An uniqueid is supposed to stay uniqueid and therefore should only be used once, so there won't be more items with the same uniqueid since that will give errors.
Main difference between action and uniqueids: https://otland.net/threads/action-unique-ids.236075/#post-2279327
People usually use uniqueids for quest items and actionids if the same script should work for more items, like with doors.
If nothing happens, so also no textmessage or anything, the script is probable not added correct in actions or in the map.
I want it too please. Thanks!@OldschoolTibia
Pmed you the Lua code and it will give you a doublet from the wooden floor. If other people asks for it i will share it
Just share it.@OldschoolTibia
Pmed you the Lua code and it will give you a doublet from the wooden floor. If other people asks for it i will share it