Postado Dezembro 15, 2015 9 anos Procurei bastante aqui no TK , os que achei não funcionaram, uso PDA com Icone System. Preciso de um NPC que venda diversos pokemons por diversos preços diferentes em DIAMONDS ( id=2145 ) Tentei fazer um com base no Npc Marlon (cassino) que vende pokemons por cassino coins, consegui fazer com que venda pokemons por diamonds mas todos com o mesmo preço, não consegui colocar preços diferentes ( foi o max que consegui ) Consegui criar um npc que vende itens por diamonds, com base no NPC Dalk que vende Vip e Sex Change por diamonds, mas pokemons não consegui Copiei de outra base um TalkAction Script que da pokemons, exemplo eu digo !ditto, caso tenha o preço do ditto em diamonds, é retirado da minha bag a quantidade em diamonds e o ditto aparece na bag, mas queria um npc que fizesse isso, não uma talkaction Vou deixar os Scripts do Talkaction do Ditto , do NPC Marlon (cassino) , e do Npc Dalk pra servir de base caso alguém não saiba fazer sem ir olhando algum script de base Rep++ pra quem conseguir TALKACTION do DITTO: Spoiler local pokemon = "Ditto" local nome = {'Ditto'} -- Nome do pokemon local valor = {2145, 10} function onSay(cid, words, param, channel) if getPlayerItemCount(cid, valor[1]) >= valor[2] then doPlayerRemoveItem(cid, valor[1], valor[2]) addPokeToPlayer(cid, pokemon, 0, 1, 'normal', true) doPlayerSendTextMessage(cid, 25, "Parabens, voce acaba de adquirir um "..pokemon..".") else doPlayerSendTextMessage(cid, 25, "Voce nao tem "..valor[2].." {"..getItemNameById(valor[1]).."}.") end end SCRIPT do NPC Marlon: Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end 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 function buyPoke(cid, pokemon, price) --alterado v1.9 \/ tudo! if not pokes[pokemon] then return false end local gender = getRandomGenderByName(pokemon) local btype = "normal" local happy = 250 if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then item = doCreateItemEx(11826) else item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, 11826, 1) end doItemSetAttribute(item, "poke", pokemon) doItemSetAttribute(item, "hp", 1) doItemSetAttribute(item, "happy", happy) doItemSetAttribute(item, "gender", gender) doItemSetAttribute(item, "description", "Contains a "..pokemon..".") doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".") if (getPlayerFreeCap(cid) >= 6 and not isInArray({5, 6}, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then doPlayerSendMailByName(getCreatureName(cid), item, 1) selfSay("Your pokemon was sent to Pokemon Center!", cid) end setPlayerStorageValue(cid, 23254, getPlayerStorageValue(cid, 23254) - price) return true end local pokes = { ["eevee"] = {poke = "Eevee", price = 8500000}, ["porygon"] = {poke = "Porygon", price = 10000000}, ["togepi"] = {poke = "Togepi", price = 10000000}, ["mr. mime"] = {poke = "Mr. Mime", price = 6000000}, } local msg = tonumber(msg) and msg or msg:lower() ------------------------------------------------------------------------------ if msgcontains(msg, 'pokemon') or msgcontains(msg, 'prizes') then selfSay("I have four Pokemons to choose one among them: {Eevee}, {Porygon}, {Togepi} and {Mr. Mime}, which would you choose? ", cid) talkState[cid] = 1 return true elseif pokes[msg] and talkState[cid] == 1 then pokemon = pokes[msg] selfSay("Are you sure you want buy an ".. doCorrectString(msg) .." for ".. pokemon.price .." cassino coins?", cid) talkState[cid] = 2 return true elseif (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[cid] == 2 then if getPlayerStorageValue(cid, 23254) >= pokemon.price then selfSay("Here you are! You have just bought an "..pokemon.poke.." for "..pokemon.price.." casino coins!", cid) buyPoke(cid, pokemon.poke, pokemon.price) talkState[cid] = 0 return true else selfSay("You don't have enought cassino coins, bye", cid) talkState[cid] = 0 return true end end if (msgcontains(msg, "buy coins") or msgcontains(msg, "buy cassino coins")) and (not talkState[cid] or talkState[cid] == 0) then selfSay("So... you want to buy coins. How many? Say a number between 1 and 1000!", cid) talkState[cid] = 3 return true elseif tonumber(msg) and tonumber(msg) >= 1 and tonumber(msg) <= 1000000 and talkState[cid] == 3 then coins = tonumber(msg) price = tonumber(msg) / 500 moneyMsg = price < 1 and price*500 .. " cent(s)" or price .. " dollar(s)" selfSay("It will cost ".. moneyMsg ..", are you sure you want this?", cid) talkState[cid] = 4 return true elseif (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[cid] == 4 then if doPlayerRemoveMoney(cid, coins) then selfSay("Enjoy it with wisdom...", cid) if getPlayerStorageValue(cid, 23254) < 0 then setPlayerStorageValue(cid, 23254, 0) end setPlayerStorageValue(cid, 23254, getPlayerStorageValue(cid, 23254) + coins) talkState[cid] = 0 return true else selfSay("You don't have ".. moneyMsg .."...", cid) talkState[cid] = 0 return true end end if (msgcontains(msg, "sell coins") or msgcontains(msg, "sell cassino coins")) and (not talkState[cid] or talkState[cid] == 0) then selfSay("How many coins you want back to money? Say a number between 1 and 1000!", cid) talkState[cid] = 5 return true elseif tonumber(msg) and tonumber(msg) >= 1 and tonumber(msg) <= 1000 and talkState[cid] == 5 then coinsBack = tonumber(msg) selfSay("Do you want ".. coinsBack .." coins back to money?", cid) talkState[cid] = 6 return true elseif (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[cid] == 6 then if getPlayerStorageValue(cid, 23254) >= coinsBack then setPlayerStorageValue(cid, 23254, getPlayerStorageValue(cid, 23254) - coinsBack) doPlayerAddMoney(cid, coinsBack) selfSay("Here is your money.", cid) talkState[cid] = 0 return true else selfSay("You don't have that much of coins!", cid) talkState[cid] = 0 return true end end if (msgcontains(msg, "no") or msgcontains(msg, "nao")) then selfSay("Ok then, come back if you want something...", cid) talkState[cid] = 0 return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) SCRIPT do NPC Dalk: Spoiler 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 msg = string.lower(msg) --------- local configs = { diamondsID = 2145, --id do diamond VIP = {days = 30, cost = 10}, --days = qnts dias de VIP o player compra por vez.... cost = custo para virar VIP... SEX = {cost = 3}, --cost = custo para trocar de sexo... } if (msgcontains(msg, 'diamond account') or msgcontains(msg, 'diamond')) then selfSay("You want to buy a diamond account and be VIP for "..configs.VIP.days.." days? It will cost "..configs.VIP.cost.." diamonds!", cid) talkState[talkUser] = 2 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.VIP.cost then selfSay("Ok then, now you have "..configs.VIP.days.." days of VIP! Enjoy!", cid) doPlayerAddPremiumDays(cid, configs.VIP.days) doPlayerRemoveItem(cid, configs.diamondsID, configs.VIP.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.VIP.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif (msgcontains(msg, 'sex change') or msgcontains(msg, 'sex')) then selfSay("So you want to change of sex? It will cost "..configs.SEX.cost.." diamonds", cid) talkState[talkUser] = 3 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.SEX.cost then local sex = getPlayerSex(cid) selfSay("Ok then, now you are of the sex "..(sex == 0 and "female" or "male")..". Enjoy!", cid) doPlayerSetSex(cid, (sex == 0 and 1 or 0)) doPlayerRemoveItem(cid, configs.diamondsID, configs.SEX.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.SEX.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then selfSay("Ok then, tell me what city do you want?", cid) talkState[talkUser] = 5 return true elseif places[msg] and talkState[talkUser] == 5 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.TOWN.cost then selfSay("Done, enjoy your new city!", cid) doPlayerSetTown(cid, places[msg]) doPlayerRemoveItem(cid, configs.diamondsID, configs.TOWN.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.TOWN.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') then selfSay("Ok then, tell me again what you want...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Dezembro 16, 2015 9 anos olha eu recomendo q você faça uma box dos pokes que vc queira vender por diamante e em seguida faça um npc que venda essa box por diamond eu procurei um npc que vendesse os pokes a um tempo atrás e n encontrei, essa foi a solução que eu encontrei
Postado Dezembro 20, 2015 9 anos Autor Em 16/12/2015 11:48:13, wevertonvrb disse: olha eu recomendo q você faça uma box dos pokes que vc queira vender por diamante e em seguida faça um npc que venda essa box por diamond eu procurei um npc que vendesse os pokes a um tempo atrás e n encontrei, essa foi a solução que eu encontrei Vlw pela sugestão, eu estava fazendo isso, mas são muitos pokemons dai decidi pedir aqui, caso ninguem ajude termino de fazer as box UP Editado Dezembro 20, 2015 9 anos por samlecter (veja o histórico de edições)
Postado Abril 21, 2016 9 anos ve se esse serve data/npc/scripts > crie uma pasta.lua renomeie para > vendedorpk dentro voce coloca\/ Spoiler local config, buyPoke = { diamondId = 2145, --ID do diamond. pokemons = { ["Shiny Metagross"] = 45, --["nome_do_pokémon"] = preço, ["Shiny Tropius"] = 40, --["nome_do_pokémon"] = preço, ["Shiny Alakazam"] = 40, --["nome_do_pokémon"] = preço, ["Shiny Flygon"] = 35, --["nome_do_pokémon"] = preço, ["Shiny Steelix"] = 40, ["Shiny Tangrowth"] = 40, ["Shiny Milotic"] = 35, ["Shiny Roserade"] = 30, ["Shiny Salamence"] = 30, ["Shiny Dragonite"] = 30, ["Shiny Jynx"] = 25, ["Shiny Vileplume"] = 20, }, }, "" 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 if msgcontains(msg:lower(), "buy") or msgcontains(msg:lower(), "trade") then local str = "" for poke, price in pairs(config.pokemons) do if str == "" then str = poke.." - "..price.." diamonds" else str = str.."\n"..poke.." - "..price.." diamonds" end end selfSay("Oi,voce quer comprar pokemon? diga yes", cid) doPlayerPopupFYI(cid, "Selling:\n"..str) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "yes") then if talkState[talkUser] == 1 then selfSay("Qual nome do pokemon que voce quer comprar, com as letras iniciais maiusculas tipo Shiny Bosta.", cid) talkState[talkUser] = 2 return true elseif talkState[talkUser] == 3 then if buyPoke ~= "" then local price = config.pokemons[buyPoke] if doPlayerRemoveItem(cid, config.diamondId, price) then selfSay("Here's your "..buyPoke.."!", cid) addPokeToPlayer(cid, buyPoke, 0, 1, "normal", true) talkState[talkUser] = 0 return true else selfSay("You do not have "..price.." diamonds.", cid) talkState[talkUser] = 0 return true end end end elseif config.pokemons[msg] and talkState[talkUser] == 2 then selfSay("Voce quer comprar o "..msg.."? Por "..config.pokemons[msg].." diamonds.", cid) buyPoke = msg talkState[talkUser] = 3 return true elseif msgcontains(msg:lower(), "no") then selfSay("Then bye.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) DPS vai em data/npc/ copie um documento XML e renomeie para > vendedorpk e coloque dentro \/ Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Shop" script="vendedorpk.lua" walkinterval="3000" floorchange="0" access="5" > <health now="150" max="150"/> <look type="587" head="0" body="114" legs="114" feet="0"/> <parameters> <parameter key="message_greet" value="Bem-vindo, Diga trade veja os poks a venda, dps yes dps nome do pok e yes pronto compro "/> <parameter key="message_farewell" value="Ate a proxima."/> </parameters> </npc> Voce Troca o Nome Do Npc e Edita Os Poks eo Preço. Testa ai! Editado Abril 21, 2016 9 anos por Carlos Lindo daniel (veja o histórico de edições)
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.