Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''2 em 1.''.

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Fóruns

  • xTibia - Notícias e Suporte
    • Regras
    • Noticias
    • Soluções
    • Projetos Patrocinados
    • Tutoriais para Iniciantes
    • Imprensa
  • OTServ
    • Notícias e Debates
    • OTServlist
    • Downloads
    • Recursos
    • Suporte
    • Pedidos
    • Show-Off
    • Tutoriais
  • OFF-Topic
    • Barzinho do Éks
    • Design
    • Informática

Encontrar resultados em...

Encontrar resultados que contenham...


Data de Criação

  • Início

    FIM


Data de Atualização

  • Início

    FIM


Filtrar pelo número de...

Data de Registro

  • Início

    FIM


Grupo


Sou

Encontrado 1 registro

  1. Fjinst

    Juntar dois Npcs

    Olá, gostaria de pedir um favor para vocês, tenho dois npcs aqui comigo, um que vende items só por moeda especifica e outro que vende magias abrindo o module trade Gostaria de pedir para juntar esses dois npcs no sentido que o npc que vende magia pelo trade, só venda por moeda especifica, só isso Resumindo: Npc de magia que vende a magia por moeda especifica. Segue abaixo os dois npcs que tenho Npc que vende por moeda especifica local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cidlocal itemid = 2137 -- Novos points ( default é scarab coin )local shopWindow = {}local t = { [8201] = {price = 2}, [8203] = {price = 3}, [8202] = {price = 4}, [8204] = {price = 5}, [8205] = {price = 10}, [2524] = {price = 10}, [9093] = {price = 10}, [9050] = {price = 10}, [9083] = {price = 10}, [9099] = {price = 5}, [9098] = {price = 20}, [9097] = {price = 3} }local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)if t[item] and getPlayerItemCount(cid, itemid) < t[item].price thenselfSay("you do not have "..t[item].price.." scarab coin.", cid)elsedoPlayerAddItem(cid, item)doPlayerRemoveItem(cid, itemid, (t[item].price))selfSay("Here you item", cid) endreturn trueendif (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))thenfor var, ret in pairs(t) dotable.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)})endopenShopWindow(cid, shopWindow, onBuy, onSell)endreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Npc que vende magia por modulo trade local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cidlocal shopWindow = {}local spells = {{id=2260, buy = 100, name = "Exori Mas Light", spell_name = "Exori Mas Light", vocations = {1,2,3,4,5,6,7,8}, level = 125}}local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)if not getPlayerLearnedInstantSpell(cid, shopWindow[item].Words) thenif getPlayerLevel(cid) >= shopWindow[item].Level thenif isInArray(shopWindow[item].Vocs, getPlayerVocation(cid)) thendoPlayerRemoveMoney(cid, shopWindow[item].Price)doPlayerLearnInstantSpell(cid, shopWindow[item].Words)npcHandler:say("Voce aprendeu uma magia chamada "..shopWindow[item].Words, cid)elsenpcHandler:say("Voce nao possui classe suficiente para adquirir essa magia.", cid)endelsenpcHandler:say("Voce precisa ter nivel "..shopWindow[item].Level.." ou mais para comprar essa magia.", cid)endelsenpcHandler:say("Voce ja adquiriu essa magia.", cid)endreturn trueendif msgcontains(msg, 'trade') or msgcontains(msg, 'magias') thenfor var, item in pairs(spells) doshopWindow[item.id] = {Level = item.level, Vocs = item.vocations, item_id = item.id, Price = item.buy, subType = 0, Words = item.spell_name, SpellName = item.name}endopenShopWindow(cid, spells, onBuy, onSell)endreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Ambos npcs não são de minha autoria, se eu lembrasse de qual post eu tirei, eu colocaria os creditos respectivos, enfim, agradeço pela ajuda.
×
×
  • Criar Novo...