procura por..
["Sunflora"] = 5000
deche assim..
["Sunflora"] = 5000,
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

procura por..
["Sunflora"] = 5000
deche assim..
["Sunflora"] = 5000,
info
Grupo: Herói
Registrado: 12/06/12
Posts: 2.2k
Reputação: +739
Gênero: Masculino
Char no Tibia: Supreme Player

usa esse aki fera!
local focus = 0
local talk_start = 0
local conv = 0
local cost = 0
local pname = ""
local baseprice = 0
local pokePrice = {
["Bulbasaur"] = 3000,
["Ivysaur"] = 8000, --alterado v1.6
["Venusaur"] = 18000,
["Charmander"] = 3000,
["Charmeleon"] = 8000,
["Charizard"] = 18000,
["Squirtle"] = 3000,
["Wartortle"] = 8000,
["Blastoise"] = 18000,
["Caterpie"] = 5,
["Metapod"] = 250,
["Butterfree"] = 2000,
["Weedle"] = 5,
["Kakuna"] = 250,
["Beedrill"] = 2000,
["Pidgey"] = 60,
["Pidgeotto"] = 1500,
["Pidgeot"] = 11500,
["Rattata"] = 5,
["Raticate"] = 2000,
["Spearow"] = 100,
["Fearow"] = 5100,
["Ekans"] = 300,
["Arbok"] = 3000,
["Pikachu"] = 8000,
["Raichu"] = 18000,
["Sandshrew"] = 1000,
["Sandslash"] = 11000,
["Nidoranfe"] = 125,
["Nidorina"] = 2250,
["Nidoqueen"] = 12250,
["Nidoranma"] = 125,
["Nidorino"] = 2250,
["Nidoking"] = 12250,
["Clefairy"] = 8000,
["Clefable"] = 18000,
["Vulpix"] = 1000,
["Ninetales"] = 11000,
["Jigglypuff"] = 8000,
["Wigglytuff"] = 18000,
["Zubat"] = 120,
["Golbat"] = 2000,
["Oddish"] = 80,
["Gloom"] = 2250,
["Vileplume"] = 12000,
["Paras"] = 60,
["Parasect"] = 7250,
["Venonat"] = 1500,
["Venomoth"] = 7250,
["Diglett"] = 200,
["Dugtrio"] = 3000,
["Psyduck"] = 1500,
["Golduck"] = 11500,
["Mankey"] = 300,
["Primeape"] = 7250,
["Growlithe"] = 3500,
["Arcanine"] = 58500,
["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"] = 300,
["Muk"] = 11000,
["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"] = 5000000,
["Hitmonchan"] = 5000000,
["Lickitung"] = 60000,
["Koffing"] = 300,
["Weezing"] = 3000,
["Rhyhorn"] = 3000,
["Rhydon"] = 13000,
["Chansey"] = 40000,
["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"] = 5000,
["Magikarp"] = 5,
["Gyarados"] = 55000,
["Lapras"] = 120000,
["Ditto"] = 150000,
["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,
["Mewtwo"] = 6000000000,
["Mew"] = 6000000000,
["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"] = 58000,
["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"] = 120000,
["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,
["Unown"] = 5000000,
["Wobbuffet"] = 200000,
["Girafarig"] = 120000,
["Pineco"] = 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,
["Swinub"] = 1000,
["Piloswine"] = 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"] = 10000,
["Tyrogue"] = 150000,
["Hitmontop"] = 500000,
["Smoochum"] = 4500,
["Elekid"] = 4500,
["Magby"] = 4500,
["Miltank"] = 120000,
["Blissey"] = 100000,
["Larvitar"] = 15000,
["Pupitar"] = 65000,
["Tyranitar"] = 125000,
["Moltres"] = 60000000000,
["Articuno"] = 60000000000,
["Zapdos"] = 60000000000,
}
function sellPokemon(cid, name, price)
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
if #getCreatureSummons(cid) >= 1 then
selfSay("Back your pokemon to do that!")
focus = 0 --alterado v1.8
return true
end
local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8
for s = 1, #storages do
if getPlayerStorageValue(cid, storages) >= 1 then
selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")
focus = 0
return true
end
end
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
info
Grupo: Artesão
Registrado: 15/03/13
Posts: 126
Reputação: +34
Char no Tibia: No Have

Sua Dúvida Do Tópico Esta Sanada??
Caso Esteja Por Favor Péssa o Fechamento Do Mesmo.
Amigo, Ajude A Melhorar A Organização Do Xtibia.
info
Grupo: Herói
Registrado: 12/06/12
Posts: 2.2k
Reputação: +739
Gênero: Masculino
Char no Tibia: Supreme Player

fera não precisa ficar perguntando quando ele falar que ja foi senada ai sim Pode reportar! isso é flood
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

usa esse aki fera!
local focus = 0
local talk_start = 0
local conv = 0
local cost = 0
local pname = ""
local baseprice = 0
local pokePrice = {
["Bulbasaur"] = 3000,
["Ivysaur"] = 8000, --alterado v1.6
["Venusaur"] = 18000,
["Charmander"] = 3000,
["Charmeleon"] = 8000,
["Charizard"] = 18000,
["Squirtle"] = 3000,
["Wartortle"] = 8000,
["Blastoise"] = 18000,
["Caterpie"] = 5,
["Metapod"] = 250,
["Butterfree"] = 2000,
["Weedle"] = 5,
["Kakuna"] = 250,
["Beedrill"] = 2000,
["Pidgey"] = 60,
["Pidgeotto"] = 1500,
["Pidgeot"] = 11500,
["Rattata"] = 5,
["Raticate"] = 2000,
["Spearow"] = 100,
["Fearow"] = 5100,
["Ekans"] = 300,
["Arbok"] = 3000,
["Pikachu"] = 8000,
["Raichu"] = 18000,
["Sandshrew"] = 1000,
["Sandslash"] = 11000,
["Nidoranfe"] = 125,
["Nidorina"] = 2250,
["Nidoqueen"] = 12250,
["Nidoranma"] = 125,
["Nidorino"] = 2250,
["Nidoking"] = 12250,
["Clefairy"] = 8000,
["Clefable"] = 18000,
["Vulpix"] = 1000,
["Ninetales"] = 11000,
["Jigglypuff"] = 8000,
["Wigglytuff"] = 18000,
["Zubat"] = 120,
["Golbat"] = 2000,
["Oddish"] = 80,
["Gloom"] = 2250,
["Vileplume"] = 12000,
["Paras"] = 60,
["Parasect"] = 7250,
["Venonat"] = 1500,
["Venomoth"] = 7250,
["Diglett"] = 200,
["Dugtrio"] = 3000,
["Psyduck"] = 1500,
["Golduck"] = 11500,
["Mankey"] = 300,
["Primeape"] = 7250,
["Growlithe"] = 3500,
["Arcanine"] = 58500,
["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"] = 300,
["Muk"] = 11000,
["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"] = 5000000,
["Hitmonchan"] = 5000000,
["Lickitung"] = 60000,
["Koffing"] = 300,
["Weezing"] = 3000,
["Rhyhorn"] = 3000,
["Rhydon"] = 13000,
["Chansey"] = 40000,
["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"] = 5000,
["Magikarp"] = 5,
["Gyarados"] = 55000,
["Lapras"] = 120000,
["Ditto"] = 150000,
["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,
["Mewtwo"] = 6000000000,
["Mew"] = 6000000000,
["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"] = 58000,
["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"] = 120000,
["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,
["Unown"] = 5000000,
["Wobbuffet"] = 200000,
["Girafarig"] = 120000,
["Pineco"] = 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,
["Swinub"] = 1000,
["Piloswine"] = 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"] = 10000,
["Tyrogue"] = 150000,
["Hitmontop"] = 500000,
["Smoochum"] = 4500,
["Elekid"] = 4500,
["Magby"] = 4500,
["Miltank"] = 120000,
["Blissey"] = 100000,
["Larvitar"] = 15000,
["Pupitar"] = 65000,
["Tyranitar"] = 125000,
["Moltres"] = 60000000000,
["Articuno"] = 60000000000,
["Zapdos"] = 60000000000,
}
function sellPokemon(cid, name, price)
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
if #getCreatureSummons(cid) >= 1 then
selfSay("Back your pokemon to do that!")
focus = 0 --alterado v1.8
return true
end
local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8
for s = 1, #storages do
if getPlayerStorageValue(cid, storages) >= 1 then
selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")
focus = 0
return true
end
end
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
tudo isso pra ganha rep? ja falei oq tinha de errado e tu foi la e coloko a 'mesma' resposta minha, falo nd ;]
info
Grupo: Herói
Registrado: 12/06/12
Posts: 2.2k
Reputação: +739
Gênero: Masculino
Char no Tibia: Supreme Player

nada a ver fera entrei aki no topico um 2 seg depois que vc entro !
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

2 sgs, ali ta 6 min dp postei mais faze oq..se tu acha q rep vale alguma coisa, good luck
Editado Abril 25 por StyloMaldoso
info
Grupo: Herói
Registrado: 12/06/12
Posts: 2.2k
Reputação: +739
Gênero: Masculino
Char no Tibia: Supreme Player

man na boa eu entrei no topico ai fui ver o que os caras estava me chamando para ajudar ai depois de um tempo fui la e peguei o script e fui ver qual parte estava dando erro ...
nada mais a falar
info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo

procura por..
["Sunflora"] = 5000deche assim..
["Sunflora"] = 5000,
Ty Stylo Me Ajudo Muto ^^ Duda senada...
Teno Otro Error Mano Meu Pude Ajudar Style???
[25/04/2013 23:20:45] [Error - LuaScriptInterface::loadFile] data/npc/scripts/task.lua:95: malformed number near '2then'
[25/04/2013 23:20:45] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/task.lua
[25/04/2013 23:20:45] data/npc/scripts/task.lua:95: malformed number near '2then'
Lua...
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 m = {
["Rattata"] = {storage = 91001, count= 30},
["Raticate"] = {storage = 91002, count= 30},
["Caterpie"] = {storage = 91003, count= 30 },
["Metapod"] = {storage = 91004, count= 40},
["Butterfree"] = {storage = 91005, count= 50 }, --npc de task n muito basico ^^
["Weedle"] = {storage = 91006, count= 30},
["Kakuna"] = {storage = 91007, count= 40 },
["Beedrill"] = {storage = 91008, count= 50},
["Ekans"] = {storage = 91009, count= 25},
["Arbok"] = {storage = 91010, count= 45 },
["Oddish"] = {storage = 91011, count= 15},
["Gloom"] = {storage = 91012, count= 30},
["Vileplume"] = {storage = 91013, count= 50},
["Bellsprout"] = {storage = 91014, count= 15},
["Weepinbell"] = {storage = 91015, count= 30},
["Vitreebel"] = {storage = 91016, count= 50},
["Tangela"] = {storage = 91017, count= 60},
["Voltorb"] = {storage = 91018, count= 25},
["Electrode"] = {storage = 91019, count= 45},
["Pikachu"] = {storage = 91020, count= 30},
["Raichu"] = {storage = 91021, count= 60},
["Paras"] = {storage = 91022, count= 10} ,
["Parasect"] = {storage = 91023, count= 30},
["Geodude"] = {storage = 91024, count= 20},
["Graveler"] = {storage = 91025, count= 5},
["Golem"] = {storage = 91026, count= 12},
["Machop"] = {storage = 91027, count= 20},
["Machoke"] = {storage = 91028, count= 40},
["Machamp"] = {storage = 91029, count= 65},
["Mankey"] = {storage = 91030, count= 15},
["Primeape"] = {storage = 91031, count= 5},
["Krabby"] = {storage = 91032, count= 25},
["Kingler"] = {storage = 91033, count= 50},
["Goldeen"] = {storage = 91034, count= 25},
["Seaking"] = {storage = 91035, count= 50},
["Poliwag"] = {storage = 91036, count= 20},
["Poliwhirl"] = {storage = 91037, count= 40},
["Poliwrath"] = {storage = 91038, count= 60},
["Snorlax"] = {storage = 91039 , count= 50},
}
local task1 = {"Kingler", "Poliwhirl", "Seaking"}
local task2 = {"Graveler", "Golem", "Primeape"}
local task3 = {"Electrode", "Raichu", "Pikachu"}
-------
local Check1 = "Kingler, Poliwhirl, Seaking"
local Check2 = "Graveler, Golem, Primeape"
local Check3 = "Electrode, Raichu, Pikachu"
function showTask(task, showNum)
local first = "["
if (showNum == true) then
for a = 1, #task do
if a == #task then
first = first.."("..m[task[a]].count..") "..task[a].."]"
break
end
first = first.."("..m[task[a]].count..") "..task[a]..", "
end
else
for a = 1, #task do
if a == #task then
first = first..task[a].."]"
break
end
first = first..task[a]..", "
end
end
return first
end
function checkTask(task, m)
local complet = 0
local t = string.explode(task, ",")
for d = 1, #t do
if getPlayerStorageValue(cid, m[t[d]].storage) == -2then
complet = complet+1
end
end
if complet ~= #t then
return false
else
return true
end
end
------------------------------------------------------------------------------
if msgcontains(msg, 'task') or msgcontains(msg, 'Task') then
if getPlayerStorageValue(cid, 910000) ~= -1 and (checkTask(getPlayerStorageValue(cid, 910000), m) == false) then
selfSay("You already have one task to do!", cid)
talkState[cid] = 0
return true
elseif getPlayerStorageValue(cid, 910000) ~= -1 and (checkTask(getPlayerStorageValue(cid, 910000), m) == true) then
selfSay("Ohhh i see that you already finished the task! Here is your reward!", cid)
doPlayerAddExp(cid, 150000)
doPlayerAddMoney(cid, 50000)
setPlayerStorageValue(cid, 910000, -1)
talkState[cid] = 0
return true
end
local str = "Hello, I have trhee tasks for you! "
str = str.."{First} "..showTask(task1, false).." {Second} "..showTask(task2, false).." {Third} "..showTask(task3, false)..". How do you choose?"
selfSay(str, cid)
talkState[cid] = 1
elseif (msgcontains(msg, 'First') or msgcontains(msg, 'first')) and talkState[cid] == 1 then
if (checkTask(Check1, m) == true) then
selfSay("You already completed this task... Please choose other!", cid)
talkState[cid] = 1
return true
end
selfSay("humm.. You choose kill some Kinglers, Poliwraths and Seakings... Are you sure?", cid)
talkState[cid] = 2
elseif (msgcontains(msg, 'Second') or msgcontains(msg, 'second')) and talkState[cid] == 1 then
if (checkTask(Check2, m) == true) then
selfSay("You already completed this task... Please choose other!", cid)
talkState[cid] = 1
return true
end
selfSay("humm.. You choose kill some Gravelers, Golems, Primeapes... Are you sure?", cid)
talkState[cid] = 3
elseif (msgcontains(msg, 'third') or msgcontains(msg, 'Third')) and talkState[cid] == 1 then
if (checkTask(Check3, m) == true) then
selfSay("You already completed this task... Please choose other!", cid)
talkState[cid] = 1
return true
end
selfSay("humm.. You choose kill some Electrodes, Raichus, Pikachus... Are you sure?", cid)
talkState[cid] = 4
elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) and talkState[cid] == 2 then
selfSay("Humm.. You want to choose another task? I have more two task.. The {Second} and {Third} too...", cid)
talkState[cid] = 1
elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) and talkState[cid] == 3 then
selfSay("Humm.. You want to choose another task? I have more two task.. The {First} and {Third} too...", cid)
talkState[cid] = 1
elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) and talkState[cid] == 4 then
selfSay("Humm.. You want to choose another task? I have more two task.. The {First} and {Second} too...", cid)
talkState[cid] = 1
elseif (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) and talkState[cid] == 2 then
local str2 = task1[1]
for b = 2, 3 do
str2 = str2..", "..task1
end
setPlayerStorageValue(cid, 910000, str2)
selfSay("So you have to kill "..showTask(task1, true).." and come back to me. Go!", cid)
talkState[cid] = 0
elseif (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) and talkState[cid] == 3 then
local str3 = task2[1]
for b = 2, 3 do
str3 = str3..", "..task2
end
setPlayerStorageValue(cid, 910000, str3)
selfSay("So you have to kill "..showTask(task2, true).." and come back to me. Go!", cid)
talkState[cid] = 0
elseif (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) and talkState[cid] == 4 then
local str4 = task3[1]
for b = 2, 3 do
str4 = str4..", "..task3
end
setPlayerStorageValue(cid, 910000, str4)
selfSay("So you have to kill "..showTask(task3, true).." and come back to me. Go!", cid)
talkState[cid] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

if getPlayerStorageValue(cid, m[t[d]].storage) == -2then
troque por...
if getPlayerStorageValue(cid, m[t[d]].storage) == -2 then
Editado Abril 26 por StyloMaldoso
info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo

ok bo verificar...
Duvida senada Podem Mover!
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

Tópico movido para a seção de dúvidas e pedidos resolvidos.
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

info
Grupo: Visconde
Registrado: 22/11/12
Posts: 267
Reputação: +26
Gênero: Masculino
Char no Tibia: ADM Kabo
[25/04/2013 05:07:50] [Error - LuaScriptInterface::loadFile] data/npc/scripts/pokemon seller.lua:196: '}' expected (to close '{' at line 8) near '['
[25/04/2013 05:07:50] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/pokemon seller.lua
[25/04/2013 05:07:50] data/npc/scripts/pokemon seller.lua:196: '}' expected (to close '{' at line 8) near '['
Lua...
local focus = 0
local talk_start = 0
local conv = 0
local cost = 0
local pname = ""
local baseprice = 0
local pokePrice = {
["Bulbasaur"] = 3000,
["Ivysaur"] = 8000, --alterado v1.6
["Venusaur"] = 18000,
["Charmander"] = 3000,
["Charmeleon"] = 8000,
["Charizard"] = 18000,
["Squirtle"] = 3000,
["Wartortle"] = 8000,
["Blastoise"] = 18000,
["Caterpie"] = 5,
["Metapod"] = 250,
["Butterfree"] = 2000,
["Weedle"] = 5,
["Kakuna"] = 250,
["Beedrill"] = 2000,
["Pidgey"] = 60,
["Pidgeotto"] = 1500,
["Pidgeot"] = 11500,
["Rattata"] = 5,
["Raticate"] = 2000,
["Spearow"] = 100,
["Fearow"] = 5100,
["Ekans"] = 300,
["Arbok"] = 3000,
["Pikachu"] = 8000,
["Raichu"] = 18000,
["Sandshrew"] = 1000,
["Sandslash"] = 11000,
["Nidoranfe"] = 125,
["Nidorina"] = 2250,
["Nidoqueen"] = 12250,
["Nidoranma"] = 125,
["Nidorino"] = 2250,
["Nidoking"] = 12250,
["Clefairy"] = 8000,
["Clefable"] = 18000,
["Vulpix"] = 1000,
["Ninetales"] = 11000,
["Jigglypuff"] = 8000,
["Wigglytuff"] = 18000,
["Zubat"] = 120,
["Golbat"] = 2000,
["Oddish"] = 80,
["Gloom"] = 2250,
["Vileplume"] = 12000,
["Paras"] = 60,
["Parasect"] = 7250,
["Venonat"] = 1500,
["Venomoth"] = 7250,
["Diglett"] = 200,
["Dugtrio"] = 3000,
["Psyduck"] = 1500,
["Golduck"] = 11500,
["Mankey"] = 300,
["Primeape"] = 7250,
["Growlithe"] = 3500,
["Arcanine"] = 58500,
["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"] = 300,
["Muk"] = 11000,
["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"] = 5000000,
["Hitmonchan"] = 5000000,
["Lickitung"] = 60000,
["Koffing"] = 300,
["Weezing"] = 3000,
["Rhyhorn"] = 3000,
["Rhydon"] = 13000,
["Chansey"] = 40000,
["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"] = 5000,
["Magikarp"] = 5,
["Gyarados"] = 55000,
["Lapras"] = 120000,
["Ditto"] = 150000,
["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,
["Mewtwo"] = 6000000000,
["Mew"] = 6000000000,
["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"] = 58000,
["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"] = 120000,
["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,
["Unown"] = 5000000,
["Wobbuffet"] = 200000,
["Girafarig"] = 120000,
["Pineco"] = 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,
["Swinub"] = 1000,
["Piloswine"] = 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"] = 10000,
["Tyrogue"] = 150000,
["Hitmontop"] = 500000,
["Smoochum"] = 4500,
["Elekid"] = 4500,
["Magby"] = 4500,
["Miltank"] = 120000,
["Blissey"] = 100000,
["Larvitar"] = 15000,
["Pupitar"] = 65000,
["Tyranitar"] = 125000,
["Moltres"] = 60000000000,
["Articuno"] = 60000000000,
["Zapdos"] = 60000000000,
}
function sellPokemon(cid, name, price)
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
if #getCreatureSummons(cid) >= 1 then
selfSay("Back your pokemon to do that!")
focus = 0 --alterado v1.8
return true
end
local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8
for s = 1, #storages do
if getPlayerStorageValue(cid, storages) >= 1 then
selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")
focus = 0
return true
end
end
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
Npc Lua...
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lumios" script="pokemon seller.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="1419" head="125" body="148" legs="95" feet="40"/>
</npc>