darkmu
Well-Known Member
I want to try to access the table according to the name of the monster it will respawn in a certain area.
Lua:
config = {
[{'demon, demon skeleton'}] = {
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
},
}
local function dungeonMonster(name, position, fromPosition, toPosition)
Game.createMonster(name, position, true, true)
end
function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local monsterName = monster:getName()
for configs, bonus in pairs(config) do
local randomTime = math.random(2, 3)
local monsterName, monsterPosition = monster:getName(), monster:getPosition()
addEvent(dungeonMonster, randomTime * 60 * 1000, monsterName, monsterPosition)
end
return true
end