Sobre o segundo NPC axei uma boa ideia e os livros que ajudan poden ser dados en quests, mas infelizmente en OTserv nen snepre e si por si, existen amigos
e uma pessoa sabera e ela vai contar para seu amigo e q que esse contara para outro, e dificil mas a ideia nun dexa de ser muito BOA




info
Grupo: Visconde
Registrado: 19/06/07
Posts: 267
Reputação: +1
Gênero: Masculino
Char no Tibia: Rambocop Infernus
Testei só no zorzin 1.1 tibia 7.9
Va em data/actions e copie um arquivo, depois cole e o renomeia ele para muambeiro
Abra o arquivo e apague tudo dentro dele e adicione isto:
Agora va em data/actions/scripts e copie um aquivo, depois cole e renomeie para muamba
Abra o arquivo e apague tudo dentro dele novamente e cole isto:
-- Npc by Albert =) 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('Thal e volte sempre!') 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) -- greeting phrase if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then selfSay('Hello ' .. creatureGetName(cid) .. 'Eu vendo itens piratas! (mana fluids, runas, obsidian knife...)') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! Espere sua vez! Tem para todo mundo.') elseif focus == cid then talk_start = os.clock() -- Mensages: buy_error = 'Desculpe, mas você não tem grana suficiente.' buy_ok = 'Obrigado(a).' buy_no = 'Ok. Mas não me faça perder mais tempo.' -- sell_error = 'Sorry, you dont have that item.' sell_ok = 'Thanks for this item.' sell_no = 'Ok. Maybe another time.' -- if msgcontains(msg, 'rope') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2120,getCountNumber(msg),0,50,0,'a','rope','ropes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'shovel') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2554,getCountNumber(msg),0,30,0,'a','shovel','shovels' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'runa') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2260,getCountNumber(msg),0,30,0,'a','rune','runa' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'backpack') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',1988,getCountNumber(msg),0,20,0,'a','backpack','backpacks' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'mana fluid') or msgcontains(msg, 'mana fluids') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2006,getCountNumber(msg),7,55,0,'a','vial of manafluid','vials of manafluid' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'ajdkjddmd,md,,') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2580,getCountNumber(msg),0,100,0,'a','fishing rod','fishing rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'kdkdkdkdk') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2050,getCountNumber(msg),0,2,0,'a','torch','torches' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 elseif msgcontains(msg, 'obsidian knife') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',5908,getCountNumber(msg),0,4000,0,'an','obsidian knife','obsidian knifes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 302 ----------------------- elseif talk_state == 302 then if msgcontains(msg, 'yes') or msgcontains(msg, 'no') then if bs == 'buy' then buyItem(cid,itemid,count,subtype,price,iscountable,name,plural,buy_error,buy_ok, buy_no,msg) else sellItem(cid,itemid,count,subtype,price,iscountable,sell_error,sell_ok,sell_no,m sg) end talk_state = 0 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 focus > 0 then x, y, z = creatureGetPosition(focus) myx, myy, myz = selfGetPosition() if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(1) end if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(3) end if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(2) end if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(0) end if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(2) end if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(0) end if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(3) end if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(1) end if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(2) end if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(0) end if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(3) end if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(1) end if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(2) end if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(0) end if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(3) end if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(1) end end if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Proximo muambeiro por favor!') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Sem educação, thal!.') focus = 0 end end endAgora vamos ao segundo Npc secret
Npc secret??? Você deve estar se perguntando o porque deste name!
Explicação: Ele é um Npc secret pq ele vai sair sem nome e quem descobrir o name dele vai poder vender itens ao mesmo
acima do preço de mercado! Eu coloquei alguns livros que ajudam os prayers a descobrirem o name dele mais isso é você quem decide!
Agora que ja expliquei ai vai...
... Em data/actions e copie um aquivo, depois cole e renomeie para secret
Abra o arquivo e apague tudo dentro dele novamente e cole isto:
E agora va em data/actions/scripts e copie um aquivo, depois cole e renomeie para secret name
e apague tudo dentro do mesmo e escreva:
-- Npc by Albert =) 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('Thal, volte sempre.') 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) -- greeting phrase if string.find(msg, '(%a*)hi [color="#00FF00"]secret[/color](%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then selfSay('Hiho [color="#00FF00"]Secret[/color]' .. creatureGetName(cid) .. '! Ohh não. Você descobriu meu nome, está bem, Eu compro blue robes, wands, rods, guardian shield, black shield and dark shield.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi [color="#00FF00"]secret[/color]') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! Falo com você daqui a pouco.') elseif focus == cid then talk_start = os.clock() -- Mensages: buy_error = 'Desculpe, mas você não tem dinheiro suficiente.' buy_ok = 'Ta na mão.' buy_no = 'Ok. Compre outra hora então.' -- sell_error = 'Desculpe, Você não possui este item.' sell_ok = 'Obrigado(a) pelo item.' sell_no = 'Ok. Mas não me importune!' -- -- Helmets if msgcontains(msg, 'sell') and msgcontains(msg, 'blue robe') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2656,getCountNumber(msg),0,60000,0,'a','blue robe','blue robes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'guardian shield') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2515,getCountNumber(msg),0,80000,0,'a','guardian shield','guardian shields' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'wand of inferno') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2187,getCountNumber(msg),0,10000,0,'a','wand of inferno','wand of ifernos' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'wand of plague') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2188,getCountNumber(msg),0,3000,0,'a','wand of plague','wand of plagues' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'wand of cosmic energy') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2189,getCountNumber(msg),0,7000,0,'a','wand of cosmic energy','wand of cosmic energys' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'wand of vortex') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2190,getCountNumber(msg),0,400,0,'an','wand of vortex','wand of vortexs' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and (msgcontains(msg, 'wand of dragonbreath') or msgcontains(msg, 'wand of dragon breath')) then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2191,getCountNumber(msg),0,800,0,'a','wand of dragonbreath','wand of dragonbreaths' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'quagmire rod') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2181,getCountNumber(msg),0,7000,0,'a','quagmire rod','quagmire rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'snakebite rod') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2182,getCountNumber(msg),0,400,0,'a','snakebite rod','snakebite rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'tempest rod') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2183,getCountNumber(msg),0,10000,0,'a','tempest rod','tempest rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'volcanic rod') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2185,getCountNumber(msg),0,3000,0,'a','volcanic rod','volcanic rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'moonlight rod') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2528,getCountNumber(msg),0,800,0,'a','moonlight rod','moonlight rods' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'black shield') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2529,getCountNumber(msg),0,8000,0,'a','black shield','black shields' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'dark shield') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2521,getCountNumber(msg),0,4000,0,'a','dark shield','dark shields' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 elseif msgcontains(msg, 'sell') and msgcontains(msg, 'skull staff') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'sell',2436,getCountNumber(msg),0,15000,0,'a','skull staff','skull staffs' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 786 ---------------------- elseif talk_state == 786 then if msgcontains(msg, 'yes') or msgcontains(msg, 'no') then if bs == 'buy' then buyItem(cid,itemid,count,subtype,price,iscountable,name,plural,buy_error,buy_ok, buy_no,msg) else sellItem(cid,itemid,count,subtype,price,iscountable,sell_error,sell_ok,sell_no,m sg) end talk_state = 0 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 focus > 0 then x, y, z = creatureGetPosition(focus) myx, myy, myz = selfGetPosition() if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(1) end if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(3) end if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(2) end if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(0) end if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(2) end if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(0) end if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(3) end if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(1) end if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(2) end if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(0) end if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(3) end if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(1) end if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(2) end if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(0) end if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(3) end if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(1) end end if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Proximo por favor...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Thal, e não conte meu nome para ninguem.') focus = 0 end end endOnde está de verde claro:unsure: você vai colocar o name que vc quer no npc!
Foi meus primeiros npcs agora quero saber a opinião de vocês
Comentem...
Editado Julho 6 por Albert José