Jump to content
Sign in to follow this  
FlamesAdmin

Scripting ERRO pokeexp.lua

Recommended Posts

o erro é o seguinte:

[09/09/2018 18:03:43] [Error - CreatureScript Interface] 
[09/09/2018 18:03:43] data/creaturescripts/scripts/pokeexp.lua:onDeath
[09/09/2018 18:03:43] Description: 
[09/09/2018 18:03:43] (luaDoItemSetAttribute) Item not found

pokeexp.lua



local balls = {11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837,
11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748}

local Exps = {
[{1, 50}] = 25,
[{51, 80}] = 20,
[{81, 120}] = 10,
[{121, 150}] = 8,
[{151, 199}] = 7,
[{200, 250}] = 5,
[{251, 300}] = 4,
[{301, 350}] = 2.5,
[{351, 400}] = 2,
[{401, 500}] = 1.5,
[{501, 599}] = 1,
[{600}] = 0,
}
--2798 -normal- //
local function playerAddExp(cid, exp)
local Tiers = {
[71] = {bonus = Exp1},
[72] = {bonus = Exp2},
[73] = {bonus = Exp3},
[74] = {bonus = Exp4},
[75] = {bonus = Exp5},
[76] = {bonus = Exp6},
[77] = {bonus = Exp7},
}
local ball = getPlayerSlotItem(cid, 😎
local Tier = getItemAttribute(ball.uid, "heldx")
if Tier and Tier > 70 and Tier < 78 then
doPlayerAddExp(cid, math.floor(exp * Tiers[Tier].bonus))
    doSendAnimatedText(getThingPos(cid), exp * Tiers[Tier].bonus, 215)
else
doPlayerAddExp(cid, exp)
    doSendAnimatedText(getThingPos(cid), exp, 215)
end
end

local function calculaExp(cid, expTotal)
if not isPlayer(cid) then return 0 end
local expFinal = expTotal
for lvl, exp in pairs(Exps) do
if getPlayerLevel(cid) >= lvl[1] or getPlayerLevel(cid) <= lvl[2] then
expFinal = expFinal * exp
break
end
end
if expFinal == expTotal then expFinal = expFinal * 0.2 end --lvl 200+
return math.floor(expFinal)
end

local function giveExpToPlayer(pk, expTotal, givenexp, expstring) --alterado v2.7
playerAddExp(pk, expTotal)

local firstball = getPlayerSlotItem(pk, 😎

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)
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) --alterado v2.7
elseif isInParty(pk) and getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then
givePokemonExpInBp(pk, uid, expTotal*3, balls)
end
end
end
end
end

local function playerAddExp(cid, exp)
   doPlayerAddExp(cid, exp)
   doSendAnimatedText(getThingPos(cid), exp, 215)
end

function onDeath(cid, corpse, deathList)
        
    if isSummon(cid) or not deathList or getCreatureName(cid) == "Evolution" then return true end --alterado v1.8

local level = getPlayerStorageValue(cid, 28284)
doItemSetAttribute(corpse.uid, "uplevel", level)


    -------------Edited Golden Arena-------------------------   
    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, "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)  

if givenexp > 0 then
for a = 1, #deathList do
local pk = deathList[a]
---
local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false)
if isCreature(pk) then 
   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)         
      for i = 1, #party do
          if isInArray(list, party) then
             playerAddExp(party, expTotal)
          end
      end
   else
      playerAddExp(pk, expTotal)  
   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

Share this post


Link to post
Share on other sites
Em 09/09/2018 em 18:52, FlamesAdmin disse:

o erro é o seguinte:


[09/09/2018 18:03:43] [Error - CreatureScript Interface] 
[09/09/2018 18:03:43] data/creaturescripts/scripts/pokeexp.lua:onDeath
[09/09/2018 18:03:43] Description: 
[09/09/2018 18:03:43] (luaDoItemSetAttribute) Item not found

pokeexp.lua

 

  Mostrar conteúdo oculto

 

 


local balls = {11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837,
11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748}

local Exps = {
[{1, 50}] = 25,
[{51, 80}] = 20,
[{81, 120}] = 10,
[{121, 150}] = 8,
[{151, 199}] = 7,
[{200, 250}] = 5,
[{251, 300}] = 4,
[{301, 350}] = 2.5,
[{351, 400}] = 2,
[{401, 500}] = 1.5,
[{501, 599}] = 1,
[{600}] = 0,
}
--2798 -normal- //
local function playerAddExp(cid, exp)
local Tiers = {
[71] = {bonus = Exp1},
[72] = {bonus = Exp2},
[73] = {bonus = Exp3},
[74] = {bonus = Exp4},
[75] = {bonus = Exp5},
[76] = {bonus = Exp6},
[77] = {bonus = Exp7},
}
local ball = getPlayerSlotItem(cid, 😎
local Tier = getItemAttribute(ball.uid, "heldx")
if Tier and Tier > 70 and Tier < 78 then
doPlayerAddExp(cid, math.floor(exp * Tiers[Tier].bonus))
    doSendAnimatedText(getThingPos(cid), exp * Tiers[Tier].bonus, 215)
else
doPlayerAddExp(cid, exp)
    doSendAnimatedText(getThingPos(cid), exp, 215)
end
end

local function calculaExp(cid, expTotal)
if not isPlayer(cid) then return 0 end
local expFinal = expTotal
for lvl, exp in pairs(Exps) do
if getPlayerLevel(cid) >= lvl[1] or getPlayerLevel(cid) <= lvl[2] then
expFinal = expFinal * exp
break
end
end
if expFinal == expTotal then expFinal = expFinal * 0.2 end --lvl 200+
return math.floor(expFinal)
end

local function giveExpToPlayer(pk, expTotal, givenexp, expstring) --alterado v2.7
playerAddExp(pk, expTotal)

local firstball = getPlayerSlotItem(pk, 😎

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)
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) --alterado v2.7
elseif isInParty(pk) and getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then
givePokemonExpInBp(pk, uid, expTotal*3, balls)
end
end
end
end
end

local function playerAddExp(cid, exp)
   doPlayerAddExp(cid, exp)
   doSendAnimatedText(getThingPos(cid), exp, 215)
end

function onDeath(cid, corpse, deathList)
        
    if isSummon(cid) or not deathList or getCreatureName(cid) == "Evolution" then return true end --alterado v1.8

local level = getPlayerStorageValue(cid, 28284)
doItemSetAttribute(corpse.uid, "uplevel", level)


    -------------Edited Golden Arena-------------------------   
    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, "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)  

if givenexp > 0 then
for a = 1, #deathList do
local pk = deathList[a]
---
local list = getSpectators(getThingPosWithDebug(pk), 30, 30, false)
if isCreature(pk) then 
   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)         
      for i = 1, #party do
          if isInArray(list, party) then
             playerAddExp(party, expTotal)
          end
      end
   else
      playerAddExp(pk, expTotal)  
   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

 

 

tbm queria saber ???

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...