Ir para conteúdo

Npc Por Itens Plx


Gustavosp6

Posts Recomendados

Bom aqui nos meus ot's eu tenho pra Citzen. Axo que nao tem aqui no :XTibia_smile: para todos os npc's, mas ai vai o que eu tenho aqui.

 

 

Abra a pasta de seu server/data/npc/script.

 

agora crie um arquivo .lua com o nome de addon ponha isto e salve.

 

focus = 0

talk_start = 0

target = 0

following = false

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('Hey ' .. creatureGetName(cid) .. '! Im looking for some chicken feathers and honeycombs do you think you could "help" me?')

focus = cid

talk_start = os.clock()

end

 

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

selfSay('Sorry, ' .. creatureGetName(cid) .. '! Im busy at the moment.')

end

 

if msgcontains(msg, 'offers') and focus == cid then

selfSay('I dont have anything to offer you.')

talk_start = os.clock()

end

 

if msgcontains(msg, 'help') or msgcontains(msg, 'helpp') or msgcontains(msg, 'helppp') or msgcontains(msg, 'helpppp') and focus == cid then

selfSay('I need 100 feathers and 50 honeycombs so I can take the combs out of them and a legion helmet to finnish my studies on wasps and chickens. I would gather them myself but I am just a poor animal studier and I don\'t have the might to kill a wasp and chicken.')

talk_start = os.clock()

end

 

if msgcontains(msg, 'wasps') or msgcontains(msg, 'chickens') or msgcontains(msg, 'study') or msgcontains(msg, 'studies') and focus == cid then

selfSay('Im studying everything about wasps and chickens! I am studying their physical atributes and their behaviour. I just need the itens so I can finnish my study on their bones.')

talk_start = os.clock()

end

 

if msgcontains(msg, 'crystal coin') or msgcontains(msg, 'crystalcoin') or msgcontains(msg, 'crystal') or msgcontains(msg, 'coin') and focus == cid then

selfSay('I dont need the coin so I can get tutoring from my master at the academy.')

talk_start = os.clock()

end

 

if focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'addon') or msgcontains(msg, 'itens') or msgcontains(msg, 'combination') then

queststatus = getPlayerStorageValue(cid,7003)

if queststatus == -1 then

itemstatus0 = doPlayerRemoveItem(cid,2480)

itemstatus1 = doPlayerRemoveItem(cid,5902)

itemstatus2 = doPlayerRemoveItem(cid,5902)

itemstatus3 = doPlayerRemoveItem(cid,5902)

itemstatus4 = doPlayerRemoveItem(cid,5902)

itemstatus5 = doPlayerRemoveItem(cid,5902)

itemstatus6 = doPlayerRemoveItem(cid,5902)

itemstatus7 = doPlayerRemoveItem(cid,5902)

itemstatus8 = doPlayerRemoveItem(cid,5902)

itemstatus9 = doPlayerRemoveItem(cid,5902)

itemstatus10 = doPlayerRemoveItem(cid,5902)

itemstatus11 = doPlayerRemoveItem(cid,5902)

itemstatus12 = doPlayerRemoveItem(cid,5902)

itemstatus13 = doPlayerRemoveItem(cid,5902)

itemstatus14 = doPlayerRemoveItem(cid,5902)

itemstatus15 = doPlayerRemoveItem(cid,5902)

itemstatus16 = doPlayerRemoveItem(cid,5902)

itemstatus17 = doPlayerRemoveItem(cid,5902)

itemstatus18 = doPlayerRemoveItem(cid,5902)

itemstatus19 = doPlayerRemoveItem(cid,5902)

itemstatus20 = doPlayerRemoveItem(cid,5902)

itemstatus21 = doPlayerRemoveItem(cid,5902)

itemstatus22 = doPlayerRemoveItem(cid,5902)

itemstatus23 = doPlayerRemoveItem(cid,5902)

itemstatus24 = doPlayerRemoveItem(cid,5902)

itemstatus25 = doPlayerRemoveItem(cid,5902)

itemstatus26 = doPlayerRemoveItem(cid,5902)

itemstatus27 = doPlayerRemoveItem(cid,5902)

itemstatus28 = doPlayerRemoveItem(cid,5902)

itemstatus29 = doPlayerRemoveItem(cid,5902)

itemstatus30 = doPlayerRemoveItem(cid,5902)

itemstatus31 = doPlayerRemoveItem(cid,5902)

itemstatus32 = doPlayerRemoveItem(cid,5902)

