Opa,
Queria um npc que comprasse pokemon mais com um preço tabelado \/, um preço que independente do level do pokemon vai ser sempre esse.
["Bulbasaur"] = 3000,
["Ivysaur"] = 8000,
["Venusaur"] = 18000,
["Charmander"] = 3000,
["Charmeleon"] = 8000,
["Charizard"] = 18000,
["Squirtle"] = 3000,
["Wartortle"] = 8000,
["Blastoise"] = 13000,
["Caterpie"] = 50,
["Metapod"] = 500,
["Butterfree"] = 2000,
["Weedle"] = 50,
["Kakuna"] = 500,
["Beedrill"] = 2000,
["Pidgey"] = 100,
["Pidgeotto"] = 2000,
["Pidgeot"] = 12000,
["Rattata"] = 5,
["Raticate"] = 3000,
["Spearow"] = 200,
["Fearow"] = 6000,
["Ekans"] = 500,
["Arbok"] = 3000,
["Pikachu"] = 8000,
["Raichu"] = 18000,
["Sandshrew"] = 1000,
["Sandslash"] = 11000,
["Nidoran Female"] = 300,
["Nidorina"] = 3000,
["Nidoqueen"] = 13000,
["Nidoran Male"] = 300,
["Nidorino"] = 3000,
["Nidoking"] = 13000,
["Clefairy"] = 4000,
["Clefable"] = 10000,
["Vulpix"] = 1000,
["Ninetales"] = 11000,
["Jigglypuff"] = 4000,
["Wigglytuff"] = 10000,
["Zubat"] = 300,
["Golbat"] = 3000,
["Oddish"] = 100,
["Gloom"] = 3000,
["Vileplume"] = 12000,
["Paras"] = 100,
["Parasect"] = 8000,
["Venonat"] = 2000,
["Venomoth"] = 7000,
["Diglett"] = 200,
["Dugtrio"] = 4000,
["Meowth"] = 300,
["Persian"] = 4000,
["Psyduck"] = 2000,
["Golduck"] = 12000,
["Mankey"] = 300,
["Primeape"] = 8000,
["Growlithe"] = 4000,
["Arcanine"] = 14000,
["Poliwag"] = 500,
["Poliwhirl"] = 3000,
["Poliwrath"] = 13000,
["Abra"] = 1000,
["Kadabra"] = 6000,
["Alakazam"] = 16000,
["Machop"] = 2000,
["Machoke"] = 7000,
["Machamp"] = 17000,
["Bellsprout"] = 100,
["Weepinbell"] = 3000,
["Victreebel"] = 12000,
["Tentacool"] = 300,
["Tentacruel"] = 11000,
["Geodude"] = 300,
["Graveler"] = 5000,
["Golem"] = 15000,
["Ponyta"] = 2000,
["Rapidash"] = 7000,
["Slowpoke"] = 500,
["Slowbro"] = 8000,
["Magnemite"] = 500,
["Magneton"] = 6000,
["Doduo"] = 600,
["Dodrio"] = 6000,
["Seel"] = 2000,
["Dewgong"] = 12000,
["Grimer"] = 300,
["Muk"] = 8000,
["Shellder"] = 500,
["Cloyster"] = 11000,
["Gastly"] = 3000,
["Haunter"] = 8000,
["Gengar"] = 18000,
["Onix"] = 6000,
["Drowzee"] = 1000,
["Hypno"] = 8000,
["Krabby"] = 500,
["Kingler"] = 6000,
["Voltorb"] = 1000,
["Electrode"] = 6000,
["Exeggcute"] = 500,
["Exeggutor"] = 10000,
["Cubone"] = 1000,
["Marowak"] = 11000,
["Hitmonlee"] = 500000,
["Hitmonchan"] = 500000,
["Lickitung"] = 18000,
["Koffing"] = 500,
["Weezing"] = 6000,
["Rhyhorn"] = 2000,
["Rhydon"] = 13000,
["Chansey"] = 30000,
["Tangela"] = 10000,
["Kangaskhan"] = 50000,
["Horsea"] = 500,
["Seadra"] = 6000,
["Goldeen"] = 500,
["Seaking"] = 6000,
["Farfetch'd"] = 10000,
["Staryu"] = 800,
["Starmie"] = 6000,
["Mr. Mime"] = 30000,
["Scyther"] = 60000,
["Jynx"] = 30000,
["Electabuzz"] = 60000,
["Magmar"] = 60000,
["Pinsir"] = 10000,
["Tauros"] = 5000,
["Magikarp"] = 100,
["Gyarados"] = 60000,
["Lapras"] = 60000,
["Ditto"] = 70000,
["Eevee"] = 10000,
["Vaporeon"] = 15000,
["Jolteon"] = 15000,
["Flareon"] = 15000,
["Porygon"] = 30000,
["Omanyte"] = 20000,
["Omastar"] = 30000,
["Kabuto"] = 20000,
["Kabutops"] = 30000,
["Aerodactyl"] = 1000000,
["Snorlax"] = 100000,
["Articuno"] = 3000000,
["Zapdos"] = 3000000,
["Moltres"] = 3000000,
["Dratini"] = 15000,
["Dragonair"] = 30000,
["Dragonite"] = 50000,
["Mewtwo"] = 5000000,
["Mew"] = 5000000,
--Johto
["Chikorita"] = 3000,
["Bayleef"] = 8000,
["Meganium"] = 18000,
["Cyndaquil"] = 3000,
["Quilava"] = 8000,
["Typhlosion"] = 18000,
["Totodile"] = 3000,
["Croconaw"] = 8000,
["Feraligatr"] = 18000,
["Sentret"] = 300,
["Furret"] = 4000,
["Hoothoot"] = 2000,
["Noctowl"] = 12000,
["Ledyba"] = 300,
["Ledian"] = 4000,
["Spinarak"] = 300,
["Ariados"] = 4000,
["Crobat"] = 13000,
["Chinchou"] = 1000,
["Lanturn"] = 6000,
["Pichu"] = 3000,
["Cleffa"] = 3000,
["Igglybuff"] = 3000,
["Togepi"] = 15000,
["Togetic"] = 25000,
["Natu"] = 3000,
["Xatu"] = 13000,
["Mareep"] = 3000,
["Flaaffy"] = 8000,
["Ampharos"] = 18000,
["Bellossom"] = 12000,
["Marill"] = 3000,
["Azumarill"] = 13000,
["Sudowoodo"] = 50000,
["Politoed"] = 8000,
["Hoppip"] = 100,
["Skiploom"] = 3000,
["Jumpluff"] = 12000,
["Aipom"] = 8000,
["Sunkern"] = 100,
["Sunflora"] = 6000,
["Yanma"] = 9000,
["Wooper"] = 2000,
["Quagsire"] = 12000,
["Espeon"] = 30000,
["Umbreon"] = 30000,
["Murkrow"] = 20000,
["Slowking"] = 50000,
["Misdreavus"] = 50000,
["Unown"] = 500000,
["Wobbuffet"] = 30000,
["Girafarig"] = 60000,
["Pineco"] = 500,
["Forretress"] = 10000,
["Dunsparce"] = 3000,
["Gligar"] = 10000,
["Steelix"] = 60000,
["Snubbull"] = 3000,
["Granbull"] = 13000,
["Qwilfish"] = 10000,
["Scizor"] = 120000,
["Shuckle"] = 4000,
["Heracross"] = 40000,
["Sneasel"] = 10000,
["Teddiursa"] = 10000,
["Ursaring"] = 60000,
["Slugma"] = 2000,
["Magcargo"] = 12000,
["Swinub"] = 2000,
["Piloswine"] = 12000,
["Corsola"] = 9000,
["Remoraid"] = 200,
["Octillery"] = 10000,
["Delibird"] = 10000,
["Mantine"] = 50000,
["Skarmory"] = 50000,
["Houndour"] = 4000,
["Houndoom"] = 14000,
["Kingdra"] = 50000,
["Phanpy"] = 4000,
["Donphan"] = 14000,
["Porygon2"] = 60000,
["Stantler"] = 10000,
["Smeargle"] = 10000,
["Tyrogue"] = 300000,
["Hitmontop"] = 500000,
["Smoochum"] = 5000,
["Elekid"] = 5000,
["Magby"] = 5000,
["Miltank"] = 50000,
["Blissey"] = 50000,
["Raikou"] = 5000000,
["Entei"] = 5000000,
["Suicune"] = 5000000,
["Larvitar"] = 15000,
["Pupitar"] = 30000,
["Tyranitar"] = 50000,
["Lugia"] = 5000000,
["Ho-oh"] = 5000000,
["Celebi"] = 5000000,
eu tentei modificar o npc que veio com o pda, mais nao deu certo, o preço da tabela acima era por level ou seja
elekid level 1 é 5k
level 100 é 500k, porém isso quando voce tem 2 pokemon igual na bag e ta tentando vende 1 deles. Quando tem só 1 na bag, independente do level é o preço da tabela.
So fui notar esse "bug" quando ja tinha feito a tabela ali ;X
entao, se alguma boa alma puder me arrumar um npc ou até mesmo arrumar esse "bug" no collector que vem com o pda, eu agradeço.
Obrigado
Npc collector pda
local focus = 0
local talk_start = 0
local conv = 0
local cost = 0
local pname = ""
local levels = ""
local soldlevel = 0
local baseprice = 0
local pokePrice = { --preço dos pokes.. 3000 = 3k..
["Bulbasaur"] = 3000, --PS: teve mais coisas mudadas entao.. peguem o script todo!
["Ivysaur"] = 4500, --alterado v2.6
["Venusaur"] = 12000,
}
function sellPokemon(cid, name, level, price)
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
if getPlayerSlotItem(cid, 8).uid ~= 0 then
local ball = getPlayerSlotItem(cid, 8).uid
if string.lower(getItemAttribute(ball, "poke")) == string.lower(name) and getItemAttribute(ball, "level") == level then
if not getItemAttribute(ball, "unique") then --alterado v2.6
selfSay("Wow! Thanks for this wonderful "..getItemAttribute(ball, "poke").." level "..getItemAttribute(ball, "level").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")
doRemoveItem(getPlayerSlotItem(cid, 8).uid, 1) --alterado v2.6
doPlayerAddMoney(cid, price * 100)
doTransformItem(getPlayerSlotItem(cid, CONST_SLOT_LEGS).uid, 2395)
return true
end
end
end
for a, b in pairs(pokeballs) do
local balls = getItemsInContainerById(bp.uid, b.on)
for _, ball in pairs (balls) do
if string.lower(getItemAttribute(ball, "poke")) == string.lower(name) and getItemAttribute(ball, "level") == level then
if not getItemAttribute(ball, "unique") then --alterado v2.6
selfSay("Wow! Thanks for this wonderful "..getItemAttribute(ball, "poke").." level "..getItemAttribute(ball, "level").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")
doRemoveItem(ball, 1)
doPlayerAddMoney(cid, price * 100)
end
return true
end
end
end
selfSay("You don't have a "..name.." at level "..level..", make sure it is in your backpack and it is not fainted and it is not in a Unique Ball!")
return false --alterado v2.6
end
function doSearchForPokemon(cid, name)
local ret = {}
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
for a, b in pairs(pokeballs) do
local balls = getItemsInContainerById(bp.uid, b.on)
for _, ball in pairs (balls) do
if string.lower(getItemAttribute(ball, "poke")) == string.lower(name) then
table.insert(ret, getItemAttribute(ball, "level"))
end
end
end
return ret
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if string.find(msg, "!") or string.find(msg, ",") then
return true
end
if focus == cid then
talk_start = os.clock()
end
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 3 then
selfSay('Welcome to my store! I buy pokemons of all species, just tell me the name of the pokemon you want to sell.')
focus = cid
conv = 1
talk_start = os.clock()
cost = 0
pname = ""
levels = ""
soldlevel = 0
return true
end
if msgcontains(msg, 'bye') and focus == cid then
selfSay('See you around then!')
focus = 0
return true
end
if msgcontains(msg, 'yes') and focus == cid and conv == 4 then
selfSay('Tell me the name of the pokemon you would like to sell.')
conv = 1
return true
end
if msgcontains(msg, 'no') and conv == 4 and focus == cid then
selfSay('Ok, see you around then!')
focus = 0
return true
end
local common = {"rattata", "caterpie", "weedle", "magikarp"}
if conv == 1 and focus == cid then
for a = 1, #common do
if msgcontains(msg, common[a]) then
selfSay('I dont buy such a common pokemon!')
return true
end
end
end
if msgcontains(msg, 'no') and conv == 3 and focus == cid then
selfSay('Well, then what pokemon would you like to sell?')
conv = 1
return true
end
if (conv == 1 or conv == 4) and focus == cid then
local name = doCorrectPokemonName(msg)
local pokemon = pokes[name]
if not pokemon then
selfSay("Sorry, I don't know what pokemon you're talking about! Are you sure you spelled it correctly?")
return true
end
--alterado v2.6
baseprice = pokePrice[name] or math.floor(pokemon.level * 1.5) -- preço baseado na tabela ou no level base
local lvls = doSearchForPokemon(cid, name)
if #lvls <= 0 then
selfSay("Hey, you don't seem to have any "..name.." inside your backpack, make sure it is not fainted.")
return true
end
if #lvls >= 2 then
local answer = "You have more than one "..name..", they are at level "
levels = ""
for a = 1, #lvls do
if a == #lvls then
answer = answer.." and "..lvls[a]..". Tell me the level of which one you would like to sell."
elseif a == 1 then
answer = answer..""..lvls[a]..""
else
answer = answer..", "..lvls[a]..""
end
levels = levels.."."..lvls[a].."."
end
selfSay(answer)
pname = name
conv = 2
return true
else
cost = pokePrice[name] or baseprice * lvls[1] --alterado v2.6
pname = name
selfSay("You have only one "..name..", and it is at level "..lvls[1]..", are you sure you want to sell it for "..cost.." dollars?")
soldlevel = lvls[1]
conv = 3
return true
end
end
if focus == cid and conv == 2 then
if tonumber(msg) == nil then
selfSay("Tell me the level of the "..pname.." you want to sell!")
elseif string.find(levels, "."..msg..".") then
cost = baseprice * tonumber(msg)
selfSay("So, you want to sell a "..pname.." at level "..msg.." for "..cost.." dollars, is that right?")
soldlevel = tonumber(msg)
conv = 3
else
selfSay("You don't have a "..pname.." at that level sir.")
end
return true
end
if isConfirmMsg(msg) and focus == cid and conv == 3 then
if sellPokemon(cid, pname, soldlevel, cost) then
conv = 4
else
conv = 1
end
return true
end
end
local intervalmin = 38
local intervalmax = 70
local delay = 25
local number = 1
local messages = {"Buying some beautiful pokemons! Come here to sell them!",
"Wanna sell a pokemon? Came to the right place!",
"Buy pokemon! Excellent offers!",
"Tired of a pokemon? Why don't you sell it to me then?",
}
function onThink()
if focus == 0 then
selfTurn(1)
delay = delay - 0.5
if delay <= 0 then
selfSay(messages[number])
number = number + 1
if number > #messages then
number = 1
end
delay = math.random(intervalmin, intervalmax)
end
return true
else
if not isCreature(focus) then
focus = 0
return true
end
local npcpos = getThingPos(getThis())
local focpos = getThingPos(focus)
if npcpos.z ~= focpos.z then
focus = 0
return true
end
if (os.clock() - talk_start) > 70 then
focus = 0
selfSay("I have other clients too, talk to me when you feel like selling a pokemon.")
end
if getDistanceToCreature(focus) > 3 then
selfSay("Good bye then and thanks!")
focus = 0
return true
end
local dir = doDirectPos(npcpos, focpos)
selfTurn(dir)
end
return true
end