ItsMeMagic
Old Tibia Player.
Problems with shared experience.
This is the problem:
This is my party.lua
Hope you guys can help me out,
Thanks
This is the problem:
Code:
Lua Script Error: [Event Interface]
data/events/scripts/party.lua:Party@onShareExperience
data/events/scripts/party.lua:23: bad argument #1 to 'ipairs' (table expected, got number)
stack traceback:
[C]: in ?
[C]: in function 'ipairs'
data/events/scripts/party.lua:23: in function
This is my party.lua
Code:
function Party:onJoin(player)
return true
end
function Party:onLeave(player)
return true
end
function Party:onDisband()
return true
end
function Party:onShareExperience(exp)
local sharedExperienceMultiplier = 1.20 --20%
local vocationsIds = {}
local vocationId = self:getLeader():getVocation():getId()
if vocationId ~= VOCATION_NONE then
table.insert(vocationsIds, self:getLeader():getVocation():getId())
end
for _, member in ipairs(#self:getMembers()) do
vocationId = member:getVocation():getId()
if not isInArray(vocationsIds, vocationId) and vocationId ~= VOCATION_NONE then
table.insert(vocationsIds, vocationId)
end
end
local size = #vocationsIds
if size > 1 then
sharedExperienceMultiplier = 1.0 + ((size * (10 + (size - 1) * 5)) / 100)
end
exp = (exp * sharedExperienceMultiplier) / (#self:getMembers() + 1)
return exp
end
Hope you guys can help me out,
Thanks
