• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

doublet quest help

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.
 
Code:
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
 
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
 
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

I think this is for when something is uniqueID 10027 it should give you the item, i have no idea tho.
 
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.
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.
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.
 
item.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.
Thanks for the explanation Limos :)
 
Doublet.Lua :

local config = {
storage = 9090 -- UNIQUE ID
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 1) then
doPlayerAddItem(cid, 2485, 1)
doPlayerSendTextMessage(cid, 22, "You have found a doublet.")
setPlayerStorageValue(cid, 9090, 1)
else
doPlayerSendTextMessage(cid, 22, "The loose board is empty.")
end
return true
end

In Actions.xml

<action uniqueid="9090" script="quests/rook/doublet.lua" />

and the script works for Othire 7.72/7.4

Kind regards.
 
Back
Top