Postado Agosto 13, 2014 10 anos To com um script de comprar spells por npc, mas o npc vende a magia por uma pedra feiosa lá id 2157, tem jeito de arrumar isso pro npc vender as spells por gold? 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,5},level = 1}, ["find person"] = {price = 25,vocations = {1,5},level = 1}, ["light magic missile"] = {price =30,vocations = {1,5},level = 1}, ["energy strike"] = {price =20,vocations = {1,5},level = 1}, ["flame strike"] = {price =100,vocations = {1,5},level = 1} } 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())
Postado Agosto 13, 2014 10 anos eu nao manjo muito, mas acho que é só você trocar aqui: local moeda = 2157 por : local moeda = 2160 *2160 é o ID da crystal coin!
Postado Agosto 13, 2014 10 anos Substitua por isto: 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 = 2160 local t = { ["light healing"] = {price = 15,vocations = {1,5},level = 1}, ["find person"] = {price = 25,vocations = {1,5},level = 1}, ["light magic missile"] = {price =30,vocations = {1,5},level = 1}, ["energy strike"] = {price =20,vocations = {1,5},level = 1}, ["flame strike"] = {price =100,vocations = {1,5},level = 1} } 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()) Configurando: ["light healing"] = {price = 15,vocations = {1,5},level = 1}, em price = 15 está por 150k. Cada 1 alí equivale a 10k, ou seja se deixar: {price = 2,vocations = {1,5},level = 1}, vai estar custando 20k por estar com o número 2 E Assim sucessivamente, você edita o price = NMR Espero ter ajudado.
Postado Agosto 13, 2014 10 anos Passei o sistema para a gold coins. Para editar o script basta: ["light healing"] = {price = 15,vocations = {1,5},level = 1}, Price: 15 = 15 Gold Coins (1000 = 1k, 10000 = 10k) e assim sucessivamente. 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 t = { ["light healing"] = {price = 15,vocations = {1,5},level = 1}, ["find person"] = {price = 25,vocations = {1,5},level = 1}, ["light magic missile"] = {price =30,vocations = {1,5},level = 1}, ["energy strike"] = {price =20,vocations = {1,5},level = 1}, ["flame strike"] = {price =100,vocations = {1,5},level = 1} } 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.." gold coins /" 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 doPlayerRemoveMoney(cid, 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.." gold coins.", 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())
Postado Agosto 13, 2014 10 anos Autor Passei o sistema para a gold coins. Para editar o script basta: ["light healing"] = {price = 15,vocations = {1,5},level = 1}, Price: 15 = 15 Gold Coins (1000 = 1k, 10000 = 10k) e assim sucessivamente. 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 t = { ["light healing"] = {price = 15,vocations = {1,5},level = 1}, ["find person"] = {price = 25,vocations = {1,5},level = 1}, ["light magic missile"] = {price =30,vocations = {1,5},level = 1}, ["energy strike"] = {price =20,vocations = {1,5},level = 1}, ["flame strike"] = {price =100,vocations = {1,5},level = 1} } 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.." gold coins /" 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 doPlayerRemoveMoney(cid, 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.." gold coins.", 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()) Obrigado tony araujo, era desse jeito que eu queria, dos outros não ia funcionar bem pq, só ia dar pra vender com crystal coin, ai se o cara n tive-se platinum n ia pegar, mas vou dar 1 rep pra cada um e pra vc dou 3 Se vc me ajudar numa coisa te dou +3, pq ta muito zuado um kina vai lá fala hi spells aparece todas as spells Tem como colocar pra mostrar só as spells do vocation da pessoa?
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.