• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Action ID key in Quest chest

Amelith

New Member
Joined
Oct 26, 2012
Messages
5
Reaction score
1
Hello. I have problem with creating Quest chest.
How can I make that quest chest will give player a key with action ID = 1300 (for example).
I'm using TFS 1.0.
 
Code:
local addItem = doPlayerAddItem(cid, _KEY_ID_, 1)
local newItem = Item(addItem)
if newItem ~= nil then
    newItem:setActionId(_YOUR_ACTION_ID_)
end

~Not tested
 
You can use
Code:
doSetItemActionId(uid,actionid)

I suspect you dont know how to use it and ill make it easy for you.

Code:
local config = {
          keyid = 2088, --itemid of the key
          aid = 1000, --which actionid should the key have
          storage = 5000
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if (getPlayerStorageValue(cid, config.storage) < 1) then
            setPlayerStorageValue(cid, config.storage, 1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"You have found a key.")
            local key = doPlayerAddItem(cid, config.keyid, 1)
            doSetItemActionId(key, ""..config.aid.."")
    else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,"This chest is empty.")
    end
    return true
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    local pItem = player:addItem(itemId, count/subtype[default = 1])
    if pItem then
        pItem:setActionId(actionId)
    end
end
 
Back
Top