Sugiro você fazer uma tabela assim, ao invéz dessa:
levels = {
["Bulbasaur"] = 10,
["Ivysaur"] = 20,
["Venusaur"] = 30,
}
E assim por diante. Fica mais fácil.
E poste seu catchsystem.lua, por favor.
Por otavio101, 05 de dez. de 2013 em Tópicos Sem Resposta
Sugiro você fazer uma tabela assim, ao invéz dessa:
levels = {
["Bulbasaur"] = 10,
["Ivysaur"] = 20,
["Venusaur"] = 30,
}
E assim por diante. Fica mais fácil.
E poste seu catchsystem.lua, por favor.
Catch
local ballcatch = { --id normal, id da ball shiy
[2394] = {cr = 3, on = 24, off = 23, ball = {11826, 11737}, send = 47, typeee = "normal"}, --alterado v2.9 \/
[2391] = {cr = 6, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great"},
[2393] = {cr = 10, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super"},
[2392] = {cr = 15, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra"},
[12617] = {cr = 3, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari"},
}
function onUse(cid, item, frompos, item3, topos)
local item2 = getTopCorpse(topos)
if item2 == null then
return true
end
if getItemAttribute(item2.uid, "catching") == 1 then
return true
end
if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!") --alterado v2.6
end
local name = string.lower(getItemNameById(item2.itemid)) --alterado v2.9 \/
name = string.gsub(name, "fainted ", "")
name = string.gsub(name, "defeated ", "")
name = doCorrectPokemonName(name)
local x = pokecatches[name]
local storage = newpokedex[doCorrectPokemonName(name)].stoCatch --alterado v2.9 \/
if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then
setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0;")
end
if not x then return true end
local owner = getItemAttribute(item2.uid, "corpseowner")
if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then --alterado v2.5
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v2.9
local typeee = ballcatch[item.itemid].typeee
local catchinfo = {}
catchinfo.rate = ballcatch[item.itemid].cr
catchinfo.catch = ballcatch[item.itemid].on
catchinfo.fail = ballcatch[item.itemid].off
catchinfo.newid = newidd
catchinfo.name = doCorrectPokemonName(name)
catchinfo.topos = topos
catchinfo.chance = x.chance
doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
doRemoveItem(item.uid, 1)
local d = getDistanceBetween(getThingPos(cid), topos)
if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then --alterado v2.9
setPlayerStorageValue(cid, 98796, -1)
setPlayerStorageValue(cid, 98797, -1)
doTeleportThing(cid, SafariOut, false)
doSendMagicEffect(getThingPos(cid), 21)
doPlayerSendTextMessage(cid, 27, "You spend all your 'saffari balls', good luck in the next time...")
end
addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
return true
end
Quanto a forma poder ser como quiser ali só foi como exemplo.
Acho que tem algo relacionado as ultimas linhas do Pokeexp.lua
local balls = {11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837,
11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748}
local function playerAddExp(cid, exp)
doPlayerAddExp(cid, exp)
doSendAnimatedText(getThingPos(cid), exp, 215)
end
local function giveExpToPlayer(pk, expTotal, givenexp, expstring) --alterado v2.7
playerAddExp(pk, expTotal)
local firstball = getPlayerSlotItem(pk, 8)
if not isInParty(pk) and firstball and getItemAttribute(firstball.uid, expstring) and getItemAttribute(firstball.uid, expstring) > 0 then
local percent = getItemAttribute(firstball.uid, expstring) <= 1 and getItemAttribute(firstball.uid, expstring) or 1
local gainexp = math.ceil(percent * givenexp)
doItemSetAttribute(firstball.uid, expstring, 0)
givePokemonExp(pk, firstball, expTotal) --alterado v2.7
elseif isInParty(pk) and firstball.uid ~= 0 then
givePokemonExp(pk, firstball, expTotal*3) --alterado v2.7
end
for b = 1, #balls do
local pokes = getItemsInContainerById(getPlayerSlotItem(pk, 3).uid, balls[b])
if #pokes >= 1 then
for _, uid in pairs (pokes) do
if not isInParty(pk) and getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then
local percent = getItemAttribute(uid, expstring) <= 1 and getItemAttribute(uid, expstring) or 1
local gainexp = math.ceil(percent * givenexp)
doItemSetAttribute(uid, expstring, 0)
givePokemonExpInBp(pk, uid, gainexp, balls[b]) --alterado v2.7
elseif isInParty(pk) and getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then
givePokemonExpInBp(pk, uid, expTotal*3, balls[b])
end
end
end
end
end
function onDeath(cid, corpse, deathList)
if isSummon(cid) or not deathList or getCreatureName(cid) == "Evolution" then return true end --alterado v2.8
-------------Edited Golden Arena------------------------- --alterado v2.7 \/\/
if getPlayerStorageValue(cid, 22546) == 1 then
setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1)
if corpse.itemid ~= 0 then doItemSetAttribute(corpse.uid, "golden", 1) end --alterado v2.8
end
if getPlayerStorageValue(cid, 22546) == 1 and getGlobalStorageValue(22548) <= 0 then
local wave = getGlobalStorageValue(22547)
for _, sid in ipairs(getPlayersOnline()) do
if isPlayer(sid) and getPlayerStorageValue(sid, 22545) == 1 then
if getGlobalStorageValue(22547) < #wavesGolden+1 then
doPlayerSendTextMessage(sid, 21, "Wave "..wave.." will begin in "..timeToWaves.."seconds!")
doPlayerSendTextMessage(sid, 28, "Wave "..wave.." will begin in "..timeToWaves.."seconds!")
addEvent(creaturesInGolden, 100, GoldenUpper, GoldenLower, false, true, true)
addEvent(doWave, timeToWaves*1000)
elseif getGlobalStorageValue(22547) == #wavesGolden+1 then
doPlayerSendTextMessage(sid, 20, "You have win the golden arena! Take your reward!")
doPlayerAddItem(sid, 2152, getPlayerStorageValue(sid, 22551)*2) --premio
setPlayerStorageValue(sid, 22545, -1)
doTeleportThing(sid, getClosestFreeTile(sid, posBackGolden), false)
setPlayerRecordWaves(sid)
end
end
end
if getGlobalStorageValue(22547) == #wavesGolden+1 then
endGoldenArena()
end
end
--------------------------------------------------- /\/\
local givenexp = getWildPokemonExp(cid)
local expstring = ""..cid.."expEx"
if givenexp > 0 then
for a = 1, #deathList do
local pk = deathList[a]
if isCreature(pk) then
local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false)
local expTotal = math.floor(playerExperienceRate * givenexp * getDamageMapPercent(pk, cid))
local party = getPartyMembers(pk)
if isInParty(pk) and getPlayerStorageValue(pk, 4875498) <= -1 then
expTotal = math.floor(expTotal/#party) --alterado v2.6.1
for i = 1, #party do
if isInArray(list, party[i]) and getDamageMapPercent(party[i], cid) > 0 then --alterado v2.8
giveExpToPlayer(party[i], expTotal, givenexp, expstring)--alterado v2.7
end
end
else
giveExpToPlayer(pk, expTotal, givenexp, expstring) --alterado v2.7
end
end
end
end
if isNpcSummon(cid) then
local master = getCreatureMaster(cid)
doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 10000))
doCreatureSay(master, getPlayerStorageValue(cid, 10001), 1)
doRemoveCreature(cid)
return false
end
if corpse.itemid ~= 0 then --alterado v2.8
doItemSetAttribute(corpse.uid, "offense", getPlayerStorageValue(cid, 1011))
doItemSetAttribute(corpse.uid, "defense", getPlayerStorageValue(cid, 1012))
doItemSetAttribute(corpse.uid, "speed", getPlayerStorageValue(cid, 1013))
doItemSetAttribute(corpse.uid, "vitality", getPlayerStorageValue(cid, 1014))
doItemSetAttribute(corpse.uid, "spattack", getPlayerStorageValue(cid, 1015))
doItemSetAttribute(corpse.uid, "level", getLevel(cid))
doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))
end
return true
end
Editado Dezembro 6 por otaviogfl
Em catchsystem.lua, abaixo de
failmsgs = {
"Sorry, you didn't catch that pokemon.",
"Sorry, your pokeball broke.",
"Sorry, the pokemon escaped.",
}
Adicione essa tabela:
local lv_table = {
["Bulbasaur"] = 10, --["Nome do pokémon"] = level que irá vir ao ser capturado,
["Charmander"] = 15,
["Squirtle"] = 20,
}
local happy = 250Adicione isso:
local give_level = lv_table[poke]
if not give_level then
give_level = 5
print(""..poke.." isn't in lv_table!")
end
doItemSetAttribute(item, "level", clevel)E troque por
doItemSetAttribute(item, "level", give_level)
Editado Dezembro 6 por zipter98
Quase cara só faltou a questão dos status, porque ele fica com o status do Wild,
Magikarp Level 10
Magikarp Level 30
Qual os status que devem vir ao capturar o pokémon? Tava pensando em fazer assim: os status do pokémon configurados no configuration.lua * 10. Por exemplo, se um pokémon tiver offense = 4, ao capturá-lo, a offense virá 40.
OBS: Não tem como verificar os status exatos do pokémon em determinado level. O jeito então, é fazer alguma fórmula pra definir os status ao capturar o pokémon.
Editado Dezembro 6 por zipter98
Dá pra colocar o status do configuration.lua vezes o level?
Vou tentar. Logo edito com resultado.
EDIT: catchsystem.lua, abaixo de
local give_level = lv_table[poke]
if not give_level then
give_level = 5
print(""..poke.." isn't in lv_table!")
end
local stat = getPokemonStatus(poke) local off = stat.off * give_level local def = stat.def * give_level local agi = stat.agi * give_level local spatk = stat.spatk * give_level local vit = stat.vit * give_level
doItemSetAttribute(item, "offense", coffense) doItemSetAttribute(item, "defense", cdefense) doItemSetAttribute(item, "speed", cspeed) doItemSetAttribute(item, "vitality", cvitality) doItemSetAttribute(item, "specialattack", cspatk)
doItemSetAttribute(item, "offense", off) doItemSetAttribute(item, "defense", def) doItemSetAttribute(item, "speed", agi) doItemSetAttribute(item, "vitality", vit) doItemSetAttribute(item, "specialattack", spatk)
Ao capturar o pokémon, ele está vindo no level definido na tabela lv_table. O cálculo de seus status é: status no configuration.lua * level.
Editado Dezembro 6 por zipter98
Deram vários erros aqui, no Spawn.lua Linha87:Attemp to call global "isSummon" (nil value) e "in fuction linha 79"
E esse erro no catch system:
Pode me mandar seu level system.lua, e seu catch system.lua? Testei aqui no PDA com level, v2.9, e tá funcionando perfeitamente. Se você estiver usando o mesmo servidor que eu, provavelmente fez algo errado.
Editado Dezembro 7 por zipter98
Hmm pode ser que eu esteja substituindo errado então.
Edit:Achei o erro estava colocando no local errado.
Mais uma vez você me ajudou. Meus Rep+ acabaram se não dava outros.
Editado Dezembro 7 por otaviogfl
info
Grupo: Herói
Registrado: 12/06/12
Posts: 2.2k
Reputação: +739
Gênero: Masculino
Char no Tibia: Supreme Player

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: Campones
Registrado: 19/03/08
Posts: 75
Reputação: +15
Olá alguem poderia me ajudar uso PDA com Level e queria fazer com que ao dar catch o pokémon voltasse para o level que eu definir. por exemplo:
Level 10 = {"Caterpie", "Charmander", "Squirtle"} Level 20 = {"Charmeleon", "Wartortle", "Metapod"} Level 30 = {"Charizard", "Blatoise", "Buterfree"}Ao se eu der catch em 1 charmander level 16 por exemplo ele retorna ao level e aos status do level 10.
Editado Dezembro 5 por otaviogfl