Ir para conteúdo
  • 0

[Resolvido] Dar items ao NPC


SkyDarkyes

Pergunta

Posts Recomendados

  • 0

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local item_gain = 2424 -- reward id
    local item_need = 1199 -- need item id
    local item_qnt = 5222 -- item_need amount

    if(msgcontains(msg, 'mission') or msgcontains(msg, 'change')) then
        selfSay('Mission {Securiry Seal Quest} mission involves the safety of the village, I need you to retrieve the seals that akatsuki stole the village I will reciprocate with a Madara Legs...', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'securiry seal quest') and talkState[talkUser] == 1) then
        
    if getPlayerStorageValue(cid, 20069) >= 1 then
        selfSay('Please do not insist, you have done this quest recently.', cid)
        talkState[talkUser] = 0
        return true
    end
    
    selfSay('These stamps 500 security seal you will find in Akatsuki Bandits, go get it, ok?', cid)
    talkState[talkUser] = 2
    return true
end
        
    if(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
                
        if getPlayerItemCount(cid, item_need) < 500 then
            selfSay('You are trying to trick me young man? You do not have the '..getItemNameById(item_need)..'.', cid)
            talkState[talkUser] = 0
            return true
        end
        
        selfSay('Congratulations young warrior, you managed to finish this mission, go in peace.', cid)
        talkState[talkUser] = 0
        setPlayerStorageValue(cid, 20069, 1)
        doPlayerAddItem(cid, item_gain, item_qnt)
        doPlayerRemoveItem(cid,  item_need, 500)
        return true
    end        
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

quando você for testa, teste com 500 do item 2155 <<< o item requerido pelo npc

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...