itemstatus33 = doPlayerRemoveItem(cid,5902)

itemstatus34 = doPlayerRemoveItem(cid,5902)

itemstatus35 = doPlayerRemoveItem(cid,5902)

itemstatus36 = doPlayerRemoveItem(cid,5902)

itemstatus37 = doPlayerRemoveItem(cid,5902)

itemstatus38 = doPlayerRemoveItem(cid,5902)

itemstatus39 = doPlayerRemoveItem(cid,5902)

itemstatus40 = doPlayerRemoveItem(cid,5902)

itemstatus41 = doPlayerRemoveItem(cid,5902)

itemstatus42 = doPlayerRemoveItem(cid,5902)

itemstatus43 = doPlayerRemoveItem(cid,5902)

itemstatus44 = doPlayerRemoveItem(cid,5902)

itemstatus45 = doPlayerRemoveItem(cid,5902)

itemstatus46 = doPlayerRemoveItem(cid,5902)

itemstatus47 = doPlayerRemoveItem(cid,5902)

itemstatus48 = doPlayerRemoveItem(cid,5902)

itemstatus49 = doPlayerRemoveItem(cid,5902)

itemstatus50 = doPlayerRemoveItem(cid,5902)

itemstatus51 = doPlayerRemoveItem(cid,5890)

itemstatus52 = doPlayerRemoveItem(cid,5890)

itemstatus53 = doPlayerRemoveItem(cid,5890)

itemstatus54 = doPlayerRemoveItem(cid,5890)

itemstatus55 = doPlayerRemoveItem(cid,5890)

itemstatus56 = doPlayerRemoveItem(cid,5890)

itemstatus57 = doPlayerRemoveItem(cid,5890)

itemstatus58 = doPlayerRemoveItem(cid,5890)

itemstatus59 = doPlayerRemoveItem(cid,5890)

itemstatus60 = doPlayerRemoveItem(cid,5890)

itemstatus61 = doPlayerRemoveItem(cid,5890)

itemstatus62 = doPlayerRemoveItem(cid,5890)

itemstatus63 = doPlayerRemoveItem(cid,5890)

itemstatus64 = doPlayerRemoveItem(cid,5890)

itemstatus65 = doPlayerRemoveItem(cid,5890)

itemstatus66 = doPlayerRemoveItem(cid,5890)

itemstatus67 = doPlayerRemoveItem(cid,5890)

itemstatus68 = doPlayerRemoveItem(cid,5890)

itemstatus69 = doPlayerRemoveItem(cid,5890)

itemstatus70 = doPlayerRemoveItem(cid,5890)

itemstatus71 = doPlayerRemoveItem(cid,5890)

itemstatus72 = doPlayerRemoveItem(cid,5890)

itemstatus73 = doPlayerRemoveItem(cid,5890)

itemstatus74 = doPlayerRemoveItem(cid,5890)

itemstatus75 = doPlayerRemoveItem(cid,5890)

itemstatus76 = doPlayerRemoveItem(cid,5890)

itemstatus77 = doPlayerRemoveItem(cid,5890)

itemstatus78 = doPlayerRemoveItem(cid,5890)

itemstatus79 = doPlayerRemoveItem(cid,5890)

itemstatus80 = doPlayerRemoveItem(cid,5890)

itemstatus81 = doPlayerRemoveItem(cid,5890)

itemstatus82 = doPlayerRemoveItem(cid,5890)

itemstatus83 = doPlayerRemoveItem(cid,5890)

itemstatus84 = doPlayerRemoveItem(cid,5890)

itemstatus85 = doPlayerRemoveItem(cid,5890)

itemstatus86 = doPlayerRemoveItem(cid,5890)

itemstatus87 = doPlayerRemoveItem(cid,5890)

itemstatus88 = doPlayerRemoveItem(cid,5890)

itemstatus89 = doPlayerRemoveItem(cid,5890)

itemstatus90 = doPlayerRemoveItem(cid,5890)

itemstatus91 = doPlayerRemoveItem(cid,5890)

itemstatus92 = doPlayerRemoveItem(cid,5890)

itemstatus93 = doPlayerRemoveItem(cid,5890)

itemstatus94 = doPlayerRemoveItem(cid,5890)

itemstatus95 = doPlayerRemoveItem(cid,5890)

itemstatus96 = doPlayerRemoveItem(cid,5890)

itemstatus97 = doPlayerRemoveItem(cid,5890)

itemstatus98 = doPlayerRemoveItem(cid,5890)

