Ir para conteúdo

Featured Replies

Postado
  • Autor

 

Testado em: TFS 0.4 Protocolo: 8.60

 

Crie um arquivo em data/npc com o nome Ajudante.xml e troque o que estiver dentro por isso:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Ajudante" script="Ajudante.lua" walkinterval="2000" speechbubble="1" floorchange="0">
  <health now="100" max="100" />
 <look type="160" head="98" body="95" legs="115" feet="114" addons="0"/>
  <parameters>
    <parameter key="message_greet" value="Ola, voce precisa de ajuda ? Eu dou items para os iniciantes! Quer os items ?" />
  </parameters>
</npc>

 

Agora, em, data/npc/scripts crie um arquivo com nome Ajudante.lua e troque o que estiver dentro por isso:

 

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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	msg = msg:lower()


local items = {
      [1] = {
          {2160, 10}, 
          {2159, 10},
      },
      [2] = {
          {2159, 10},
          {2157, 10},
      },
}

local storage = 6554

    if getPlayerStorageValue(cid, storage) >= 1 then
        npcHandler:say("Ja lhe entreguei os items, suma!", cid)
        return true
    elseif msgcontains(msg, "yes") then
	npcHandler:say("Aqui, tome seus items.", cid)
	for voc, item in pairs(items) do
	    if items[getPlayerVocation(cid)] then
                for _, itemid in pairs(item) do
                    doPlayerAddItem(cid,itemid[1],itemid[2]) 
                end
                break
            end
        end
        setPlayerStorageValue(cid, storage, 1)
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Configuração:

Aqui:

local items = {
      [1] = {
          {2160, 10}, 
          {2159, 10},
      },
      [2] = {
          {2159, 10},
          {2157, 10},
      },
}

Você põe os items de cada vocação, é o seguinte:

 

 

[id da vocação] = {
{id do item, quantidade},
}

 

Repita o processo quantas vezes quiser, exemplo, se você quer que um player com a vocação de id 1 ganhe 3 items, você faz assim:

 

local items = {
    [1] = {
        {2160, 2},
        {2159, 10},
        {2152, 20},
    },
}

Cara Chegou Perto 

 

Eu editei isto :

 

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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
msg = msg:lower()
 
 
local items = {
      [1] = {
          {2160, 10}, 
          {2159, 10},
 {9778, 2},
      },
      [2] = {
          {2159, 12},
          {2160, 12},
      },
 [3] = {
          {2159, 11},
          {2160, 11},
      },
      [4] = {
          {2159, 13},
          {2160, 13},
      },
}
 
local storage = 655434
 
    if getPlayerStorageValue(cid, storage) >= 1 then
        npcHandler:say("Ja lhe entreguei os items, suma!", cid)
        return true
    elseif msgcontains(msg, "yes") then
npcHandler:say("Aqui, tome seus items.", cid)
for voc, item in pairs(items) do
   if items[getPlayerVocation(cid)] then
                for _, itemid in pairs(item) do
                    doPlayerAddItem(cid,itemid[1],itemid[2]) 
                end
                break
            end
        end
        setPlayerStorageValue(cid, storage, 1)
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 
Pouca coisa só editei a storage para ficar testando varias vezes no msm char e adicionei as 4 vocations! mas dai agora o npc esta dando apenas os items da vocation 4, eu sou vocation 1 e estou recebendo item da vocation 4! ajuda ai plx

UpUpUp Alguem ajuda ai pf

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

  • Respostas 11
  • Visualizações 509
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • ok xo fazer aqui rapidão to com sono kkkk   npc   <?xml version="1.0"?> <npc name="Paladin" script="data/npc/scripts/vocacao.lua" access="1" monster="1" speed="0" lookdir="2" pushable="0

  • Testado em: TFS 0.4 Protocolo: 8.60   Crie um arquivo em data/npc com o nome Ajudante.xml e troque o que estiver dentro por isso:   <?xml version="1.0" encoding="UTF-8"?> <npc name="Aju

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

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	msg = msg:lower()


local items = {
      [1] = {
          {2160, 10}, 
          {2159, 10},
      },
      [2] = {
          {2159, 10},
          {2157, 10},
      },
}

local storage = 6554

    if getPlayerStorageValue(cid, storage) >= 1 then
        npcHandler:say("Ja lhe entreguei os items, suma!", cid)
        return true
	elseif msgcontains(msg, "yes") then
		npcHandler:say("Aqui, tome seus items.", cid)
		for voc, item in pairs(items) do
		    if voc == getPlayerVocation(cid) then
                for _, itemid in pairs(item) do
                    doPlayerAddItem(cid,itemid[1],itemid[2]) 
                end
                break
            end
        end
        setPlayerStorageValue(cid, storage, 1)
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Pequeno deslize meu, testa...

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado
 
 
se te ajudei mi ajude com um like
 
post-154810-0-74779100-1428114524_thumb.        post-154810-0-22067300-1428114531_thumb.          post-154810-0-83198200-1427326965.gif
post-154810-0-48855100-1429834735.gif
 
 
 
 
0 comentários:

 

Postado

@Tibia2015br  Peço que na próxima, poste algo de acordo com o pedido do tópico, porque o que tu postou não tem nada a haver com o proposto no tópico.

 

Se o snows não se importar fiz o meu, baseado no dele hu3 :

local items = {
       	
       	[1] = {
          	{2160, 10}, 
          	{2159, 10},
 			{9778, 2},
      },
      	[2] = {
          	{2159, 12},
          	{2160, 12},
      },
 		[3] = {
          	{2159, 11},
          	{2160, 11},
      },
      	[4] = {
          	{2159, 13},
          	{2160, 13},
      },
}


local storage = 6554


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 creatureSayCallback(cid, type, msg)
	
	if not npcHandler:isFocused(cid) then
		return false
	end
	
	msg = msg:lower()

    if getPlayerStorageValue(cid, storage) >= 1 then
        npcHandler:say("Ja lhe entreguei os items, suma!", cid)
        return true
    end
	
	if msgcontains(msg, "yes") then
		for voc, item in pairs(items) do
		    if voc == getPlayerVocation(cid) then
                for x = 1, #item do
                    doPlayerAddItem(cid, item[x][1], item[x][2]) 
                end
                break
            end
        end
        npcHandler:say("Aqui, tome seus items.", cid)
        setPlayerStorageValue(cid, storage, 1)
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

xml usa o que o snows postou.

EQD4Qy4.gif

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