Ir para conteúdo
Entre para seguir isso  
Hero

NPC que troca soft boots

Recommended Posts

Hero    0
Hero

Esses dias vim aqui no forum atras de um npc que trocasse worn soft boots por uma brand-new soft boots, depois de uma exausta procura percebi que NENHUM NPC funcionava, então resolvi pegar e modificar um pra funcionar

 

e tcharam! :

 

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

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

function creatureSayCallback(cid, type, msg)
   if(npcHandler.focus ~= cid) then
       return false
   end

       if msgcontains(msg, 'specialised') or msgcontains(msg, 'boot') then
           selfSay('Yes, my fathers was a great one blacksmith, it was a wise person , but when he decided to teach me he dies and i just learn about the lovely boots. So, did you bring me some boots? which one?')
       elseif msgcontains(msg, 'soft boots') or msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'soft boot') or msgcontains(msg, 'worn soft boot') or msgcontains(msg, 'worn') then
           selfSay('Did u like that i fix ur worn soft boots? it will cost 100 platinum coins')
           talk_state = 1

elseif msgcontains(msg, 'yes') and talk_state == 1 then
           if getPlayerItemCount(cid,[color=Olive]6530[/color]) >= 1 and getPlayerItemCount(cid,2152) >= 100 or getPlayerItemCount(cid,2160) >= 1 then
              selfSay('Here is your brand-new soft boots!.')
                      doPlayerTakeItem(cid, [color=Olive]6530[/color], 1)
                   doPlayerRemoveMoney(cid,[color=Red]10000[/color])
                   doPlayerAddItem(cid,[color=DarkOrchid]2640[/color],1)
           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 than.')
           talk_state = 0
       end
   return true
end

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

Ele troca a worn soft boots (id 6530) por uma nova soft boots (id 2640) custando 10.000 gps

 

SINTA-SE LIVRE PRA MODIFICAR :)

testado em TheForgothenServer (use-o e se surpreenda (Y)(Y))

Compartilhar este post


Link para o post
vHp    6
vHp

Obrigado pela contribuição!

 

Movido para Download de NPCs

Compartilhar este post


Link para o post
D u k e e H    0
D u k e e H

Daew Galera !

Npc Soft Boots 1.0 Sem O Bug De Nao Pegar Worn Soft Boots

 

Basta Fala :

 

hi

soft boots/worn soft boots

yes

 

Ele troca uma worn soft boots por uma nova com o custo de 10k...

 

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, 'worn soft boots') or msgcontains(msg, 'soft boots') then
           selfSay('Voce Quer Que Eu Arrume Sua Soft Boots ? isso custara 1 Crystal Coin')
           talk_state = 1


       elseif msgcontains(msg, 'yes') and talk_state == 1 then
           if getPlayerItemCount(cid,[color="Blue"]6530[/color]) >= 1 and getPlayerItemCount[color="DarkGreen"](cid,2160) >= 1 then[/color]
               if doPlayerTakeItem(cid,[color="Blue"]6530[/color],1) and doPlayerTakeItem(cid,[color="DarkGreen"]2160,1[/color]) == 0 then
               selfSay('Ai Esta Sua Soft Boots Novinha.')
                   doPlayerAddItem(cid,[color="Red"]2640[/color],1)
               end
           else
               selfSay('Desculpe Voce Nao Tem O Item.')
           end


       elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
           selfSay('Ok Ate Mais.')
           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())

 

Caso Queira Mudar :

 

Vermelho : Id Da Soft Boots.

Azul : Id Da Worn Soft Boots.

Verde : Custo Da Troca

 

Na Pasta Npc Copie Qualquer Npc Apague Tudo Que Tem Dentro E Bote :

 

<?xml version="1.0"?>

<npc name="Sapateiro" script="data/npc/scripts/softboots.lua" access="1" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="134" head="78" body="88" legs="0" feet="88"/>
</npc>

 

 

CRÉDITOS : 88% : DukZin (EU) , 12% Hero

 

Atenciosamente.

DukZin

Compartilhar este post


Link para o post
vHp    6
vHp

O tópico do senhor dukscmp foi unido a este já que dizem respeito a um mesmo assunto.

Compartilhar este post


Link para o post
BoY SoT    0
BoY SoT

mais nao ta bugado???? pq o do hero ele nao pede Worn Soft Boots, soh o dindin

Compartilhar este post


Link para o post
D u k e e H    0
D u k e e H

@Valew Dark !

 

@Hero

Desculpa Por Posta E Nao Fla Ctg Hero

So Que Vc Não Estava ON ..

 

@GOD Boy

Percebi Esse Bug Tambem Pois Porem No Meu Pelo Visto Eu Concertei So Queria Arruma Mesmo Hi E Bye !

 

@Topic

Meu Primero Npc ... HEheIUi (nao fui eu que fis mais ta valendo)

Outra Coisa ... Se Alguem Sabe Como Muda A Fala De Hi E Bye Do Npc Ajuda Ae Q Ja Traduzo E Edito Aqui !

 

Atenciosamente.

 

DukZin

Compartilhar este post


Link para o post
Hero    0
Hero

@God Boy

cláro que esta pedindo a worn soft! Preste atenção nesta parte (doPlayerTakeItem(cid, 6530, 1).. mais é bem capaz que o seu servidor não tenha o comando doPlayerTakeItem......

Meus Scripts são exclusivos para o Forgothen server, se você não estiver usando esse executável, vai precizar adicionar esse code em npc.lua em \data\npc\lib

 

function doPlayerTakeItem(cid, itemid, count)
   if(getPlayerItemCount(cid,itemid) >= count) then
       while count > 0 do
           local tempcount = 0
           if(isItemStackable(itemid) == TRUE) then
               tempcount = math.min (100, count)
           else
               tempcount = 1
           end
           local ret = doPlayerRemoveItem(cid, itemid, tempcount)
           if(ret ~= LUA_ERROR) then
               count = count-tempcount
           else
               return LUA_ERROR
           end
       end
       if(count == 0) then
           return LUA_NO_ERROR
       end
   else
       return LUA_ERROR
   end
end

ai funcionara, mais se você achou muito complicado faze isso, use o script do nosso querido dukscmp :)

