Ir para conteúdo

[Encerrado] Npc Pokemon Collector


dudu0014

Posts Recomendados

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

 

Link para o comentário
Compartilhar em outros sites

Talvez isso ajude você

 

 

 

 

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 1

 

local pokePrice = { --- coloque aqui cada poke :)

["Bulbasaur"] = 3000,

["Ivysaur"] = 8000,

["Venusaur"] = 18000,

["Charmander"] = 3000,

["Charmeleon"] = 8000,

["Charizard"] = 18000,

["Squirtle"] = 3000,

["Wartortle"] = 8000,

["Blastoise"] = 18000,

["Caterpie"] = 5,

["Metapod"] = 250,

["Buttefree"] = 2000,

["Weedle"] = 5,

["Kakuna"] = 250,

["Beedrill"] = 2000,

["Pidgey"] = 60,

["Pidgeotto"] = 1500,

["Pidgeot"] = 11500,

["Rattata"] = 5,

["Raticate"] = 1200,

["Spearow"] = 100,

["Fearow"] = 5100,

["Ekans"] = 300,

["Arbok"] = 3000,

["Pikachu"] = 8000,

["Raichu"] = 18000,

["Sandshrew"] = 1000,

["Sandslash"] = 6000,

["Nidoran Female"] = 125,

["Nidorina"] = 2250,

["Nidoqueen"] = 12250,

["Nidoran Male"] = 125,

["Nidorino"] = 2250,

["Nidoking"] = 12250,

["Clefairy"] = 8000,

["Clefable"] = 18000,

["Vulpix"] = 1000,

["Ninetales"] = 11000,

["Jigglypuff"] = 8000,

["Wigglytuff"] = 18000,

["Zubat"] = 120,

["Golbat"] = 3000,

["Oddish"] = 80,

["Gloom"] = 2250,

["Vileplume"] = 12000,

["Paras"] = 60,

["Parasect"] = 7250,

["Venonat"] = 1500,

["Venomoth"] = 7250,

["Diglett"] = 200,

["Dugtrio"] = 3000,

["Meowth"] = 300,

["Persian"] = 3000,

["Psyduck"] = 1500,

["Golduck"] = 11500,

["Mankey"] = 300,

["Primeape"] = 7250,

["Growlithe"] = 3500,

["Arcanine"] = 13500,

["Poliwag"] = 80,

["Poliwhirl"] = 3000,

["Poliwrath"] = 13000,

["Abra"] = 800,

["Kadabra"] = 5800,

["Alakazam"] = 15800,

["Machop"] = 2000,

["Machoke"] = 7000,

["Machamp"] = 17000,

["Bellsprout"] = 80,

["Weepinbell"] = 2250,

["Victreebel"] = 12000,

["Tentacool"] = 300,

["Tentacruel"] = 10000,

["Geodude"] = 300,

["Graveler"] = 5000,

["Golem"] = 15000,

["Ponyta"] = 1500,

["Rapidash"] = 6500,

["Slowpoke"] = 400,

["Slowbro"] = 8000,

["Magnemite"] = 400,

["Magneton"] = 5400,

["Farfetch'd"] = 8000,

["Doduo"] = 600,

["Dodrio"] = 5600,

["Seel"] = 2000,

["Dewgong"] = 12000,

["Grimer"] = 600,

["Muk"] = 8000,

["Shellder"] = 200,

["Cloyster"] = 10200,

["Gastly"] = 3000,

["Haunter"] = 8000,

["Gengar"] = 18000,

["Onix"] = 6000,

["Drowzee"] = 1000,

["Hypno"] = 6000,

["Krabby"] = 200,

["Kingler"] = 5200,

["Voltorb"] = 250,

["Electrode"] = 3000,

["Exeggcute"] = 200,

["Exeggutor"] = 10000,

["Cubone"] = 1000,

["Marowak"] = 11000,

["Hitmonlee"] = 500000,

["Hitmonchan"] = 500000,

["Licktung"] = 60000,

["Koffing"] = 500,

["Weezing"] = 3000,

["Ryhorn"] = 3000,

["Rhydon"] = 13000,

["CHansey"] = 60000,

["Tangela"] = 10000,

["Kangaskhan"] = 120000,

["Horsea"] = 200,

["Seadra"] = 5500,

["Goldeen"] = 200,

["Seaking"] = 3000,

["Staryu"] = 400,

["Starmie"] = 3000,

["Mr. Mime"] = 40000,

["Scyther"] = 120000,

["Jynx"] = 120000,

["Electabuzz"] = 120000,

["Magmar"] = 120000,

["Pinsir"] = 9000,

["Tauros"] = 9000,

["Magikarp"] = 5,

["Gyarados"] = 55000,

["Lapras"] = 3000,

