SP

Real Addons Trader 8.1

Por speedyks, 15 de fev. de 2008 em NPCs, monsters e raids

script
otserv
9
3.9k
speedyksS
15 de fevereiro de 2008 às 00:53

Olá, venho postar um NPC feito por Evil Hero, e modificado por mim...

 

Vá em data/npc/ crie um novo arquivo xml com o nome que desejar exemplo: AddonTrader.xml

Abra-o e coloque isso:

 

<?xml version="1.0"?>

<npc name="[color="#FF0000"]Nomedonpc[/color]" script="data/npc/scripts/exchange.lua" access="3" lookdir="2" autowalk="0">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="251" head="114" body="119" legs="132" feet="114" addons="3"/>
</npc>

 

Caso queira seguir o nome do NPC de AddonTrader mude onde está escrito "Nomedonpc" para "AddonTrader"

Após renomear o NPC poderá salvar o arquivo e feichar.

___________________________________________________

 

Em data/npc/scripts crie um novo arquivo LUA com o nome de Exchange.lua

E cole isso:

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
   -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
   if(npcHandler.focus ~= cid) then
       return false
   end

       if msgcontains(msg, 'offer') then
           selfSay('I can Trade Fighting Spirit, Warriors Sweat, Spool of Yarn, Enchanted Chicken Wings and a Blessed Wooden Stake for some special Items')
       elseif msgcontains(msg, 'fighting spirit') then
           selfSay('Do you like to trade 2 Royal Helmet for a Fighting Spirit?')
           talk_state = 1


       elseif msgcontains(msg, 'yes') and talk_state == 1 then
           if getPlayerItemCount(cid,2498) >= 2 then
               if doPlayerTakeItem(cid,2498,2) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,5884,1)
               end
           else
               selfSay('Sorry, you don\'t have the item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
           selfSay('Ok thanks.')
           talk_state = 0
       end

       if msgcontains(msg, 'warriors sweat') then
           selfSay('Do you like to trade 4 Warrior Helmet Helmet for a Warriors Sweat?')
           talk_state = 2


       elseif msgcontains(msg, 'yes') and talk_state == 2 then
           if getPlayerItemCount(cid,2475) >= 4 then
               if doPlayerTakeItem(cid,2475,4) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,5885,1)
               end
           else
               selfSay('Sorry, you don\'t have the item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
           selfSay('Ok thanks.')
           talk_state = 0
       end

       if msgcontains(msg, 'spool of yarn') then
           selfSay('Do you like to trade 10 Giant Spider Silk for a Spool of Yarn?')
           talk_state = 3


       elseif msgcontains(msg, 'yes') and talk_state == 3 then
           if getPlayerItemCount(cid,5879) >= 10 then
               if doPlayerTakeItem(cid,5879,10) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,5886,1)
               end
           else
               selfSay('Sorry, you don\'t have the item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
           selfSay('Ok thanks.')
           talk_state = 0
       end

       if msgcontains(msg, 'enchanted chicken wings') then
           selfSay('Do you like to trade Boots of Haste for some Enchanted Chicken Wings?')
           talk_state = 4


       elseif msgcontains(msg, 'yes') and talk_state == 4 then
           if getPlayerItemCount(cid,2195) >= 1 then
               if doPlayerTakeItem(cid,2195,1) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,5891,1)
               end
           else
               selfSay('Sorry, you don\'t have the item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
           selfSay('Ok thanks.')
           talk_state = 0
       end

       if msgcontains(msg, 'blessed wooden stake') then
           selfSay('Do you like to trade 100k for a Blessed Wooden Stake?')
           talk_state = 5


       elseif msgcontains(msg, 'yes') and talk_state == 5 then
           if getPlayerItemCount(cid,2160) >= 10 then
               if doPlayerTakeItem(cid,2160,10) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,5942,1)
               end
           else
               selfSay('Sorry, you don\'t have the item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 6) then
           selfSay('Ok thanks.')
           talk_state = 0
       end
   -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
   return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Salve o arquivo, e feiche-o.

Pronto seu NPC está configurado :)

Agora é so dizer HI o nome do addon e procurar o item que ele pedir :)

 

Atenção: Partes do texto em vermelho são coisas que você precisa fazer para que de certo :)

 

__________________________________________________________

 

Créditos totalmente a Evil Hero

GuTOcSG
19 de fevereiro de 2008 às 03:13

BOua Cara

mas Faz UMF aVoR??

Poem no quote Tira do Box

Please

Vlkw VOT esTa DpoiS x)!

tavaxT
20 de fevereiro de 2008 às 17:47

AEW estava mesmo procurando isto porque tenho perguisa de fazer UHSuhsauhas

 

Manow mas ele é 8.1 ? com os addons do palhaço e isso?

kruxduduK
20 de fevereiro de 2008 às 20:45

Boa.

Parabéns.

speedyksS
21 de fevereiro de 2008 às 00:59

sim 8.1 com addons de jester , brotherwood entre outros...

 

:)

2 semanas depois...
dragun7D
29 de fevereiro de 2008 às 15:27

Mal ae perguntar, mas onde ele fica.. novato =/

dinomtD
04 de março de 2008 às 11:47

MrStyle

Mal ae perguntar, mas onde ele fica.. novato =/

 

Tpo c vc tiver o seu map editor eu nao sei c vai ter lah o npc q vc criou , mais para um test crie com o seu GOD /s (nomedonpc)

 

 

 

vlw aew pelo tuto ^^ :smile_positivo:

Editado Março 4 por Raulzito

DakosD
05 de março de 2008 às 21:58

Bom NPC, aprovado.

tadzioT
06 de março de 2008 às 16:29

Desculpa mas esse NPC, n dah addon , mas sim troca itens por outros que podem ser usados em addon, é um npc trader

PS:Olhem sempre oque voce posta

&Tádzio&