darkmu
Well-Known Member
I'm using the same script on windows (test server) and on my server (linux), but when I kill the dungeon monsters on the linux server, it keeps giving this error, does anyone know how to solve it?
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/SystemCustom/dungeon/dungeon_death.luanDeath
data/global.lua:118: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
[C]: at 0x5555557fdf34
[C]: in function 'pairs'
data/global.lua:118: in function 'contains'
..rescripts/scripts/SystemCustom/dungeon/dungeon_death.lua:31: in function <...rescripts/scripts/SystemCustom/dungeon/dungeon_death.lua:27>
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/SystemCustom/dungeon/dungeon_death.luanDeath
data/global.lua:118: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
[C]: at 0x5555557fdf34
[C]: in function 'pairs'
data/global.lua:118: in function 'contains'
..rescripts/scripts/SystemCustom/dungeon/dungeon_death.lua:31: in function <...rescripts/scripts/SystemCustom/dungeon/dungeon_death.lua:27>
Lua:
config = {
[{'mutated rat'}] = {
fromPositionArea = Position(1001, 780, 7), -- fromPosition
toPositionArea = Position(1097, 871, 7), -- toPosition
},
[{'goblin', 'rat'}] = {
fromPositionArea = Position(1001, 780, 7), -- fromPosition
toPositionArea = Position(1097, 871, 7), -- toPosition
},
}
function getRandomSpawnPosition(fromPosition, toPosition)
local random = math.random
return Position(random(fromPosition.x, toPosition.x), random(fromPosition.y, toPosition.y), random(fromPosition.z, toPosition.z))
end
local function dungeonMonster(name, position, fromPosition, toPosition)
local tmpMonster = Game.createMonster(name, getRandomSpawnPosition(fromPosition, toPosition), true, false)
if tmpMonster then
tmpMonster:registerEvent("dungeon_monster")
end
end
function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local monsterName = monster:getName():lower()
for configs, area in pairs(config) do
if table.contains(configs, monsterName) then -- here
local randomTime = math.random(1, 3)
local monsterPosition = monster:getPosition()
addEvent(dungeonMonster, randomTime * 60 * 100, monsterName, monsterPosition, area.fromPositionArea, area.toPositionArea)
end
end
return true
end