["Ditto"] = 70000,

["Eevee"] = 45000,

["Vaporeon"] = 50000,

["Jolteon"] = 50000,

["Flareon"] = 50000,

["Porygon"] = 60000,

["Omanyte"] = 20000,

["Omastar"] = 75000,

["Kabuto"] = 20000,

["Kabutops"] = 75000,

["Aerodactyl"] = 2000000,

["Snorlax"] = 200000,

["Dratini"] = 15000,

["Dragonair"] = 65000,

["Dragonite"] = 125000,

 

["Chikorita"] = 3000,

["Bayleef"] = 8000,

["Meganium"] = 18000,

["Cyndaquil"] = 3000,

["Quilava"] = 8000,

["Typhlosion"] = 18000,

["Totodile"] = 3000,

["Croconaw"] = 8000,

["Feraligatr"] = 18000,

["Sentret"] = 250,

["Furret"] = 3000,

["Hoothoot"] = 1500,

["Noctowl"] = 11500,

["Ledyba"] = 250,

["Ledian"] = 3000,

["Spinarak"] = 250,

["Ariados"] = 3000,

["Crobat"] = 13000,

["Chinchou"] = 1000,

["Lanturn"] = 6000,

["Pichu"] = 3000,

["Cleffa"] = 3000,

["Igglybuff"] = 3000,

["Togepi"] = 15000,

["Togetic"] = 25000,

["Natu"] = 3000,

["Xatu"] = 13000,

["Mareep"] = 3000,

["Flaffy"] = 8000,

["Ampharos"] = 18000,

["Bellossom"] = 12000,

["Marill"] = 3000,

["Azumarill"] = 13000,

["Sudowoodo"] = 12000,

["Politoed"] = 8000,

["Hoppip"] = 80,

["Skiploom"] = 2250,

["Jumpluff"] = 12000,

["Aipom"] = 8000,

["Sunkern"] = 5,

["Sunflora"] = 5000,

["Yanma"] = 9000,

["Wooper"] = 2000,

["Quagsire"] = 12000,

["Espeon"] = 50000,

["Umbreon"] = 50000,

["Murkrow"] = 10000,

["Slowking"] = 110000,

["Misdreavus"] = 200000,

["Wobbuffet"] = 200000,

["Girafarig"] = 120000,

["Pinexo"] = 300,

["Forretress"] = 10000,

["Dunsparce"] = 3000,

["Gligar"] = 8000,

["Steelix"] = 110000,

["Snubbull"] = 2500,

["Granbull"] = 12500,

["Qwilfish"] = 10000,

["Scizor"] = 220000,

["Shuckle"] = 3500,

["Heracross"] = 120000,

["Sneasel"] = 10000,

["Teddiursa"] = 80000,

["Ursaring"] = 150000,

["Slugma"] = 1000,

["Magcargo"] = 11000,

["Corsola"] = 9000,

["Remoraid"] = 200,

["Octillery"] = 10000,

["Delibird"] = 10000,

["Mantine"] = 120000,

["Skarmory"] = 120000,

["Houndour"] = 3500,

["Houndoom"] = 13500,

["Kingdra"] = 70000,

["Phanpy"] = 3000,

["Donphan"] = 13000,

["Porygon2"] = 120000,

["Stantler"] = 10000,

["Smeargle"] = 70000,

["Tyrogue"] = 150000,

["Hitmontop"] = 500000,

["Smochun"] = 4500,

["Elekid"] = 4500,

["Magby"] = 4500,

["Miltank"] = 120000,

["Blissey"] = 100000,

["Larvitar"] = 15000,

["Pupitar"] = 65000,

["Tyranitar"] = 125000,

}

 

function sellPokemon(cid, name, price)

 

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

 

if getPlayerSlotItem(cid, 8).uid ~= 0 then

if string.lower(getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")) == string.lower(name) then

if not getItemAttribute(getPlayerSlotItem(cid, 8).uid, "unique") then

selfSay("Wow! Thanks for this wonderful "..name.."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(getPlayerSlotItem(cid, 8).uid, 1)

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) then

if not getItemAttribute(ball, "unique") then

selfSay("Wow! Obrigado por este maravilhoso "..getItemAttribute(ball, "poke").."! Tome seus "..price.." dólares. Gostaria de vender mais pokemon?")

doRemoveItem(ball, 1)

doPlayerAddMoney(cid, price * 100)

return true

end

end

end

end

 

selfSay("Você não tem o "..name..", certifique-se que está na sua mochila e não desmaiou.")

return false

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('Bem-vindo à minha loja! Eu compro pokemons de todas as espécies, apenas me diga o nome do Pokémon que você quer vender.')

focus = cid

conv = 1

talk_start = os.clock()

cost = 0

pname = ""

return true

end

 

if msgcontains(msg, 'bye') and focus == cid then

selfSay('Vejo você por aí, então!')

focus = 0

return true

end

 

if msgcontains(msg, 'yes') and focus == cid and conv == 4 then

selfSay('Diga-me o nome dos pokemon você gostaria de vender.')

conv = 1

return true

end

 

if msgcontains(msg, 'no') and conv == 4 and focus == cid then

selfSay('Ok, então nos vemos por aí!')

focus = 0

return true

end

 

 

 

if msgcontains(msg, 'no') and conv == 3 and focus == cid then

selfSay('Bem, então o que pokemon gostaria de vender?')

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("Desculpe, eu não sei o que pokemon que você está falando! Tem certeza de que soletrou corretamente?")

return true

end

 

baseprice = pokePrice[name] or math.floor(pokemon.level * 150)

 

cost = baseprice

pname = name

selfSay("Você gostaria de verde "..name.." por "..cost.." dólares?")

conv = 3

end

 

if isConfirmMsg(msg) and focus == cid and conv == 3 then

if sellPokemon(cid, pname, 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 = {"Compro alguns pokemons bonitos! Venha aqui para vendê-los!",

"Quer vender um pokemon? Veio ao lugar certo!",

"Compro pokemon! Ofertas Excelente!",

"Cansado de um pokemon? Por que você não vendê-lo para mim?",

}

 

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("Eu tenho outros clientes também, se sente e espere a venda dele acabar.")

end

 

if getDistanceToCreature(focus) > 3 then

selfSay("Adeus então e obrigado!")

focus = 0

return true

end

 

local dir = doDirectPos(npcpos, focpos)

selfTurn(dir)

end

 

 

return true

end

 

 

 

obs.: Esse meu eu editei com os preços do PxG

Editado por BobStriker
Link para o comentário
Compartilhar em outros sites

identifiquei um bug nesse script tambem ;/

ex: vo vende rattata (5dl no script)

ele paga 5 dl

agora vo vende um scyther (60k no scipt)

ele paga 8,4k ;/

 

nada?

utz, tava precisando muito do script, ngm com algum sem bug?

 

Descobri que o "bug" nao era no script, e sim no meu items.otb ;/

podem mover ja o topico ^^

Link para o comentário
Compartilhar em outros sites

Pegue o meu:

 

Crie um arquivo.lua com nome de pokemon seller em data/npc/scripts e add isso dentro:

 

 

local focus = 0

local talk_start = 0

local conv = 0

local cost = 0

local pname = ""

local baseprice = 0

 

local pokePrice = { --preço dos pokes.. 3000 = 3k..

["Bulbasaur"] = 3000,

["Ivysaur"] = 7500,

["Venusaur"] = 15000,

["Charmander"] = 3000,

["Charmeleon"] = 7500,

["Charizard"] = 15000,

["Squirtle"] = 3000,

["Wartortle"] = 7500,

["Blastoise"] = 15000,

["Caterpie"] = 10,

["Metapod"] = 250,

["Butterfree"] = 2200,

["Weedle"] = 10,

["Kakuna"] = 250,

["Beedrill"] = 2200,

["Pidgey"] = 50,

["Pidgeotto"] = 1500,

["Pidgeot"] = 8000,

["Rattata"] = 10,

["Raticate"] = 1200,

["Spearow"] = 150,

["Fearow"] = 6000,

["Ekans"] = 450,

["Arbok"] = 2500,

["Pikachu"] = 4000,

["Raichu"] = 8000,

["Sandshrew"] = 850,

["Sandslash"] = 7000,

["Nidoran Female"] = 250,

["Nidorina"] = 2000,

["Nidoqueen"] = 8000,

["Nidoran Male"] = 250,

["Nidorino"] = 2000,

["Nidoking"] = 8000,

["Clefairy"] = 3000,

["Clefable"] = 6000,

["Vulpix"] = 1200,

["Ninetales"] = 8500,

["Jigglypuff"] = 3000,

["Wigglytuff"] = 6000,

["Zubat"] = 120,

["Golbat"] = 2000,

["Oddish"] = 80,

["Gloom"] = 2500,

["Vileplume"] = 6500,

["Paras"] = 50,

["Parasect"] = 2500,

["Venonat"] = 1000,

["Venomoth"] = 4000,

["Diglett"] = 400,

["Dugtrio"] = 4000,

["Meowth"] = 1200,

["Persian"] = 4000,

["Psyduck"] = 1000,

["Golduck"] = 8000,

["Mankey"] = 600,

["Primeape"] = 5000,

["Growlithe"] = 3500,

["Arcanine"] = 10000,

["Poliwag"] = 110,

["Poliwhirl"] = 2200,

["Poliwrath"] = 8500,

["Abra"] = 800,

["Kadabra"] = 6000,

["Alakazam"] = 15000,

["Machop"] = 850,

["Machoke"] = 5000,

["Machamp"] = 10000,

["Bellsprout"] = 100,

["Weepinbell"] = 2500,

["Victreebel"] = 6500,

["Tentacool"] = 350,

["Tentacruel"] = 6000,

["Geodude"] = 500,

["Graveler"] = 2500,

["Golem"] = 8000,

["Ponyta"] = 850,

["Rapidash"] = 4500,

["Slowpoke"] = 850,

["Slowbro"] = 6000,

["Magnemite"] = 600,

["Magneton"] = 3200,

["Farfetch'd"] = 10000,

["Doduo"] = 650,

["Dodrio"] = 3200,

["Seel"] = 2000,

["Dewgong"] = 8000,

["Grimer"] = 600,

["Muk"] = 2200,

["Shellder"] = 600,

["Cloyster"] = 5500,

["Gastly"] = 3000,

["Haunter"] = 8000,

["Gengar"] = 15000,

["Onix"] = 5500,

["Drowzee"] = 1200,

["Hypno"] = 8000,

["Krabby"] = 135,

["Kingler"] = 4000,

["Voltorb"] = 510,

["Electrode"] = 3500,

["Exeggcute"] = 700,

["Exeggutor"] = 8000,

["Cubone"] = 1000,

["Marowak"] = 4000,

["Hitmonlee"] = 100000,

["Hitmonchan"] = 100000,

["Lickitung"] = 15000,

["Koffing"] = 500,

["Weezing"] = 2200,

["Rhyhorn"] = 1100,

["Rhydon"] = 6000,

["Chansey"] = 60000,

["Tangela"] = 5000,

["Kangaskhan"] = 40000,

["Horsea"] = 200,

["Seadra"] = 4000,

["Goldeen"] = 100,

["Seaking"] = 3000,

["Staryu"] = 600,

["Starmie"] = 4000,

["Mr. Mime"] = 60000,

["Scyther"] = 125000,

["Jynx"] = 40000,

["Electabuzz"] = 125000,

["Magmar"] = 125000,

["Pinsir"] = 4000,

["Tauros"] = 2500,

["Magikarp"] = 10,

["Gyarados"] = 80000,

["Lapras"] = 115000,

["Ditto"] = 75000,

["Eevee"] = 45000,

["Vaporeon"] = 50000,

["Jolteon"] = 50000,

["Flareon"] = 50000,

["Porygon"] = 40000,

["Omanyte"] = 20000,

["Omastar"] = 60000,

["Kabuto"] = 20000,

["Kabutops"] = 60000,

["Aerodactyl"] = 500000,

["Snorlax"] = 150000,

["Articuno"] = 800000,

["Zapdos"] = 800000,

["Moltres"] = 800000,

["Dratini"] = 20000,

["Dragonair"] = 50000,

["Dragonite"] = 120000,

}

 

function sellPokemon(cid, name, price)

 

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

 

if getPlayerSlotItem(cid, 8).uid ~= 0 then

if string.lower(getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")) == string.lower(name) then

if not getItemAttribute(getPlayerSlotItem(cid, 8).uid, "unique") then --alterado v1.6

selfSay("Wow! Thanks for this wonderful "..name.."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(getPlayerSlotItem(cid, 8).uid, 1) --alterado v1.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) then

if not getItemAttribute(ball, "unique") then --alterado v1.6

selfSay("Wow! Thanks for this wonderful "..getItemAttribute(ball, "poke").."! Take yours "..price.." dollars. Would you like to sell another pokemon?")

doRemoveItem(ball, 1)

doPlayerAddMoney(cid, price * 100)

return true

end

end

end

end

 

selfSay("You don't have a "..name..", make sure it is in your backpack and it is not fainted and it is not in a Unique Ball!") --alterado v1.6

return false

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 = ""

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

 

baseprice = pokePrice[name] or math.floor(pokemon.level * 150) --alterado v1.6

 

cost = baseprice

pname = name

selfSay("Are you sure you want to sell a "..name.." for "..cost.." dollars?")

conv = 3

end

 

if isConfirmMsg(msg) and focus == cid and conv == 3 then

if sellPokemon(cid, pname, 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

 

 

 

e em data/npc crie um arquivo.xml com nome q vc quiser e add isso dentro:

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Menny" script="pokemon seller.lua" walkinterval="350000" floorchange="0" speed="0">

 

<health now="150" max="150"/>

 

<look type="614" head="115" body="128" legs="106" feet="132"/>

 

</npc>

 

 

 

Não tem erros, mas se vc achar so me avisar.

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...