Compartilhar este post


Link para o post
Undergradd    0
Undergradd

Por favor, vcs poderiam me ensinar a colocar esse NPC no OT?

É o primeiro que tento, mas não estou conseguindo.

Vlws =)

Compartilhar este post


Link para o post
MauroJr    0
MauroJr

topico legal n ta mto explikado mas vo v se do um jeito ak

Compartilhar este post


Link para o post
knightaxl    0
knightaxl

vlw ae cara ajudou muito no meu server..

Compartilhar este post


Link para o post
Chucky91    0
Chucky91

Ae tem uma coisa errada ae vc fala pro npc:

hi soft boots, yes ele da uma soft boots de graça lol,

yes,yes,yes,yes < ja me deu 4 soft boots...

hahahaha

flw.

Compartilhar este post


Link para o post
Chucky91    0
Chucky91

(Y)Ae tem uma coisa errada ae vc fala pro npc:

hi soft boots, yes ele da uma soft boots de graça lol,

yes,yes,yes,yes < ja me deu 4 soft boots...

hahahaha

flw.

Compartilhar este post


Link para o post
Chucky91    0
Chucky91

se eu falar pro npc hi soft boots yes sem ter o items worn boots ele dar uma soft e pega os meus 10k, lol

e ainda fala: hi, soft boots, yes, yes, yes, yes... <já me deu 4 soft por 40k sem o worn. tem um jeito vc tirar os 10k e colocar mais um item, ae não tem como o cara comprar por dinheiro...

Compartilhar este post


Link para o post
Chucky91    0
Chucky91

Ae eu fiz um que troca e não tem bug do (yes)

pega o dinheiro e o items e da a soft boots, sem bug:P

 

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, 'specialised') or msgcontains(msg, 'boot') then
           selfSay('Yes, my fathers was a great one blacksmith, it was a wise person , but when he decided to teach me he dies and i just learn about the lovely boots. So, did you bring me some boots? which one?')
       elseif msgcontains(msg, 'change boots') or msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'change boot') or msgcontains(msg, 'worn soft boot') then
           selfSay('Did u like that i fix ur worn soft boots? it will cost 100 platinum coins')
           talk_state = 1


       elseif msgcontains(msg, 'yes') and talk_state == 1 then
           if getPlayerItemCount(cid,6530) >= 1 and getPlayerItemCount(cid,6530) >= 1 then
               if doPlayerTakeItem(cid,6530,1) and doPlayerTakeItem(cid,2160,1) == 0 then
               selfSay('Here you are.')
                   doPlayerAddItem(cid,6132,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 than.')
           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())

Compartilhar este post


Link para o post
Chucky91    0
Chucky91
vlw ae cara ajudou muito no meu server..
Código:

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, 'specialised') or msgcontains(msg, 'boot') then

selfSay('Yes, my fathers was a great one blacksmith, it was a wise person , but when he decided to teach me he dies and i just learn about the lovely boots. So, did you bring me some boots? which one?')

elseif msgcontains(msg, 'change boots') or msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'change boot') or msgcontains(msg, 'worn soft boot') then

selfSay('Did u like that i fix ur worn soft boots? it will cost 100 platinum coins')

talk_state = 1

 

 

elseif msgcontains(msg, 'yes') and talk_state == 1 then

if getPlayerItemCount(cid,6530) >= 1 and getPlayerItemCount(cid,6530) >= 1 then

if doPlayerTakeItem(cid,6530,1) and doPlayerTakeItem(cid,2160,1) == 0 then

selfSay('Here you are.')

doPlayerAddItem(cid,6132,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 than.')

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())

 

Esse é o code certo pra isso...

Compartilhar este post


Link para o post
pupuki    0
pupuki

Pow cara, seu npc tah bom, mais tpw, qnd vc nao teim Soft, ele simplismente te VENDE uma sotf por 10k, e nao troca .. jah tentei aki, mais nao consigo fazer ele "trocar" .. ou msm fazer ele dizer "nao teim o item" .. ele vende a soft cara, tah fóda =[

 

tenta arruma isso ae plis, eu nao to conseguino =[

 

vlw =P

Compartilhar este post


Link para o post
Drop    0
Drop

a maioria dos OT$ ja vem com ele, mas bugado este não esta Parabens!

Compartilhar este post


Link para o post
GOD Sero    0
GOD Sero

nossa, quem não sabe bota npc direito não vai entende nada mesmo

 

mas o npc é bem útil

Compartilhar este post


Link para o post
VolcanStinger    0
VolcanStinger

vlws mano mt bom msm

Compartilhar este post


Link para o post
Phymnezius    0
Phymnezius

manero...interessante

 

 

 

 

POR FAVOR...SO NOVO NO FORUM...ME DOEM OT$..NEM KI SEJA SO 10 =)

 

Metas:

[x]1post

[x]5 posts

[x]15 posts

[x]20 posts

[ ] 30 Posts

[ ] 50 Posts

[ ]100 Posts

[ ]200 Posts

[ ]500 Posts

[ ]1500 Posts

[ ] casar cum a juliana paes(nunk completarei )

 

 

GANHE 2000 OT$ SEM ESFORÇO...ENTRE AGORAAA

Compartilhar este post


Link para o post
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×