arthurluna
Member
- Joined
- Apr 12, 2008
- Messages
- 178
- Reaction score
- 12
As I do to when the two bosses are dead create a portal to póxima room?
I'm having trouble
I'm having trouble
Code:
local bosses = {
["ushuriel"] = {storage = 250, pos = {x = 33171, y = 31728, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["zugurosh"] = {storage = 251, pos = {x = 33136, y = 31692, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["madareth"] = {storage = 252, pos = {x = 33197, y = 31758, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["latrivan"] = {storage = 253, pos = {x = 33228, y = 31728, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["golgordan"] = {storage = 253, pos = {x = 33236, y = 31728, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["annihilon"] = {storage = 254, pos = {x = 33197, y = 31690, z = 11}, newpos = {x = 33171, y = 31728, z = 11}},
["hellgorak"] = {storage = 255, pos = {x = 33104, y = 31726, z = 11}, newpos = {x = 33171, y = 31728, z = 11}}
}
local function removeT(position)
local teleportItem = Tile(position):getItemById(1387)
if teleportItem then
teleportItem:remove()
position: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
local position = targetMonster:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(1387, 1, position)
if item:isTeleport() then
item:setDestination(bossStorage.newpos)
end
Game.setStorageValue(bossStorage.storage, newValue)
if newValue == 2 then
player:say('You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room.', TALKTYPE_MONSTER_SAY)
addEvent(Game.setStorageValue, 6 * 1000, bossStorage.storage, 0)
addEvent(Game.createMonster, 6 * 1000, targetName, bossStorage.pos)
addEvent(removeT, 6 * 1000, position)
end
end