Advertisement
Guest User

azerus.lua

a guest
Sep 1st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.00 KB | None | 0 0
  1. -- Config #1 --  
  2. local BlindField = {x=1085, y=587, z=10, stackpos=1}
  3. -- end --  
  4.  
  5. function mapArea(fromPos, toPos, stack)
  6.         -- Area iterator by Colandus.
  7.         local pos = {x=fromPos.x, y=fromPos.y-1, z=fromPos.z}
  8.         return function()
  9.                 if (pos.y < toPos.y) then
  10.                         pos.y = pos.y+1
  11.                 elseif (pos.x <= toPos.x) then
  12.                         pos.y = fromPos.y
  13.                         pos.x = pos.x+1
  14.                 else
  15.                         pos.x = fromPos.x
  16.                         pos.y = fromPos.y
  17.                         pos.z = pos.z+1
  18.                 end
  19.                 if (pos.x <= toPos.x and pos.y <= toPos.y or pos.z < toPos.z) then
  20.                         if (stack == nil) then
  21.                                 return pos
  22.                         else
  23.                                 pos.stackpos = stack
  24.                                 --return pos, getTileThingByPos(pos)
  25.                                 return pos, getThingfromPos(pos)
  26.                         end
  27.                 end
  28.         end
  29. end
  30.  
  31.  
  32. function getMonstersfromArea(fromPos, toPos)
  33.         local monsters = {}    
  34.         for _, thing in mapArea(fromPos, toPos, 253) do
  35.                 if isMonster(thing.uid) == TRUE then
  36.                         table.insert(monsters, thing.uid)
  37.             end
  38.  
  39.         end
  40.           local bfm = getThingfromPos(BlindField)
  41.             if isMonster(bfm.uid) == TRUE then
  42.             table.insert(monsters, bfm.uid)
  43.             end
  44.         return monsters
  45. end
  46.  
  47.  
  48. function onUse(cid, item, fromPosition, itemEx, toPosition)
  49.     local topLeft = {x=1080, y=589, z=10}
  50.     local buttomRight = {x=1093, y=606, z=10}
  51.     local monsters = getMonstersfromArea(topLeft, buttomRight)
  52.     local monsters1 = getMonstersfromArea(topLeft, buttomRight)
  53.     local tp = {x=1087, y=605, z=10}
  54.     local glo = {x=1087, y=596, z=10}
  55.  
  56.     local function FirstWave()
  57.         doSummonCreature("Rift Worm", {x= glo.x - 4,y=glo.y,z=glo.z})
  58.         doSummonCreature("Rift Worm", {x= glo.x + 4,y=glo.y,z=glo.z})
  59.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 4,z=glo.z})
  60.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y - 4,z=glo.z})
  61.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 5,z=glo.z})
  62.         doSummonCreature("Azerus", {x=glo.x,y=glo.y - 5,z=glo.z})
  63.     end
  64.     local function FifthWave()
  65.         doSummonCreature("Rift Worm", {x= glo.x - 4,y=glo.y,z=glo.z})
  66.         doSummonCreature("Rift Worm", {x= glo.x + 4,y=glo.y,z=glo.z})
  67.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 4,z=glo.z})
  68.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y - 4,z=glo.z})
  69.         doSummonCreature("Rift Worm", {x=glo.x,y=glo.y + 5,z=glo.z})
  70.     end
  71.  
  72.     local function SecondWave()
  73.         local monsters1 = getMonstersfromArea(topLeft, buttomRight)
  74.         for _, monster in pairs(monsters1) do
  75.             if getCreatureName(monster) == "Azerus" then
  76.                 doRemoveCreature(monster)
  77.             end
  78.         end
  79.        
  80.         doSummonCreature("Azerus1", {x=glo.x,y=glo.y - 5,z=glo.z})
  81.         doSummonCreature("Rift Brood", {x= glo.x - 4,y=glo.y,z=glo.z})
  82.         doSummonCreature("Rift Brood", {x= glo.x + 4,y=glo.y,z=glo.z})
  83.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 4,z=glo.z})
  84.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y - 4,z=glo.z})
  85.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 5,z=glo.z})
  86.     end
  87.     local function SixthWave()
  88.         doSummonCreature("Rift Brood", {x= glo.x - 4,y=glo.y,z=glo.z})
  89.         doSummonCreature("Rift Brood", {x= glo.x + 4,y=glo.y,z=glo.z})
  90.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 4,z=glo.z})
  91.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y - 4,z=glo.z})
  92.         doSummonCreature("Rift Brood", {x=glo.x,y=glo.y + 5,z=glo.z})
  93.     end
  94.    
  95.     local function ThirdWave()
  96.         local monsters1 = getMonstersfromArea(topLeft, buttomRight)
  97.  
  98.         for _, monster in pairs(monsters1) do
  99.             if getCreatureName(monster) == "Azerus" then
  100.                 doRemoveCreature(monster)
  101.             end
  102.         end
  103.         doSummonCreature("Azerus2", {x= glo.x - 5,y=glo.y,z=glo.z})
  104.         doSummonCreature("Rift Scythe", {x= glo.x - 4,y=glo.y,z=glo.z})
  105.         doSummonCreature("Rift Scythe", {x= glo.x + 4,y=glo.y,z=glo.z})
  106.         doSummonCreature("Rift Scythe", {x= glo.x + 4,y=glo.y,z=glo.z})
  107.         doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y + 4,z=glo.z})
  108.     end
  109.  
  110.     local function ThirdWave1() --  with 2s delay
  111.         doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y + 4,z=glo.z})
  112.         doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y - 4,z=glo.z})
  113.         doSummonCreature("Rift Scythe", {x=glo.x,y=glo.y + 5,z=glo.z})
  114.     end
  115.  
  116.     local function FourthWave()
  117.         doSummonCreature("War Golem", {x= glo.x - 4,y=glo.y,z=glo.z})
  118.         doSummonCreature("War Golem", {x= glo.x + 4,y=glo.y,z=glo.z})
  119.         doSummonCreature("War Golem", {x=glo.x,y=glo.y - 4,z=glo.z})
  120.         doSummonCreature("War Golem", {x=glo.x,y=glo.y + 4,z=glo.z})
  121.     end
  122.  
  123.     local function SevenWave()
  124.         local monsters1 = getMonstersfromArea(topLeft, buttomRight)
  125.         for _, monster in pairs(monsters1) do
  126.             if getCreatureName(monster) == "Azerus" then
  127.                 doRemoveCreature(monster)
  128.             end
  129.         end
  130.        
  131.         doSummonCreature("Azerus3", {x= glo.x - 5,y=glo.y,z=glo.z})
  132.         doSummonCreature("War Golem", {x= glo.x - 4,y=glo.y,z=glo.z})
  133.         doSummonCreature("War Golem", {x= glo.x + 4,y=glo.y,z=glo.z})
  134.         doSummonCreature("War Golem", {x=glo.x,y=glo.y - 4,z=glo.z})
  135.         doSummonCreature("War Golem", {x=glo.x,y=glo.y + 4,z=glo.z})
  136.     end
  137.  
  138.     local function Glllobe()
  139.         local monst = getMonstersfromArea(topLeft, buttomRight)
  140.         for i = 1, #monst do
  141.             doRemoveCreature(monst[i])
  142.  
  143.         end
  144.  
  145.         local item1 = getTileItemById(glo, 9767)
  146.         doItemSetAttribute(item1.uid, "aid", 58261)
  147.     end
  148.  
  149.     local function createWall(p)
  150.         local janek = doCreateItem(1387,1,{x=1088, y=607, z=9})
  151.         doItemSetAttribute(janek, "aid", 9105)
  152.     end
  153.  
  154.     local function createWalll(i)
  155.         local ela = doCreateItem(1387,1,{x=1087, y=605, z=10})
  156.         doItemSetAttribute(ela, "aid", 9106)
  157.     end
  158.    
  159.     local wall0 = {x=1088, y=607, z=9, stackpos=1}
  160.     local getwall0 = getThingfromPos(wall0)
  161.     local wall1 = {x=1087, y=605, z=10, stackpos=1}
  162.     local getwall1 = getThingfromPos(wall1)
  163.     local monsters = getMonstersfromArea(topLeft, buttomRight)
  164.     local monsters1 = getMonstersfromArea(topLeft, buttomRight)
  165.     local tele_chk = getTileItemById(tp, 1387)
  166.     if item.actionid == 58261 then
  167.         doItemSetAttribute(item.uid, "aid", 58263)
  168.     end
  169.  
  170.     if tele_chk.uid > 0 then
  171.         doRemoveItem(getTileItemById(tp,1387).uid)
  172.         doRemoveItem(getwall0.uid,1)
  173.         addEvent(FirstWave, 0)
  174.         addEvent(FifthWave, 30000)
  175.         addEvent(SecondWave, 60000)
  176.         addEvent(SixthWave, 90000)
  177.         addEvent(ThirdWave, 120000)
  178.         addEvent(ThirdWave1, 150000)
  179.         addEvent(FourthWave, 180000)
  180.         addEvent(SevenWave, 210000)
  181.         addEvent(Glllobe, 400000)  
  182.         p = {wallid = getwall0.itemid}
  183.         addEvent(createWall, 300*1000, p)
  184.         i = {wallid = getwall1.itemid}
  185.         addEvent(createWalll, 300*1000, i)
  186.     end
  187.    
  188.     if item.actionid == 58263 then
  189.         doCreatureSay(cid, "You have to wait some time before this globe will charge.", TALKTYPE_ORANGE_1)
  190.     end
  191.     return TRUE
  192. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement