Ir para conteúdo
  • 0

[ Npc ] Recarregador De Soft Boots


danielprist

Pergunta

ae galera preciso de 1 npc q recarrege a worn soft boots por uma nova

ja pesquisei aki no xtibia en axei =/

uso o server:

the forgoten com map slayer yourots 8.5

 

tenho esse

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Soft Boots Recharger" script="data/npc/scripts/softboots.lua" walkinterval="2000" floorchange="0">

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

<look type="132" head="20" body="39" legs="45" feet="7" addons="0"/>

</npc>

 

 

 

 

 

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 rechargeSoft(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

local playermoney = getPlayerMoney(cid)

if playermoney >= 10000 then

if doPlayerRemoveItem(cid,6530,1) == 1 then

doPlayerAddItem(cid, 6132, 1)

doPlayerRemoveMoney(cid, 10000)

npcHandler:say("Here are your new soft boots!", cid)

else

npcHandler:say("You don't have worn soft boots.", cid)

end

else

npcHandler:say("You don't have enough money.", cid)

end

keywordHandler:moveUp(1)

return true

end

 

local node1 = keywordHandler:addKeyword({'soft boots'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to repair your soft Boots for 10000 gold coins?'})

node1:addChildKeyword({'yes'}, rechargeSoft, {blessing = 1})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

 

keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft Boots for 10000 gold coins."})

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft Boots for 10000 gold coins."})

 

npcHandler:addModule(FocusModule:new())

 

 

 

ele aparece, fala direitinho e TIRA o dinheiro E a worn soft MAS nao da uma nova =p

help algm plx.

abrass

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Tente mudar esta parte:

 

if doPlayerRemoveItem(cid,6530,1) == 1 then
doPlayerAddItem(cid, 6132, 1)
doPlayerRemoveMoney(cid, 10000)

 

Para:

 

if getPlayerItemCount(cid,6530) >= 1 then
if doPlayerTakeItem(cid,6530,1) == 0 then
doPlayerAddItem(cid,6132,1)
doPlayerRemoveMoney(cid, 10000)

 

E vê se dá certo.

 

Cya Ciao.

Link para o comentário
Compartilhar em outros sites

  • 0

o de cima /\ não vai dar porque falto um end

sempre que você colocar um "if" você fecha com "end"

e mesmo assim não funciono...

 

o meu eu testei aqui e funfo

 

 

 

tenta usar esse:

 

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 rechargeSoft(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

local playermoney = getPlayerMoney(cid)

if playermoney >= 10000 then

if doPlayerRemoveItem(cid,6530,1) or doPlayerRemoveItem(cid,6530,1) == 1 then

doPlayerAddItem(cid, 6132, 1)

doPlayerRemoveMoney(cid, 10000)

npcHandler:say("Here are your new soft boots!", cid)

else

npcHandler:say("You don't have worn soft boots.", cid)

end

else

npcHandler:say("You don't have enough money.", cid)

end

keywordHandler:moveUp(1)

return true

end

 

local node1 = keywordHandler:addKeyword({'soft boots'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to repair your soft Boots for 10000 gold coins?'})

node1:addChildKeyword({'yes'}, rechargeSoft, {blessing = 1})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

 

keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft Boots for 10000 gold coins."})

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft Boots for 10000 gold coins."})

 

npcHandler:addModule(FocusModule:new())

Editado por Swishy
Link para o comentário
Compartilhar em outros sites

  • 0

o de cima /\ não vai dar porque falto um end

sempre que você colocar um "if" você fecha com "end"

e mesmo assim não funciono...

 

o meu eu testei aqui e funfo

 

 

 

tenta usar esse:

 

 

 

oi vlw pela ajuda

mas msmo assim ele n funciono

ele pega o dindin e a soft velha mas NAO da uma nova= p

Link para o comentário
Compartilhar em outros sites

  • 0

qual o ID da sua Soft Boots NOVA?

 

é 6132?

ou 2640?

 

 

 

ok esse vai:

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

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(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'soft') or msgcontains(msg, 'boots')) then

selfSay('Do you want to repair your worn soft boots for 10000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

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

if(doPlayerRemoveMoney(cid, 10000) == TRUE) then

doPlayerRemoveItem(cid, 3530, 1)

doPlayerAddItem(cid, 6132)

selfSay('Here you are.', cid)

else

selfSay('Sorry, you don\'t have enough gold.', cid)

end

else

selfSay('Sorry, you don\'t have the item.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

elseif(msgcontains(msg, 'firewalker') or msgcontains(msg, 'boots')) then

selfSay('Do you want to repair your worn firewalker boots for 10000 gold coins?', cid)

talkState[talkUser] = 2

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then

if(getPlayerItemCount(cid, 10022) >= 1) then

if(doPlayerRemoveMoney(cid, 10000) == TRUE) then

doPlayerRemoveItem(cid, 10022, 1)

doPlayerAddItem(cid, 9933)

selfSay('Here you are.', cid)

else

selfSay('Sorry, you don\'t have enough gold.', cid)

end

else

selfSay('Sorry, you don\'t have the item.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

end

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado por Swishy
Link para o comentário
Compartilhar em outros sites

  • 0

Daniel tente usar esse: (não fui eu que fiz)

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

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(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

if(msgcontains(msg, 'soft') or msgcontains(msg, 'boots')) then

selfSay('Do you want to repair your worn soft boots for 20000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 10021) >= 1) then

if(doPlayerRemoveMoney(cid, 20000) == TRUE) then

doPlayerRemoveItem(cid, 10021, 1)

doPlayerAddItem(cid, 2640)

selfSay('Here you are.', cid)

else

selfSay('Sorry, you don\'t have enough gold.', cid)

end

else

selfSay('Sorry, you don\'t have the item.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

<npc name="Soft Boots Recharger" script="data/npc/scripts/soft.lua" access="5" lookdir="1">

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

<look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|.I've been working hard these days in this project, I can now repair your dear friend {boots}." />

</parameters>

</npc>

Editado por BruMatt
Link para o comentário
Compartilhar em outros sites

  • 0

Ok Daniel, só mais uma coisa.. Quando sua dúvida/pedido for sanado, por favor reporte a algum moderador pelo botão denunciar para fechar o mais rápido possível. Dessa vez eu fazerei, da próxima você já pode fazer!

Reportado!

 

 

 

Abraços.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...