itemstatus99 = doPlayerRemoveItem(cid,5890)

itemstatus100 = doPlayerRemoveItem(cid,5890)

itemstatus101 = doPlayerRemoveItem(cid,5890)

itemstatus102 = doPlayerRemoveItem(cid,5890)

itemstatus103 = doPlayerRemoveItem(cid,5890)

itemstatus104 = doPlayerRemoveItem(cid,5890)

itemstatus105 = doPlayerRemoveItem(cid,5890)

itemstatus106 = doPlayerRemoveItem(cid,5890)

itemstatus107 = doPlayerRemoveItem(cid,5890)

itemstatus108 = doPlayerRemoveItem(cid,5890)

itemstatus109 = doPlayerRemoveItem(cid,5890)

itemstatus110 = doPlayerRemoveItem(cid,5890)

itemstatus111 = doPlayerRemoveItem(cid,5890)

itemstatus112 = doPlayerRemoveItem(cid,5890)

itemstatus113 = doPlayerRemoveItem(cid,5890)

itemstatus114 = doPlayerRemoveItem(cid,5890)

itemstatus115 = doPlayerRemoveItem(cid,5890)

itemstatus116 = doPlayerRemoveItem(cid,5890)

itemstatus117 = doPlayerRemoveItem(cid,5890)

itemstatus118 = doPlayerRemoveItem(cid,5890)

itemstatus119 = doPlayerRemoveItem(cid,5890)

itemstatus120 = doPlayerRemoveItem(cid,5890)

itemstatus121 = doPlayerRemoveItem(cid,5890)

itemstatus122 = doPlayerRemoveItem(cid,5890)

itemstatus123 = doPlayerRemoveItem(cid,5890)

itemstatus124 = doPlayerRemoveItem(cid,5890)

itemstatus125 = doPlayerRemoveItem(cid,5890)

itemstatus126 = doPlayerRemoveItem(cid,5890)

itemstatus127 = doPlayerRemoveItem(cid,5890)

itemstatus128 = doPlayerRemoveItem(cid,5890)

itemstatus129 = doPlayerRemoveItem(cid,5890)

itemstatus130 = doPlayerRemoveItem(cid,5890)

itemstatus131 = doPlayerRemoveItem(cid,5890)

itemstatus132 = doPlayerRemoveItem(cid,5890)

itemstatus133 = doPlayerRemoveItem(cid,5890)

itemstatus134 = doPlayerRemoveItem(cid,5890)

itemstatus135 = doPlayerRemoveItem(cid,5890)

itemstatus136 = doPlayerRemoveItem(cid,5890)

itemstatus137 = doPlayerRemoveItem(cid,5890)

itemstatus138 = doPlayerRemoveItem(cid,5890)

itemstatus139 = doPlayerRemoveItem(cid,5890)

itemstatus140 = doPlayerRemoveItem(cid,5890)

itemstatus141 = doPlayerRemoveItem(cid,5890)

itemstatus142 = doPlayerRemoveItem(cid,5890)

itemstatus143 = doPlayerRemoveItem(cid,5890)

itemstatus144 = doPlayerRemoveItem(cid,5890)

itemstatus145 = doPlayerRemoveItem(cid,5890)

itemstatus146 = doPlayerRemoveItem(cid,5890)

itemstatus147 = doPlayerRemoveItem(cid,5890)

itemstatus148 = doPlayerRemoveItem(cid,5890)

itemstatus149 = doPlayerRemoveItem(cid,5890)

itemstatus150 = doPlayerRemoveItem(cid,5890)

if moneystatus == -1 and itemstatus == -1 and itemstatus1 == -1 and itemstatus2 == -1 and itemstatus3 == -1 and itemstatus4 == -1 then

selfSay('I need 50 honeycombs and 100 chicken feathers!')

else

addon(cid,1)

setPlayerStorageValue(cid,7002,1)

end

else

selfSay('I don\'t need anything anymore im completing my studies quickly thanks to you.')

end

 

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

selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

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('<mumbles>Stupid adventurers only thinking of number one.')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('bye...')

focus = 0

end

end

end

 

Agora abra a pasta /data/npc.

 

Copie e cole um npc, renomeie para Adeons e ponha isto.

 

<?xml version="1.0"?>

 

<npc name="Adeons" script="data/npc/scripts/addon.lua" access="3" lookdir="3">

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

<look type="139" head="79" body="114" legs="0" feet="114" addon="2"/>

</npc>

 

Salve e esta pronto.

 

Espero ter ajudado com este npc

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...