458621 1 Postado Março 8, 2012 Share Postado Março 8, 2012 Olá galerinha do Xtibia, Queria 1 NPC que o Player comprar 1 Spells. Exemplo comprar a spells - Housenka por 15 vip coins. o id eu que ageito. ai o player falar Housenka ai a magia vai , se não comprar não vai. REP + Durante 1 semana. VLW! Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/ Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 8, 2012 Share Postado Março 8, 2012 (editado) spell_seller.lua 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 local moeda = 2157 local t = { ["light healing"] = {price = 15,vocations = {1,2,3,4},level = 9}, ["find person"] = {price = 25,vocations = {3,4},level = 8}, ["light magic missile"] = {price =30,vocations = {1,5,7,8},level = 15}, ["energy strike"] = {price =20,vocations = {1,2,5,6},level = 12}, ["flame strike"] = {price =100,vocations = {1,2,5,6},level = 12} } if (msgcontains(msg, 'SPELLS') or msgcontains(msg, 'spells'))then local str = "" str = str .. "Eu vendo estas Magias: " for name, pos in pairs(t) do str = str.." {"..name.."} = "..pos.price.." Moedas /" end str = str .. "." npcHandler:say(str, cid) elseif t[msg] then if not getPlayerLearnedInstantSpell(cid, msg) then if getPlayerLevel(cid) >= t[msg].level then if isInArray(t[msg].vocations, getPlayerVocation(cid)) then if doPlayerRemoveItem(cid,moeda,t[msg].price) then doPlayerLearnInstantSpell(cid, msg) npcHandler:say("Você aprendeu uma nova magia chamada ".. msg .."!", cid) else npcHandler:say("você não tem "..t[msg].price.." ".. getItemNameById(moeda), cid) end else npcHandler:say("você não tem a vocação para comprar está spell.", cid) end else npcHandler:say("você precisa ter level "..t[msg].level.." ou mais para comprar essa magia.", cid) end else npcHandler:say("você já aprendeu essa magia.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Você adiciona e configura as spells que serão vendidas aqui: local t = { ["light Healing"] = {price = 15,vocations = {1,2,3,4},level = 9}, ["find person"] = {price = 25,vocations = {3,4},level = 8}, ["light magic missile"] = {price =30,vocations = {1,5,7,8},level = 15}, ["energy strike"] = {price =20,vocations = {1,2,5,6},level = 12}, ["flame strike"] = {price =100,vocations = {1,2,5,6},level = 12} } ["nome da spell"] ={price = Quantos Coins vão custar,vocations ={ID DAS VOC},level = level para aprender a magia} NOME DO SEU NPC.xml <?xml version="1.0"?> <npc name="NOME DO SEU NPC" script="data/npc/scripts/spell_seller.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="Hello |PLAYERNAME|. Quer comprar algumas {spells} ?" /> </parameters> </npc> e para usar a magia só quem comprou você faz o seguinte vai em Spells.xml e na tag da sua magia vc coloca needlearn="1" needlearn="1" -- precisa aprender para usar a magia needlearn="0" -- n precisa aprender para usar a magia Editado Março 9, 2012 por Vodkart Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213569 Compartilhar em outros sites More sharing options...
0 458621 1 Postado Março 8, 2012 Autor Share Postado Março 8, 2012 (editado) mais como eu mudo em vez do price~ bota assim ID = vip coins exemplo =)? mais eu ja te dei o REP. Mais ajuda ae. Editado Março 8, 2012 por 458621 Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213671 Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 8, 2012 Share Postado Março 8, 2012 o price no caso quantas moedas(Vip coins) irão custar! e o id da moeda você muda aqui: local moeda = 2157 vc coloca o id da suas vips coins ali Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213678 Compartilhar em outros sites More sharing options...
0 458621 1 Postado Março 8, 2012 Autor Share Postado Março 8, 2012 Local Item = ? porque se for outro item sem ser moeda não vai da certo néah? mais não pode colocar Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213709 Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 8, 2012 Share Postado Março 8, 2012 ? Você coloca o id da sua vip coin ali certo? digamos que seja o id 8762... local moeda = 8762 e só vai dar para comprar a magia com essa coin(id 8762) ou existe outros tipos de moeda? Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213733 Compartilhar em outros sites More sharing options...
0 458621 1 Postado Março 9, 2012 Autor Share Postado Março 9, 2012 tava assim : local moeda = 7460 ai eu troco para local moeda = 7598 funciona? tipo se eu quiser vender por outro ID exemplo, tá vendendo por 7460 não sei que item é esse, mais é exemplo, ai os mlks axa 1 bixo qe dropa ,1 não 1 monte, ai irá da trabalho, para eu trocar botar 7598 ai Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213744 Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 9, 2012 Share Postado Março 9, 2012 tava assim : local moeda = 7460 ai eu troco para local moeda = 7598 funciona? tipo se eu quiser vender por outro ID exemplo, tá vendendo por 7460 não sei que item é esse, mais é exemplo, ai os mlks axa 1 bixo qe dropa ,1 não 1 monte, ai irá da trabalho, para eu trocar botar 7598 ai Funciona. mas você quer que as spells sejam vendidas por mais de um item? que o npc aceite 2 tipos de moeda,exemplo: que aceite a moeda 7460 e 7598? Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213747 Compartilhar em outros sites More sharing options...
0 458621 1 Postado Março 9, 2012 Autor Share Postado Março 9, 2012 sim tmb mais eu não tenho certeza que vou usar. Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213762 Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 9, 2012 Share Postado Março 9, 2012 ok qndo vc decidir me avisa abraços Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213767 Compartilhar em outros sites More sharing options...
0 458621 1 Postado Março 9, 2012 Autor Share Postado Março 9, 2012 você sabe vender spells pelo gesior? site? de verdade eu queria isso, mais não achei, mais se sabe? Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213771 Compartilhar em outros sites More sharing options...
0 Vodkart 1515 Postado Março 9, 2012 Share Postado Março 9, 2012 (editado) nem sei cara nao mexo cm php ta ai o npc que aceita 2 moedas: 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 local moedas = {2157,9020} local t = { ["light healing"] = {price = 15,vocations = {1,2,3,4},level = 9}, ["find person"] = {price = 25,vocations = {3,4},level = 8}, ["light magic missile"] = {price =30,vocations = {1,5,4,7,8},level = 15}, ["energy strike"] = {price =20,vocations = {1,2,5,6},level = 12}, ["flame strike"] = {price =100,vocations = {1,2,5,6},level = 12} } if (msgcontains(msg, 'SPELLS') or msgcontains(msg, 'spells'))then local str = "" str = str .. "Eu vendo estas Magias: " for name, pos in pairs(t) do str = str.." {"..name.."} = "..pos.price.." Moedas /" end str = str .. "." npcHandler:say(str, cid) elseif t[msg] then if not getPlayerLearnedInstantSpell(cid, msg) then if getPlayerLevel(cid) >= t[msg].level then if isInArray(t[msg].vocations, getPlayerVocation(cid)) then if doPlayerRemoveItem(cid,moedas[1],t[msg].price) or doPlayerRemoveItem(cid,moedas[2],t[msg].price) then doPlayerLearnInstantSpell(cid, msg) npcHandler:say("Você aprendeu uma nova magia chamada ".. msg .."!", cid) else npcHandler:say("você precisa de "..t[msg].price.." ".. getItemNameById(moedas[1]).." ou "..t[msg].price.." ".. getItemNameById(moedas[2]), cid) end else npcHandler:say("você não tem a vocação para comprar está spell.", cid) end else npcHandler:say("você precisa ter level "..t[msg].level.." ou mais para comprar essa magia.", cid) end else npcHandler:say("você já aprendeu essa magia.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Março 9, 2012 por Vodkart Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1213774 Compartilhar em outros sites More sharing options...
0 mw0xxt 0 Postado Maio 3, 2021 Share Postado Maio 3, 2021 vod Em 08/03/2012 em 21:35, Vodkart disse: nem sei cara nao mexo cm php ta ai o npc que aceita 2 moedas: 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 local moedas = {2157,9020} local t = { ["light healing"] = {price = 15,vocations = {1,2,3,4},level = 9}, ["find person"] = {price = 25,vocations = {3,4},level = 8}, ["light magic missile"] = {price =30,vocations = {1,5,4,7,8},level = 15}, ["energy strike"] = {price =20,vocations = {1,2,5,6},level = 12}, ["flame strike"] = {price =100,vocations = {1,2,5,6},level = 12} } if (msgcontains(msg, 'SPELLS') or msgcontains(msg, 'spells'))then local str = "" str = str .. "Eu vendo estas Magias: " for name, pos in pairs(t) do str = str.." {"..name.."} = "..pos.price.." Moedas /" end str = str .. "." npcHandler:say(str, cid) elseif t[msg] then if not getPlayerLearnedInstantSpell(cid, msg) then if getPlayerLevel(cid) >= t[msg].level then if isInArray(t[msg].vocations, getPlayerVocation(cid)) then if doPlayerRemoveItem(cid,moedas[1],t[msg].price) or doPlayerRemoveItem(cid,moedas[2],t[msg].price) then doPlayerLearnInstantSpell(cid, msg) npcHandler:say("Você aprendeu uma nova magia chamada ".. msg .."!", cid) else npcHandler:say("você precisa de "..t[msg].price.." ".. getItemNameById(moedas[1]).." ou "..t[msg].price.." ".. getItemNameById(moedas[2]), cid) end else npcHandler:say("você não tem a vocação para comprar está spell.", cid) end else npcHandler:say("você precisa ter level "..t[msg].level.." ou mais para comprar essa magia.", cid) end else npcHandler:say("você já aprendeu essa magia.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) vodkart estou com um problema poq quando vou abilitar a skill no npc ele diz a magia , e não compra como faço pra resolver isso? Link para o comentário https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/#findComment-1765183 Compartilhar em outros sites More sharing options...
Pergunta
458621 1
Olá galerinha do Xtibia,
Queria 1 NPC que o Player comprar 1 Spells.
Exemplo comprar a spells - Housenka por 15 vip coins. o id eu que ageito.
ai o player falar Housenka ai a magia vai , se não comprar não vai.
REP + Durante 1 semana.
VLW!
Link para o comentário
https://xtibia.com/forum/topic/182098-pedido-script-860-npc-que-vende-spells-por-item/Compartilhar em outros sites
12 respostass a esta questão
Posts Recomendados