Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.10 KB | None | 0 0
  1. local chains = {
  2.     West = {
  3.         [1] = {itemid = 23656, position = Position(33401, 32419, 14)},
  4.         [2] = {itemid = 23655, position = Position(33402, 32419, 14)},
  5.         [3] = {itemid = 23655, position = Position(33403, 32419, 14)},
  6.         [4] = {itemid = 23657, position = Position(33404, 32419, 14)},
  7.         [5] = {itemid = 23656, position = Position(33405, 32419, 14)},
  8.         [6] = {itemid = 23657, position = Position(33406, 32419, 14)},
  9.         [7] = {itemid = 1495, position = Position(33403, 32418, 14)},
  10.         [8] = {itemid = 1495, position = Position(33404, 32418, 14)}
  11.     },
  12.     North = {
  13.         [1] = {itemid = 23659, position = Position(33407, 32414, 14)},
  14.         [2] = {itemid = 23658, position = Position(33407, 32415, 14)},
  15.         [3] = {itemid = 23660, position = Position(33407, 32416, 14)},
  16.         [4] = {itemid = 23659, position = Position(33407, 32417, 14)},
  17.         [5] = {itemid = 23660, position = Position(33407, 32418, 14)},
  18.         [6] = {itemid = 1495, position = Position(33406, 32415, 14)},
  19.         [7] = {itemid = 1495, position = Position(33406, 32416, 14)}
  20.     },
  21.     East = {
  22.         [1] = {itemid = 23656, position = Position(33408, 32419, 14)},
  23.         [2] = {itemid = 23657, position = Position(33409, 32419, 14)},
  24.         [3] = {itemid = 23656, position = Position(33410, 32419, 14)},
  25.         [4] = {itemid = 23655, position = Position(33411, 32419, 14)},
  26.         [5] = {itemid = 23657, position = Position(33412, 32419, 14)},
  27.         [6] = {itemid = 1495, position = Position(33408, 32418, 14)},
  28.         [7] = {itemid = 1495, position = Position(33409, 32418, 14)}
  29.     },
  30.     South = {
  31.         [1] = {itemid = 23659, position = Position(33407, 32420, 14)},
  32.         [2] = {itemid = 23660, position = Position(33407, 32421, 14)},
  33.         [3] = {itemid = 23659, position = Position(33407, 32422, 14)},
  34.         [4] = {itemid = 23658, position = Position(33407, 32423, 14)},
  35.         [5] = {itemid = 23660, position = Position(33407, 32424, 14)},
  36.         [6] = {itemid = 1495, position = Position(33406, 32420, 14)},
  37.         [7] = {itemid = 1495, position = Position(33406, 32421, 14)}
  38.     }
  39. }
  40. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  41.     if player:getStorageValue(Storage.FerumbrasAscension.TheShatterer) >= 1 then
  42.         player:sendCancelMessage('You cannot use this lever again.')
  43.         return true
  44.     end
  45.     if item.itemid == 9825 then
  46.         local creatures = Tile(Position(33406, 32418, 14)):getCreatures()
  47.         local creature = false
  48.         for _, pid in pairs(creatures)do
  49.             local monster = Monster(pid)
  50.             if monster and monster:getName():lower() == "the shatterer" then
  51.                 creature = monster
  52.                 break;
  53.             end
  54.         end
  55.         item:transform(9826)
  56.         if item:getPosition() == Position(33385, 32410, 14) then
  57.             for i = 1, #chains.West do
  58.                 local chain = chains.West[i]
  59.                 local bla = Tile(chain.position):getItemById(chain.itemid)
  60.                 if bla then
  61.                     bla:remove()
  62.                     Game.createMonster("Fury", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z })
  63.                 end
  64.             end
  65.             Game.setStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever, Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) + 1)
  66.             if Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) >= 4 then
  67.                 if creature and creature:getHealth() >= 1 then
  68.                     creature:say('The energies in the chamber refocus on The Shatterer.', TALKTYPE_MONSTER_SAY)
  69.                     creature:teleportTo(Position(33400, 32416, 14))
  70.                     creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  71.                     return true
  72.                 end
  73.             end
  74.         elseif item:getPosition() == Position(33403, 32391, 14) then
  75.                 for i = 1, #chains.North do
  76.                 local chain = chains.North[i]
  77.                 local bla = Tile(chain.position):getItemById(chain.itemid)
  78.                 if bla then
  79.                     bla:remove()
  80.                     Game.createMonster("Destroyer", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z })
  81.                 end
  82.             end
  83.             Game.setStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever, Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) + 1)
  84.             if Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) >= 4 then
  85.                 if creature and creature:getHealth() >= 1 then
  86.                     creature:say('The energies in the chamber refocus on The Shatterer.', TALKTYPE_MONSTER_SAY)
  87.                     creature:teleportTo(Position(33400, 32416, 14))
  88.                     creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  89.                     return true
  90.                 end
  91.             end
  92.         elseif item:getPosition() == Position(33430, 32418, 14) then
  93.             for i = 1, #chains.East do
  94.                 local chain = chains.East[i]
  95.                 local bla = Tile(chain.position):getItemById(chain.itemid)
  96.                 if bla then
  97.                     bla:remove()
  98.                 end
  99.             end
  100.             Game.setStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever, Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) + 1)
  101.             if Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) >= 4 then
  102.                 if creature and creature:getHealth() >= 1 then
  103.                     creature:say('The energies in the chamber refocus on The Shatterer.', TALKTYPE_MONSTER_SAY)
  104.                     creature:teleportTo(Position(33400, 32416, 14))
  105.                     creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  106.                     return true
  107.                 end
  108.             end
  109.         elseif item:getPosition() == Position(33410, 32441, 14) then
  110.             for i = 1, #chains.South do
  111.                 local chain = chains.South[i]
  112.                 local bla = Tile(chain.position):getItemById(chain.itemid)
  113.                 if bla then
  114.                     bla:remove()
  115.                 end
  116.             end
  117.             Game.setStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever, Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) + 1)
  118.             if Game.getStorageValue(GlobalStorage.FerumbrasAscendantQuest.TheShattererLever) >= 4 then
  119.                 if creature and creature:getHealth() >= 1 then
  120.                     creature:say('The energies in the chamber refocus on The Shatterer.', TALKTYPE_MONSTER_SAY)
  121.                     creature:teleportTo(Position(33400, 32416, 14))
  122.                     creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  123.                     return true
  124.                 end
  125.             end
  126.         end
  127.     elseif item.itemid == 9826 then
  128.         player:sendCancelMessage('Sorry, not possible.')
  129.         return true
  130.     end
  131.     return true
  132. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement