Ir para conteúdo

Posts Recomendados

gente é o seguinte eu criei um npc que vende os itens para fazer addons , ai vc compra os itens nesse npc e compra o addon no npc que o pedr1nh0 fez (Clique aqui para ver o tópico)

 

espero que ele não fique chateado deu por o tópico dele aqui =)

 

vamos la

 

vá em data>npc>scripts , crie um novo .lua chamado venditens e cole isso lá:

 

-- Walking --

 

max_x = 1 -- change the max x here. Means the NPC wont walk more to east or west as the number which is set here.

 

max_y = 1 --change the max y here. Means the NPC wont walk more to north or south as the number which is set here.

 

current_x = 0 --do nothing change here

 

current_y = 0 --do nothing change here

 

max_x = max_x - 1 --do nothing change here

 

max_y = max_y - 1 --do nothing change here

 

-- End Walking--

 

local 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('Good bye then.')

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('olá ' .. creatureGetName(cid) .. '! eu vendo os itens para addons , todos por 10k(cada) , fale o item que você quer que eu irei vender..')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Desculpa, ' .. creatureGetName(cid) .. '! Ja falo com você.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'Chicken Feather') then

buy(cid,5890,1,10000)

elseif msgcontains(msg, 'minotaur leather') then

buy(cid,5878,1,10000)

elseif msgcontains(msg, 'Holy Orchid') then

buy(cid,5922,1,10000)

elseif msgcontains(msg, 'ape fur') then

buy(cid,5883,1,10000)

elseif msgcontains(msg, 'honeycomb') then

buy(cid,5902,1,10000)

elseif msgcontains(msg, 'sniper gloves') then

buy(cid,5875,1,10000)

elseif msgcontains(msg, 'iron ore') then

buy(cid,5880,1,10000)

elseif msgcontains(msg, 'demon horn') then

buy(cid,5954,1,10000)

elseif msgcontains(msg, 'green dragon scale') then

buy(cid,5920,1,10000)

elseif msgcontains(msg, 'holy orchid') then

buy(cid,5922,1,10000)

elseif msgcontains(msg, 'turtle shell') then

buy(cid,5899,1,10000)

elseif msgcontains(msg, 'green dragon leather') then

buy(cid,5877,1,10000)

elseif msgcontains(msg, 'bat wing') then

buy(cid,5894,1,10000)

elseif msgcontains(msg, 'Giant Spider Silk') then

buy(cid,5879,1,10000)

elseif msgcontains(msg, 'Blue Piece Of Cloth') then

buy(cid,5912,1,10000)

elseif msgcontains(msg, 'Wolf Paw') then

buy(cid,5897,1,10000)

elseif msgcontains(msg, 'Demon Dust') then

buy(cid,5906,1,10000)

elseif msgcontains(msg, 'Green Piece of Cloth') then

buy(cid,5910,1,10000)

elseif msgcontains(msg, 'brown piece of cloth') then

buy(cid,5913,1,10000)

elseif msgcontains(msg, 'demonic essence') then

buy(cid,5500,1,10000)

elseif msgcontains(msg, 'red dragon leather') then

buy(cid,5948,1,10000)

elseif msgcontains(msg, 'white piece of cloth') then

buy(cid,5909,1,10000)

elseif msgcontains(msg, 'Red Dragon Scale') then

buy(cid,7314,1,10000)

elseif msgcontains(msg, 'vampire dust') then

buy(cid,6551,1,10000)

elseif msgcontains(msg, 'behemoth claw') then

buy(cid,5930,1,10000)

elseif msgcontains(msg, 'staff') then

buy(cid,2401,1,10000)

elseif msgcontains(msg, 'yellow piece of cloth') then

buy(cid,5914,1,10000)

elseif msgcontains(msg, 'Wolf Paw') then

buy(cid,5897,1,10000)

 

 

 

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Adeus, ' .. creatureGetName(cid) .. '!')

focus = 0

talk_start = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

-- Walking --

 

if focus == 0 and max_x >= 0 and max_y >= 0 then

 

cx, cy, cz = selfGetPosition()

 

randmove = math.random(1,20)

 

if randmove == 4 and current_x <= max_x then

 

nx = cx + 1

 

current_x = current_x + 1

 

elseif randmove == 8 and current_x >= (max_x - (max_x * 2)) then

 

nx = cx - 1

 

current_x = current_x - 1

 

elseif randmove == 12 and current_y <= max_y then

 

ny = cy + 1

 

current_y = current_y + 1

 

elseif randmove == 16 and current_y >= (max_y - (max_y * 2)) then

 

ny = cy - 1

 

current_y = current_y - 1

 

elseif randmove <= 20 then

 

nx = cx

 

ny = cy

 

end

 

moveToPosition(nx, ny, cz)

 

end

 

-- End Walking --

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('Good bye then.')

focus = 0

end

end

end

 

 

em data>npc crie um novo com o nome que vc quiser , exemplo leier.xml

e cole isso dentro

 

<?xml version="1.0"?>

 

<npc name="Leier" script="data/npc/scripts/venditens.lua" access="5" lookdir="2">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="134" head="78" body="87" legs="95" feet="88" addons="3"/>

</npc>

 

OBS. ai só tem os itens que precisam para o npc que vende addon do pedr1nh0 , tem alguns itens que não tem no dele que eu não puis para o player na compra errado =)

OBS2. antes de comprar o item vá no npc que vende addon e veja qual o item que precisa e depois vá nesse =]

 

ESSE É O PRIMEIRO DE MUITOS NPCS

 

 

 

Espero que gostem

//grafit_

Link para o comentário
https://xtibia.com/forum/topic/83414-npc-que-vende-os-items-pra-vc-comprar-addon-por-item/
Compartilhar em outros sites

sim...

mais cada um vale 10k

e por exemplo

em muitos ots os monstros não deixam cair os itens do addon =)

ai depende da interpretação de cada um =)

 

obrigado por comentar =)

Eu acho que fica ruim!

Eu por exemplo botei no ot o npc de addon e botei todos os bixo que dropassem os loot dos addon, e botei obsidian knife e blessed wooden stake pra funciona!

se caso vcs quiserem eu até mando o quote dos actions

×
×
  • Criar Novo...