Someone help me?
I need that after a few minutes the player is removed and the boss deleted from the configured area.
I need that after a few minutes the player is removed and the boss deleted from the configured area.
Lua:
local function removeBosst(fromArea1, fromArea2, bossName)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
if(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid > 0) then
if(isMonster(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) then
if(string.lower(getCreatureName(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) == bossName) then
doRemoveCreature(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)
end
end
end
end
end
end
return true
end
local function teleportAllPlayersFromAreat(fromArea1, fromArea2, toPos)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
if(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid > 0) then
if(isPlayer(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) then
doTeleportThing(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid, toPos)
doSendMagicEffect(toPos, CONST_ME_TELEPORT)
end
end
end
end
end
return true
end
local function PrepareEnter()
removeBosst({x = 32959, y = 31698, z = 7}, {x = 32939, y = 31678, z = 7}, 'Rat')
teleportAllPlayersFromAreat({x = 32949, y = 31717, z = 7},{x = 32949, y = 31721, z = 7},{x = 32950, y = 31695, z = 7})
Game.createMonster('Rat', {x = 32949, y = 31688, z = 7})
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 then
local specs, spec = Game.getSpectators({x = 32949, y = 31688, z = 7}, false, false, rangeX, rangeX, rangeY, rangeY)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
return true
end
end
addEvent(PrepareEnter, 1)
doPlayerSendTextMessage(player, 19, "You have fifteen minutes to kill and loot this boss, else you will lose that chance.")
end
item:transform(item.itemid == 9826 and 9825 or 9826)
return true
end