Ir para conteúdo

Featured Replies

Postado
  • Autor
Spoiler

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) then
return false
end
if (isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
npcHandler:say('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce não tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddEditedItem(cid, parameters.give, 1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"demon armor", items = {{2466,3},{2160,2}}, item_give = 101, chance = 30, level = 10, premium = false},
{"solar axe", items = {{2432,10},{2160,5},{8924,1}}, item_give = 8925, chance = 50, level = 15, premium = true},
{"broadsword", items = {{2376,10},{2160,2}}, item_give = 2413, chance = 90, level = 15, premium = false},
{"magic longsword", items = {{2400,5},{2393,5},{2160,5}}, item_give = 2390, chance = 90, level = 25, premium = false},
{"ice rapier", items = {{7449,2},{2160,5}}, item_give = 2396, chance = 10, level = 25, premium = false},
{"itens", text = "Eu posso te forjar alguns itens como: {demon armor},{solar axe},{broadsword} ou {magic longsword}!"}
}
for i = 1, #list do local get = list if type(get.items) == "table" then
local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " é necessário "..getItemsFromList(get.items)..". Você tem tudo isso para me dar?"})
node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium})
node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true})
else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end
mounts = nil npcHandler:addModule(FocusModule:new())

 

  • Respostas 12
  • Visualizações 982
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Veja se você tem essas funções na lib, se não tiver as coloque!   function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str =

  • deu esse erro no npc a lib 100% vlw  

Posted Images

Postado
  • Autor

foi mau entendi errado

Spoiler

<?xml version="1.0"?>
<npc name="Superior" script="Superior.lua" walkinterval="50000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="95" body="116" legs="121" feet="115" addons="3"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|.Eu posso forjar alguns {itens} itens para voce!" />
</parameters>
</npc>

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo