local bosses = {
['YourBossName1'] = 555,
['YourBossName2'] = 555
}
local teleportPos = Position(1024, 1024, 7) -- position where tp will be created /to edit
local teleportDestination = Position(1024, 1026, 7) -- teleport destination /to edit
local teleportRemoveTime = 1 * 60 * 1000 -- remove teleport: TIME 1=1min /to edit
local timeMsg = teleportRemoveTime /1000
local function removeTeleport()
local teleportItem = Tile(teleportPos):getItemById(1387)
if teleportItem then
teleportItem:remove()
teleportPos:sendMagicEffect(CONST_ME_POFF)
end
end
function onKill(player, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end
local targetName = targetMonster:getName():lower()
local bossStorage = bosses[targetName]
if not bossStorage then
return true
end
local newValue = 2
if targetName == 'YourBossName1' or targetName == 'YourBossName2' then -- add here yours bosses names! /to edit
newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
end
Game.setStorageValue(bossStorage, newValue)
if newValue == 2 then
player:say('You have '..timeMsg..' seconds to enter the teleport!', TALKTYPE_MONSTER_SAY) -- Msg, u can use another msg function /broadcast etc
addEvent(Game.setStorageValue, teleportRemoveTime, bossStorage, 0)
teleportPos:sendMagicEffect(CONST_ME_TELEPORT)
Game.createItem(1387, 1, teleportPos)
end
local teleport = Tile(teleportPos):getItemById(1387)
if teleport then
teleport:setDestination(teleportDestination)
addEvent(removeTeleport, teleportRemoveTime, teleportPos)
end
return true
end