TOPICO EXCLUSIVO AO XTIBIA.
CREDITOS 100% MEUS, NÃO ACEITO COPIA
(EDIT: estou com alguns problemas em algumas cores)
Bom como vi que muitas pessoas estavam pedindo resolvi fazer um npc de trocar 2 itens por um certo addon...
Este exemplo é o do 1° addon de pirate
Então vamos começar 1° abra data/npc depois copie qualquer arquivo .xml e cole (CTRL + C e CTRL + V) depois clique com botão direito e vá em editar, depois disso apague tudo que estiver escrito lá e cole isso
<?xml version="1.0"?>
<npc name="pirate addon 1" script="data/npc/scripts/pirate 1.lua" access="3" lookdir="2" autowalk="25">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="151" head="114" body="114" legs="114" feet="0" addons="3"/>
</npc>
--Traduzindo
Vermelho: nome do npc
Azul: local onde o arquivo .lua do npc está localizado
Verde: outfit do npc
depois abra a pasta data/npc/scripts copie qualquer arquivo .lua de lá e cole...
renomei-o para pirate 1.lua depois abra ele com o bloco de notas apague tudo que estiver dentro e cole issu
-- by ADM Leo leonardo caetanolocal focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Tchau!!.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. getCreatureName(cid) .. ' Eu posso lhe dar o Pirate Addon 1, diga help para mais informacoes.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('desculpe, ' .. getCreatureName(cid) .. '! falo com voce jaja.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') then
selfSay('Eu posso lhe dar o Pirate Addon 1, se estiver interessado diga: pirate addon 1')
elseif msgcontains(msg, 'pirate addon 1') then
if getPlayerStorageValue(cid,8009) >= 2 then
selfSay('voce ja tem esse addon.')
else if getPlayerStorageValue(cid,8009) == 1 then
selfSay('Precisarei de 100 peg legs, voce as trouxe?')
addon_state = 2
else
setPlayerStorageValue(cid,8009,1)
selfSay('Precisarei de 100 peg legs, voce as trouxe?')
end
end
elseif msgcontains(msg, 'yes') and addon_state == 2 then
if doPlayerRemoveItem(cid,6126,100) == 0 then
selfSay('Desculpe, mas voce nao as trouxe.')
else
selfSay('parabens agora voce e um pirata.')
if getPlayerSex(cid) == 0 then
doPlayerAddAddon(cid, 155, 1)
setPlayerStorageValue(cid,8009,2)
else
doPlayerAddAddon(cid, 151, 1)
setPlayerStorageValue(cid,8009,2)
talk_state = 1
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Ate mais, ' .. getCreatureName(cid) .. '! e volte sempre..')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Tchau!.')
focus = 0
end
end
end
--Traduzindo Vermelho: id do addon, o pirate feminino e 1 seguinifica que é o primeiro addon. Verde: id do addon, o pirate masculino e 1 seguinifica que é o primeiro addon Laranja: id do item peg legs e a quantidade necessaria Pink: falas do player Roxo: falas do npc
Este exemplo é o do 2° addon de pirate
Então vamos lá, 1° abra data/npc depois copie qualquer arquivo .xml e cole (CTRL + C e CTRL + V) depois clique com botão direito e vá em editar, depois disso apague tudo que estiver escrito lá e cole issu
<?xml version="1.0"?>
<npc name="Addon pirate 2" script="data/npc/scripts/pirate 2.lua" access="3" lookdir="2" autowalk="25">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="155" head="79" body="18" legs="0" feet="114" addons="3"/></npc>
[b]--Traduzindo Vermelho: nome do npc Azul: local onde o arquivo .lua do npc está localizado Verde: outfit do npc[/b]
depois abra a pasta data/npc/scripts copie qualquer arquivo .lua de lá e cole...
renomei-o para pirate 2.lua depois abra ele com o bloco de notas apague tudo que estiver dentro e cole issu
-- by ADM Leo leonardo caetanolocal focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Tchau!.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('ola ' .. getCreatureName(cid) .. ' Eu posso liberar o Pirate Addon 2, mas voce tem de ter feito o Pirate Addon 1, para melhores informacoes diga help.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('desculpe, ' .. getCreatureName(cid) .. '! eu falo com voce ja ja.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') then
selfSay('Bem se voce ja fez o Pirate Addon 1 e estiver interessado no Pirate Addon 2, diga: pirate 2')
elseif msgcontains(msg, 'pirate 2') then
if getPlayerStorageValue(cid,8041) >= 4 then
selfSay('Voce ja tem esse addon.')
else if getPlayerStorageValue(cid,8041) == 3 then
selfSay('Precisarei de 1 Ron the Rippers Sabre e 100 Eye Patches, voce os trouxe?')
addon_state = 2
else
setPlayerStorageValue(cid,8041,3)
selfSay('Precisarei de 1 Ron the Rippers Sabre e 100 Eye Patches, voce os trouxe?')
end
end
elseif msgcontains(msg, 'yes') and addon_state == 2 then
if doPlayerRemoveItem(cid,6098,100) == 0 or doPlayerRemoveItem(cid,6101,1) == 0 then
selfSay('Desculpe voce nao os trouxe.')
else
selfSay('Valeu, agora voce possui este addon.')
if getPlayerSex(cid) == 0 then
doPlayerAddAddon(cid, 155, 2)
setPlayerStorageValue(cid,8041,4)
else
doPlayerAddAddon(cid, 151, 2)
setPlayerStorageValue(cid,8041,4)
talk_state = 1
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Tchau, ' .. getCreatureName(cid) .. '! volte sempre..')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Ate mais!.')
focus = 0
end
end
end
--Traduzindo
Vermelho: id do addon, o pirate feminino e 2 segunifica que é o segundo addon.
Verde: id do addon, o pirate masculino e 2 segunifica que é o segundo addon
Azul quase preto:id do item Ron the Rippers Sabre e a quantidade necessaria
Laranja: id do item eye patch e a quantidade necessaria
Pink: falas do player
Roxo: falas do npc