Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Ola bom dia, estou com um pequeno problema neste script NPC LUGRI. Wizard Addon

ele esta desorganizado, esta removendo os itens na ordem errada e remove apenas dois itens e já entrega o addon. Se alguém puder arrumá-lo para mim.

 



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
 
    if(msgcontains(msg, "outfit")) then
        if(getPlayerStorageValue(cid, 1003) < 1) then
            npcHandler:say("This skull shows that you are a true follower of Zathroth and the glorious gods of darkness. Are you willing to prove your loyalty?", cid)
            talkState[talkUser] = 1
        end
    elseif(msgcontains(msg, "medusa shield")) then
        if(getPlayerStorageValue(cid, 1003) == 1) then
            npcHandler:say("Is it your true wish to sacrifice a medusa shield to Zathroth?", cid)
            talkState[talkUser] = 3
        end
    elseif(msgcontains(msg, "dragon scale mail")) then
        if(getPlayerStorageValue(cid, 1003) == 2) then
            npcHandler:say("Is it your true wish to sacrifice a dragon scale mail to Zathroth?", cid)
            talkState[talkUser] = 4
        end  
    elseif(msgcontains(msg, "crown legs")) then
        if(getPlayerStorageValue(cid, 1003) == 3) then
            npcHandler:say("Is it your true wish to sacrifice crown legs to Zathroth?", cid)
            talkState[talkUser] = 5
        end  
    elseif(msgcontains(msg, "ring of the sky")) then
        if(getPlayerStorageValue(cid, 1003) == 4) then
            npcHandler:say("Is it your true wish to sacrifice a ring of the sky to Zathroth?", cid)
            talkState[talkUser] = 6
        end
    elseif(msgcontains(msg, "yes")) then
        if(talkState[talkUser] == 1) then  
            npcHandler:say("It will be a hard task which requires many sacrifices. Do you still want to proceed?", cid)
            talkState[talkUser] = 2
        elseif(talkState[talkUser] == 2) then  
            npcHandler:say("Good decision, <name>. Your first sacrifice will be a medusa shield. Bring it to me and do give it happily.", cid)
            setPlayerStorageValue(cid, 1003, 1)
            talkState[talkUser] = 0
            
        elseif(talkState[talkUser] == 2) then
            if(getPlayerItemCount(cid, 2536) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The second sacrifice I require from you is a dragon scale mail. Bring it to me and do give it happily.", cid)
                doPlayerRemoveItem(cid, 2536, 1)
                setPlayerStorageValue(cid, 1003, 2)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 3) then
            if(getPlayerItemCount(cid, 2492) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The third sacrifice I require from you are crown legs. Bring them to me and do give them happily.", cid)
                doPlayerRemoveItem(cid, 2492, 1)
                setPlayerStorageValue(cid, 1003, 3)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 4) then
            if(getPlayerItemCount(cid, 2488) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The last sacrifice I require from you is a ring of the sky. Bring it to me and do give it happily.", cid)
                doPlayerRemoveItem(cid, 2488, 1)
                setPlayerStorageValue(cid, 1003, 4)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 5) then
            if(getPlayerItemCount(cid, 2123) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. You have proven that you are a true follower of Zathroth and do not hesitate to sacrifice worldly goods. Thus, I will reward you with this headgear. ", cid)
                doPlayerRemoveItem(cid, 2123, 1)
                setPlayerStorageValue(cid, 1003, 5)
                doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and 149 or 145, 1)
                talkState[talkUser] = 0  
            end
        end
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Postado

ue é só vc olhar o script e ir modificando... isso é preguiça? kkk

doPlayerRemoveItem(cid, 2123, 1) < essas são as linhas de comando q remove os itens.. é só vc troca como vc quer

Scriptszinhos:

 

Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.

Postado
  • Autor

não amigo não e assim já tentei, ele remove o primeiro e depois não responde mais quando eu mudo apenas a id. tem alguma coisa a ver com Talkstate e Talkuse.

Podem mover já resolvi. quebrei a cabeça mais consegui kkkk

 

Código certo.

 



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
 
    if(msgcontains(msg, "outfit")) then
        if(getPlayerStorageValue(cid, 1003) < 1) then
            npcHandler:say("This skull shows that you are a true follower of Zathroth and the glorious gods of darkness. Are you willing to prove your loyalty?", cid)
            talkState[talkUser] = 1
        end
    elseif(msgcontains(msg, "medusa shield")) then
        if(getPlayerStorageValue(cid, 1003) == 1) then
            npcHandler:say("Is it your true wish to sacrifice a medusa shield to Zathroth?", cid)
            talkState[talkUser] = 3
        end
    elseif(msgcontains(msg, "dragon scale mail")) then
        if(getPlayerStorageValue(cid, 1003) == 2) then
            npcHandler:say("Is it your true wish to sacrifice a dragon scale mail to Zathroth?", cid)
            talkState[talkUser] = 4
        end  
    elseif(msgcontains(msg, "crown legs")) then
        if(getPlayerStorageValue(cid, 1003) == 3) then
            npcHandler:say("Is it your true wish to sacrifice crown legs to Zathroth?", cid)
            talkState[talkUser] = 5
        end  
    elseif(msgcontains(msg, "ring of the sky")) then
        if(getPlayerStorageValue(cid, 1003) == 4) then
            npcHandler:say("Is it your true wish to sacrifice a ring of the sky to Zathroth?", cid)
            talkState[talkUser] = 6
        end
    elseif(msgcontains(msg, "yes")) then
        if(talkState[talkUser] == 1) then  
            npcHandler:say("It will be a hard task which requires many sacrifices. Do you still want to proceed?", cid)
            talkState[talkUser] = 2
        elseif(talkState[talkUser] == 2) then  
            npcHandler:say("Good decision, Your first sacrifice will be a {medusa shield}. Bring it to me and do give it happily.", cid)
            setPlayerStorageValue(cid, 1003, 1)
            talkState[talkUser] = 0
            
        elseif(talkState[talkUser] == 3) then
            if(getPlayerItemCount(cid, 2536) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The second sacrifice I require from you is a {dragon scale mail}. Bring it to me and do give it happily.", cid)
                doPlayerRemoveItem(cid, 2536, 1)
                setPlayerStorageValue(cid, 1003, 2)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 4) then
            if(getPlayerItemCount(cid, 2492) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The third sacrifice I require from you are {crown legs}. Bring them to me and do give them happily.", cid)
                doPlayerRemoveItem(cid, 2492, 1)
                setPlayerStorageValue(cid, 1003, 3)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 5) then
            if(getPlayerItemCount(cid, 2488) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. The last sacrifice I require from you is a {ring of the sky}. Bring it to me and do give it happily.", cid)
                doPlayerRemoveItem(cid, 2488, 1)
                setPlayerStorageValue(cid, 1003, 4)
                talkState[talkUser] = 0  
            end
        elseif(talkState[talkUser] == 6) then
            if(getPlayerItemCount(cid, 2123) >= 1) then
                npcHandler:say("Good. I accept your sacrifice. You have proven that you are a true follower of Zathroth and do not hesitate to sacrifice worldly goods. Thus, I will reward you with this headgear. ", cid)
                doPlayerRemoveItem(cid, 2123, 1)
                setPlayerStorageValue(cid, 1003, 5)
                doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and 149 or 145, 2)
                doSendMagicEffect(getCreaturePosition(cid), 13)
                talkState[talkUser] = 0  
            end
        end
    end
    return true
end

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

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo