@Taiger Tenta assim:
local function doReceiveTeamRocket(cid) math.randomseed = os.time() local q1 = math.random(1,10) local q = math.random(q1, 20) local sto = 17067 local Clans = { {1, stones={fire, fire}}, -- volcanic {2, stones={water, ice}}, -- seavell {3, stones={rock, earth}}, -- orebound {4, stones={heart, heart}}, -- wingeon {5, stones={dark, venom}}, -- malefic {6, stones={heart, punch}}, -- gardestrike {7, stones={enigma, enigma}}, -- psycraft {8, stones={grass, coccon}}, -- naturia {9, stones={thunder, thunder}}, -- raibolt } local function addStonePerClan(cid, table, q) for z=1, #table do doPlayerAddItem(cid, table[z], q) end end if Clans[getPlayerClanNum(cid)] then local clan = getPlayerClanNum(cid) addStonePerClan(cid, Clans[clan].stones, q) playerAddExp(cid, q*1000) setPlayerStorageValue(cid, sto, 1) else doPlayerAddItem(cid, 2160, q) playerAddExp(cid, q*1000) setPlayerStorageValue(cid, sto, 1) end doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end function onDeath(cid, corpse, deathList) --if not isCreature(cid) then return true end if isSummon(cid) or not deathList or getCreatureNameWithProtect(cid) == "Evolution" then return true end --alterado v1.8 local pokedexp = getCreatureNameWithProtect(cid) -------------Edited Golden Arena------------------------- --alterado v1.7 \/\/ if getPlayerStorageValue(cid, 22546) == 1 then setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1) if corpse.itemid ~= 0 then doItemSetAttribute(corpse.uid, "golden", 1) end --alterado v1.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, 20, "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, "Você foi o último sobrevivente da Golden arena tome sua recompensa!") 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 killer = getItemAttribute(corpse.uid, "corpseowner") local pkpos = getThingPos(cid) local topleft = {x=1879, y=1027, z=8} local bottomright = {x=1893, y=1073, z=8} if pokedexp == "Unown Legion" and ((pkpos.x >= topleft.x and pkpos.x <= bottomright.x) and (pkpos.y >= topleft.y and pkpos.y <= bottomright.y))then addEvent(function() doSummonCreature("Unown Legion", pkpos) end, 60000) end if tonumber(givenexp) and givenexp >= 0 then for a = 1, #deathList do local pk = deathList[a] --- local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false) if pokedexp == "Rocket Team" and isInParty(pk) then break end if isCreature(pk) then --local expTotal = math.floor(givenexp * getDamageMapPercent(pk, cid)) local expTotal = math.floor(givenexp) local party = getPartyMembers(pk) if isInParty(pk) and getPlayerStorageValue(pk, 4875498) <= -1 then expTotal = math.floor(expTotal/#party) --alterado v1.6.1 for i = 1, #party do if isInArray(list, party) then --playerAddExp(party, expTotal) playerAddExp(getCreatureMaster(party), expTotal * ExperienceLib.rate(getPlayerLevel(getCreatureMaster(party)))) end end elseif not isInParty(pk) then if pokedexp == "Rocket Team" then doReceiveTeamRocket(getCreatureMaster(pk)) return true end --playerAddExp(pk, expTotal) playerAddExp(getCreatureMaster(pk), math.floor((ExperienceLib.rate(getPlayerLevel(getCreatureMaster(pk))) * (givenexp)))) 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 v1.8 doItemSetAttribute(corpse.uid, "level", getPokemonLevel(cid)) doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid)) end return true end




info
Grupo: Marquês
Registrado: 02/07/07
Posts: 1.1k
Reputação: +287
Gênero: Masculino
Boa noite, estou com um erro na distro que esta me causando dor de cabeça.
[Error - CreatureScript Interface] data/creaturescripts/scripts/pokeexp.lua:onDeath Description: data/lib/Experience.lua:23: attempt to compare number with boolean stack traceback: data/lib/Experience.lua:23: in function 'rate' data/creaturescripts/scripts/pokeexp.lua:98: in function [Error - CreatureScript Interface] data/creaturescripts/scripts/pokeexp.lua:onDeath Description: (internalGetPlayerInfo) Player not found when requesting player info #3pokeexp.lua
local function doReceiveTeamRocket(cid)
math.randomseed = os.time()
local q1 = math.random(1,10)
local q = math.random(q1, 20)
local sto = 17067
local Clans = {
{1, stones={fire, fire}}, -- volcanic
{2, stones={water, ice}}, -- seavell
{3, stones={rock, earth}}, -- orebound
{4, stones={heart, heart}}, -- wingeon
{5, stones={dark, venom}}, -- malefic
{6, stones={heart, punch}}, -- gardestrike
{7, stones={enigma, enigma}}, -- psycraft
{8, stones={grass, coccon}}, -- naturia
{9, stones={thunder, thunder}}, -- raibolt
}
local function addStonePerClan(cid, table, q)
for z=1, #table do
doPlayerAddItem(cid, table[z], q)
end
end
if Clans[getPlayerClanNum(cid)] then
local clan = getPlayerClanNum(cid)
addStonePerClan(cid, Clans[clan].stones, q)
playerAddExp(cid, q*1000)
setPlayerStorageValue(cid, sto, 1)
else
doPlayerAddItem(cid, 2160, q)
playerAddExp(cid, q*1000)
setPlayerStorageValue(cid, sto, 1)
end
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
function onDeath(cid, corpse, deathList)
--if not isCreature(cid) then return true end
if isSummon(cid) or not deathList or getCreatureNameWithProtect(cid) == "Evolution" then return true end --alterado v1.8
local pokedexp = getCreatureNameWithProtect(cid)
-------------Edited Golden Arena------------------------- --alterado v1.7 \/\/
if getPlayerStorageValue(cid, 22546) == 1 then
setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1)
if corpse.itemid ~= 0 then doItemSetAttribute(corpse.uid, "golden", 1) end --alterado v1.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, 20, "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, "Você foi o último sobrevivente da Golden arena tome sua recompensa!")
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 killer = getItemAttribute(corpse.uid, "corpseowner")
local pkpos = getThingPos(cid)
local topleft = {x=1879, y=1027, z=8}
local bottomright = {x=1893, y=1073, z=8}
if pokedexp == "Unown Legion" and ((pkpos.x >= topleft.x and pkpos.x <= bottomright.x) and (pkpos.y >= topleft.y and pkpos.y <= bottomright.y))then
addEvent(function() doSummonCreature("Unown Legion", pkpos) end, 60000)
end
if givenexp > 0 then
for a = 1, #deathList do
local pk = deathList[a]
---
local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false)
if pokedexp == "Rocket Team" and isInParty(pk) then
break
end
if isCreature(pk) then
--local expTotal = math.floor(givenexp * getDamageMapPercent(pk, cid))
local expTotal = math.floor(givenexp)
local party = getPartyMembers(pk)
if isInParty(pk) and getPlayerStorageValue(pk, 4875498) <= -1 then
expTotal = math.floor(expTotal/#party) --alterado v1.6.1
for i = 1, #party do
if isInArray(list, party) then
--playerAddExp(party, expTotal)
playerAddExp(party, expTotal * ExperienceLib.rate(getPlayerLevel(party)))
end
end
elseif not isInParty(pk) then
if pokedexp == "Rocket Team" then
doReceiveTeamRocket(pk)
return true
end
--playerAddExp(pk, expTotal)
playerAddExp(pk, math.floor((ExperienceLib.rate(getPlayerLevel(pk)) * (givenexp))))
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 v1.8
doItemSetAttribute(corpse.uid, "level", getPokemonLevel(cid))
doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))
end
return true
end
Experience.lua da lib
ExperienceLib = {
table = {
[0] = 20, -- level 0 ao 49
[50] = 16, -- level 50 ao 99
[100] = 12, -- level 100 ao 120
[121] = 6, -- level 121 ao 150
[150] = 5, -- level 150 ao 199
[200] = 4, -- level 200 ao 249
[250] = 3, -- level 250 ao 299
[300] = 1.5, -- level 300 ao 349
[350] = 1, -- level 350 ao 399
[400] = 0.5, -- level 400 ao 449
[425] = 0.3, -- level 450 ao 499
[450] = 0.2, -- level 500+
},
rate = function(level)
local retRate = 0
if ExperienceLib.table[level] then
retRate = ExperienceLib.table[level]
else
local levelsWIM = {}
for lvl, rate in pairs(ExperienceLib.table) do
if level >= lvl then
table.insert(levelsWIM, rate)
end
end
table.sort(levelsWIM, function(value1, value2) return value1 < value2 end)
retRate = levelsWIM[1]
end
return retRate
end,
}
Alguem poderia me ajudar?
Rep+