vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 46
Hi, i try make simple arena quest with 10 waves, but i don't know how to stop addEvent and reset "check" storage if player died, can someone help me?
Lua:
local kb = Action()
local topL = Position(3722, 2927, 7)
local botR = Position(3730, 2935, 7)
function kb.onUse(player, item, position, creature)
if player:getStorageValue(reward) > 0 then
player:teleportTo(Position(3711, 2930, 4))
return false
end
if player:getStorageValue(check) < 1 then
player:setStorageValue(check, 1)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 1]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 10000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 2]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 21000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 3]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 32000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 4]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 43000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 5]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 54000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 6]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 65000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 7]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 76000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 8]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 87000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 9]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 98000)
addEvent(function()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[Wave 10 (LAST)]")
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Demon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
Game.createMonster("Dragon Lord", Position(math.random(topL.x, botR.x), math.random(topL.y, botR.y), topL.z))
end, 109000)
addEvent(function()
player:setStorageValue(reward, 1)
player:teleportTo(Position(3711, 2930, 4))
end, 140000)
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "Bruh Bruh")
player:teleportTo(Position(3723, 2923, 7))
end
end
kb:uid(14785)
kb:register()