Ir para conteúdo

Featured Replies

Postado

olá, eu precisava que o npc ao saber que o player tem o storage ele fale ao jogador que ele ja possui o outfit, evitando q a pessoa faça mais de 1x


 

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

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 outfit(cid, message, keywords, parameters, node)  
   if(not npcHandler:isFocused(cid)) then  
       return false
   end  
       if getPlayerItemCount(cid,5922) >= 50 and getPlayerItemCount(cid,2492) == 1  and getPlayerItemCount(cid,2488) == 1 and getPlayerItemCount(cid,2536) == 1 and getPlayerItemCount(cid,2123) == 1 then  
        doPlayerRemoveItem(cid,5922,50)  
        doPlayerRemoveItem(cid,2492,1)  
        doPlayerRemoveItem(cid,2488,1)  
        doPlayerRemoveItem(cid,2536,1)  
        doPlayerRemoveItem(cid,2123,1) 
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
        npcHandler:say('Get your outfit!', cid)  
        setPlayerStorageValue(cid, 65535, 1)  
       else  
           npcHandler:say('Sorry, you dont have itens!', cid)  
  end     
end


local node1 = keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need the items, {50 holy orchids, ring of the sky, crown legs, dragon scale mail and medusa shield}. Do you have?.'})  
   node1:addChildKeyword({'yes'}, outfit, {npcHandler = npcHandler, onlyFocus = true, reset = true})  
   node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Stop being rude!!!', reset = true})  

npcHandler:addModule(FocusModule:new())

Resolvido por Dwarfer

Ir para solução
  • Respostas 5
  • Visualizações 845
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatu

  • verdade, acabei esquecendo de copiar as linhas de remover. Já editei lá.

  • @bpm91 no caso do script acima, sim!

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

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  

local items_needed = {{5922,50},{2492,1},{2488,1},{2536,1},{2123,1}}
local outfit_storage = 65535

function outfit(cid, message, keywords, parameters, node)  
    if(not npcHandler:isFocused(cid)) then  
        return false
    end  
    if getPlayerStorageValue(cid, outfit_storage) ~= -1 then
        npcHandler:say('You have already received this outfit.', cid)
    else
        local total_count, check = #items_needed, true
        for i = 1, total_count do
            local itemId, itemCount = items_needed[i][1], items_needed[i][2]
            if getPlayerItemCount(cid, itemId) < itemCount then
                check = false
                break
            end
        end
        if not check then
            npcHandler:say('You do not have all the items I need to make this outfit.', cid)
        else
      		for i = 1, total_count do
        		local itemId, itemCount = items_needed[i][1], items_needed[i][2]
        		doPlayerRemoveItem(cid, itemId, itemCount)
        	end
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
            setPlayerStorageValue(cid, outfit_storage, 1)  
        end
    end
end


local node1 = keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need the items, {50 holy orchids, ring of the sky, crown legs, dragon scale mail and medusa shield}. Do you have?.'})  
node1:addChildKeyword({'yes'}, outfit, {npcHandler = npcHandler, onlyFocus = true, reset = true})  
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Stop being rude!!!', reset = true})  

npcHandler:addModule(FocusModule:new()) 

 

Contato:

 

Postado
  • Autor

@Dwarfer  moço tu tem um fã <3 vlw manim, porém nao está puxando os itens xD npc ta dando d graça hehe

@Dwarfer eu tentei por algo como verificar o storage tal e falar tal coisa após o else do meu script mas n deu certo.

function outfit(cid, message, keywords, parameters, node)  
   if(not npcHandler:isFocused(cid)) then  
       return false
   end  
       if getPlayerItemCount(cid,5922) >= 50 and getPlayerItemCount(cid,2492) == 1  and getPlayerItemCount(cid,2488) == 1 and getPlayerItemCount(cid,2536) == 1 and getPlayerItemCount(cid,2123) == 1 then  
        doPlayerRemoveItem(cid,5922,50)  
        doPlayerRemoveItem(cid,2492,1)  
        doPlayerRemoveItem(cid,2488,1)  
        doPlayerRemoveItem(cid,2536,1)  
        doPlayerRemoveItem(cid,2123,1) 
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
        npcHandler:say('Get your outfit!', cid)  
        setPlayerStorageValue(cid, 65535, 1)  
       else  
           npcHandler:say('Sorry, you dont have itens!', cid)  
  end     
end

Editado por bpm91 (veja o histórico de edições)

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