Ir para conteúdo
  • 0

Npc Swety Cyclops


shuzin

Pergunta

 

 

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

 

-- XVX FORGER START --

 

function amulet(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,8262) >= 1 and getPlayerItemCount(cid,8263) >= 1 and getPlayerItemCount(cid,8264) >= 1 and getPlayerItemCount(cid,8265) >= 1 and getPlayerMoney(cid) >= 5000 then

 

doPlayerRemoveItem(cid, 8262, 1)

doPlayerRemoveItem(cid, 8263, 1)

doPlayerRemoveItem(cid, 8264, 1)

doPlayerRemoveItem(cid, 8265, 1)

doPlayerRemoveMoney(cid,5000)

doPlayerAddItem(cid, 8266, 1)

selfSay('Here is your item!', cid)

 

else

selfSay('You don\'t have all items or cash!', cid)

end

end

 

function obsidian(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,2425) >= 1 then

 

doPlayerRemoveItem(cid, 2516, 1)

doPlayerRemoveItem(cid, 2425, 1)

doPlayerAddItem(cid, 5908, 1)

selfSay('Here is your item!', cid)

else

selfSay('You don\'t have these items!', cid)

end

end

 

function crude(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,2393) >= 1 then

 

doPlayerRemoveItem(cid,2393,1)

doPlayerAddItem(cid,5892,1)

selfSay('Here is your item!', cid)

 

 

else

selfSay('You don\'t have these items!', cid)

end

end

 

function draconian(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,2516) >= 1 then

 

doPlayerRemoveItem(cid,2516,1)

doPlayerAddItem(cid,5889,1)

selfSay('Here is your item!', cid)

 

else

selfSay('You don\'t have these items!', cid)

end

end

 

 

function royal(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,2487) >= 1 then

 

doPlayerRemoveItem(cid,2487,1)

doPlayerAddItem(cid,5887,1)

selfSay('Here is your item!', cid)

 

else

selfSay('You don\'t have these items!', cid)

end

end

 

 

function hells(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if getPlayerItemCount(cid,2462) >= 1 then

 

doPlayerRemoveItem(cid,2462,1)

doPlayerAddItem(cid,5888,1)

selfSay('Here is your item!', cid)

 

else

selfSay('You don\'t have these items!', cid)

end

end

-- XVX FORGER END --

 

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge Amulet, Obsidian Knife, Huge Chunk of Crude Iron and Piece of Draconian Steel!"})

 

local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??'})

node1:addChildKeyword({'yes'}, amulet, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

local node2 = keywordHandler:addKeyword({'knife'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield and an Obsidian Lance for a Obsidian Knife?'})

node2:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

local node3 = keywordHandler:addKeyword({'uth\'prta'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Sword for a Huge Chunk of Crude Iron?'})

node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

local node4 = keywordHandler:addKeyword({'uth\'lokr'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield for a Piece of Draconian Steel?'})

node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

local node5 = keywordHandler:addKeyword({'uth\'kean'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Crown Armor for a Piece of Royal Steel?'})

node5:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

local node6 = keywordHandler:addKeyword({'za\'ralator'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Devil Helmet for a Piece of Hell Steel?'})

node6:addChildKeyword({'yes'}, hells, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

 

npcHandler:addModule(FocusModule:new())

 

 

 

Tenho essas funções do npc, mas ele não esta trocando soul orb por infernal bolt, ( que deveria ) e nem trocando os 10 gold in gots pelo item que vc da use na árvore e ela pode virar um item de montaria, alguém tem ele diferente ai? Que funcione? Obrigado!

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0
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

-- XVX FORGER START --

function amulet(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,8262) >= 1 and getPlayerItemCount(cid,8263) >= 1 and getPlayerItemCount(cid,8264) >= 1 and  getPlayerItemCount(cid,8265) >= 1 then
       if doPlayerRemoveItem(cid,8262,1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and  doPlayerRemoveItem(cid,8265,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,8266,1)
       end
       else
           npcHandler:say('You don\'t have these items!', cid)
   end
end

function royal(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,2487) >= 1 then
       if doPlayerRemoveItem(cid,2487,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,5887,1)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
   end
end 

function crude(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,2393) >= 1 then
       if doPlayerRemoveItem(cid,2393,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,5892,1)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
   end
end

function draconian(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,2516) >= 1 then
       if doPlayerRemoveItem(cid,2516,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,5889,1)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
  end   
end

function hell(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,2462) >= 1 then
       if doPlayerRemoveItem(cid,2462,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,5888,1)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
  end   
end

function infernal(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,5944) >= 1 then
       if doPlayerRemoveItem(cid,5944,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,6529,3)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
  end   
end

function melt(cid, message, keywords, parameters, node)
   if(not npcHandler:isFocused(cid)) then
       return false
   end
       if getPlayerItemCount(cid,9971) >= 1 then
       if doPlayerRemoveItem(cid,9971,1) then
           npcHandler:say('Here is your item!', cid)
           doPlayerAddItem(cid,13941,1)
       end
       else
           npcHandler:say('You don\'t have this item!', cid)
  end   
end

-- XVX FORGER END --

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge {piece of royal steel}, {piece of draconian steel}, {piece of hell steel}, {huge chunk of crude iron}, {infernal bolt} and {amulet}."})

local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??'})
   node1:addChildKeyword({'yes'}, amulet, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node2 = keywordHandler:addKeyword({'royal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Crown Armor for a Piece of Royal Steel?'})
   node2:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node3 = keywordHandler:addKeyword({'crude'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Sword for a Huge Chunk of Crude Iron?'})
   node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node4 = keywordHandler:addKeyword({'draconian'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield for a Piece of Draconian Steel?'})
   node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})

local node5 = keywordHandler:addKeyword({'hell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Devil Helmet for a Piece of Hell Steel?'})
   node5:addChildKeyword({'yes'}, hell, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true}) 

local node6 = keywordHandler:addKeyword({'infernal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Soul Orb for 3 Infernal Bolts?'})
   node6:addChildKeyword({'yes'}, infernal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true}) 

local node7 = keywordHandler:addKeyword({'melt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Gold Ingot for a Cup of Molten Gold?'})
   node7:addChildKeyword({'yes'}, melt, {npcHandler = npcHandler, onlyFocus = true, reset = true})
   node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true}) 


npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

Shuzin, se sua duvida e com um script você tem que postar na área 5599.pngPedidos e dúvidas - Scripting!

Você não é nenhum novato e conhece muito bem as áreas do fórum.

 

Movido p/ pedidos e duvidas resolvidos.

 

 

Obrigado pela compreensão!

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...