Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. local bossName = "grand master oberon"
  2. local globalTimer = GlobalStorage.secretLibrary.FalconBastion.oberonTimer
  3.  
  4. function onUse(player, item, fromPosition, itemEx, toPosition)
  5. local convertTable = {}
  6.  
  7. if item:getId() == 1945 then -- Last boss room!
  8. if Game.getStorageValue(globalTimer) >= 1 then
  9. player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenged " .. bossName .. ".")
  10. return true
  11. end
  12. local teleport = 0
  13. for i = 33358, 33362, 1 do
  14. local newpos = Position(i, 31342, 9)
  15. local nplayer = Tile(newpos):getTopCreature()
  16. if nplayer and nplayer:isPlayer() then
  17. teleport = teleport + 1
  18. end
  19. end
  20.  
  21. local fromPosition_ = Position(33356, 31311, 9) -- Checagem
  22. local toPosition_ = Position(33376, 31328, 9) -- Checagem
  23. local exitPosition = Position(33297, 31286, 9)
  24.  
  25. if(isPlayerInArea(fromPosition_, toPosition_)) then
  26. player:sendCancelMessage('It looks like there is someone inside.')
  27. return true
  28. end
  29.  
  30. for _x= fromPosition_.x, toPosition_.x, 1 do
  31. for _y= fromPosition_.y, toPosition_.y, 1 do
  32. for _z= fromPosition_.z, toPosition_.z, 1 do
  33. local tile = Tile(Position(_x, _y, _z))
  34. if (tile and tile:getTopCreature()) and (tile:getTopCreature():isMonster() or tile:getTopCreature():isNpc()) then
  35. tile:getTopCreature():remove()
  36. end
  37. end
  38. end
  39. end
  40.  
  41. for i = 33358, 33362, 1 do
  42. local newpos = Position(i, 31342, 9)
  43. local nplayer = Tile(newpos):getTopCreature()
  44. if nplayer and nplayer:isPlayer() then
  45. nplayer:teleportTo(Position(33365, 31323, 9), true)
  46. convertTable[#convertTable + 1] = nplayer:getId()
  47. player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  48. end
  49. end
  50. local oberon = Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9))
  51. if oberon then
  52. oberon:setStorageValue(Storage.secretLibrary.FalconBastion.oberonHeal, 0)
  53. end
  54. Game.setStorageValue(GlobalStorage.secretLibrary.FalconBastion.oberonSay, - 1)
  55. Game.createNpc("Oberon's Spite", Position(33363, 31321, 9))
  56. Game.createNpc("Oberon's Ire", Position(33368, 31321, 9))
  57. Game.createNpc("Oberon's Bile", Position(33363, 31317, 9))
  58. Game.createNpc("Oberon's Hate", Position(33368, 31317, 9))
  59. Game.setStorageValue(globalTimer, 1)
  60. addEvent(clearForgotten, 30 * 60 * 1000, fromPosition_, toPosition_, exitPosition, globalTimer)
  61. end
  62.  
  63.  
  64. return true
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement