• 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!

Change item for itemUID

Bruce Leal

New Member
Joined
Nov 9, 2017
Messages
77
Reaction score
3
When npc give: doPlayerAddItem(cid, 2649, 1)
Player get a item, but... how to get with UNIQUE ID ! How can i insert UID here?

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}

function onCreatureAppear(cid)          npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)       npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                      npcHandler:onThink()                        end

function creatureSayCallback(cid, type, msg)
    if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
        npcHandler:say(getPlayerSex(cid) == 0 and "Well hello there lovely lady! How may I help you today?" or "Well hello sir, how may I help you today?", cid)
        Topic[cid] = 0
        npcHandler:addFocus(cid)
    elseif msgcontains(msg, "cape") and npcHandler:isFocused(cid) then
        npcHandler:say("I can give you a new {cape} in exchange for a dirty one.", cid)
        Topic[cid] = 1
    elseif Topic[cid] == 1 then
        if msgcontains(msg, "yes") then
            if doPlayerRemoveItem(cid, 2237, 1) then
                npcHandler:say("Here you are.", cid)
                doPlayerAddItem(cid, 2654, 1)
                                doPlayerAddItem(cid, 2649, 1)
                doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
                Topic[cid] = 0
            else
                npcHandler:say("You do not have a dirt cape to exchange.", cid)
                Topic[cid] = 0
            end
        elseif msgcontains(msg, "no") then
            npcHandler:say("Okay then.", cid)
            Topic[cid] = 0
        end
    elseif(not npcHandler:isFocused(cid)) then
        return false
    elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") and npcHander:isFocused(cid) then
        npcHandler:say("Good bye.", cid, TRUE)
        Topic[cid] = nil
        npcHandler:releaseFocus(cid)
    elseif msgcontains(msg, "job") then
        npcHandler:say("I can give you a new {cape} in exchange for a dirty one.", cid)
        Topic[cid] = 0
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
 
Xikini, this script I got here in the forum, in year of 2010, I use tfs 0.3 but I do not know if this script will work ..

I need something that ...
The player collects the item, and npc picks up the item and delivers some item with UniqueID to the player ...
 
idk how it works for you guys, but basically this is how I do it.
Code:
local coat = doPlayerAddItem(cid, 2651, 1)
doSetItemActionId(coat, 45147)
Can also try..
Code:
doItemSetAttribute(coat, "aid", 45147)
 
Back
Top