local config = {
reward_position = {x = 1053, y = 880, z = 9}, -- Teleport location when Arena is Cleared.
global_storage = 13457, -- any free storage
top_left_corner = {x = 1031, y = 891, z = 9}, -- top left corner of arena
bottom_right_corner = {x = 1039, y = 898, z = 9} -- bottom right corner of arena
}
local monsters = { -- All monsters in arena (including joke monster)
[1] = "rat",
[2] = "cave rat",
[3] = "spider",
[4] = "snake",
[5] = "morgaroth",
-- Also tested it with morgaroth, ghazbaran ect. on [1], [2] ect.
[6] = "ghazbaran",
[7] = "apocalypse",
[8] = "zugurosh"
}
local monster_config_wave_one = { -- wave 1
[1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
[2] = {position = { x = 1038, y = 893, z = 9 }, name = "ghazbaran"},
[3] = {position = { x = 1037, y = 897, z = 9 }, name = "apocalypse"},
[4] = {position = { x = 1032, y = 898, z = 9 }, name = "zugurosh"}
}
local monster_config_wave_two = { -- wave 2
[1] = {position = { x = 1032, y = 892, z = 9 }, name = "morgaroth"},
[2] = {position = { x = 1038, y = 893, z = 9 }, name = "apocalypse"},
[3] = {position = { x = 1037, y = 897, z = 9 }, name = "cobra"},
[4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}
local monster_config_wave_three = { -- wave 3
[1] = {position = { x = 1032, y = 892, z = 9 }, name = "ghazbaran"},
[2] = {position = { x = 1038, y = 893, z = 9 }, name = "zugurosh"},
[3] = {position = { x = 1037, y = 897, z = 9 }, name = "acid blob"},
[4] = {position = { x = 1032, y = 898, z = 9 }, name = "cobra"}
}
function onKill(cid, target, damage, flags)
-- check if target is player
if isPlayer(target) then
return true
end
-- check if target is on list of monsters in arena
local name = getCreatureName(target):lower()
count = 0
for i = 1, #monsters do
if name == monsters[i]:lower() then
count = count + 1
end
end
if count == 0 then -- if target is not on list
return true
end
-- check if target is in area and add to global storage if it is
for t = config.top_left_corner.x, config.bottom_right_corner.x do
for f = config.top_left_corner.y, config.bottom_right_corner.y do
pos = {x = t, y = f, z = 7}
pid = getTopCreature(pos).uid
if pid == target then
setGlobalStorageValue(global_storage, getGlobalStorageValue(global_storage) + 1)
end
end
end
-- Start checks for waves of arena
-- Wave 1
if getGlobalStorageValue(global_storage) == 1 then
for i = 1, #monster_config_wave_one do
doCreateMonster(monster_config_wave_one[i].name, monster_config_wave_one[i].position)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 1.")
end
-- Wave 2
if getGlobalStorageValue(global_storage) == 5 then
for i = 1, #monster_config_wave_two do
doCreateMonster(monster_config_wave_two[i].name, monster_config_wave_two[i].position)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 2.")
end
-- Wave 3
if getGlobalStorageValue(global_storage) == 9 then
for i = 1, #monster_config_wave_three do
doCreateMonster(monster_config_wave_three[i].name, monster_config_wave_three[i].position)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wave 3. Final Wave.")
end
-- When final wave ends
-- Teleport player
if getGlobalStorageValue(global_storage) == 13 then
doTeleportThing(cid, config.reward_position)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! Go collect your reward.")
end
return true
end