Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.73 KB | None | 0 0
  1. function onUse(cid, item, frompos, item2, topos)
  2.  
  3. --Config-->
  4. local statue_pos = {x=1164, y=746, z=10}
  5. local portal_quest01_pos = {x=1164, y=755, z=10, stackpos = 2}
  6. local portal_quest02_pos = {x=1165, y=757, z=9, stackpos = 2}
  7. local config = {
  8. fromPos = {x=1153,y=737,z=10}, -- posição superior esquerda do mapa, da area em que esta mapeado a area.
  9. toPos = {x=1173,y=755,z=10}, -- posição inferior direita do mapa, da area em que esta mapeado a area.
  10. boss = "Azerus" -- Aqui você bota o nome do monstro que você quer remover
  11.  }
  12. --End Config-->
  13.  
  14. function Potwory1()
  15. if math.random (1,8) == 4 then
  16. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  17. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  18. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  19. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  20. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  21. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  22. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  23. addEvent(Potwory2, 30 * 1000)
  24. else
  25. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  26. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  27. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  28. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  29. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  30. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  31. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  32. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  33. addEvent(Potwory2, 30 * 1000)
  34. end
  35. end
  36.  
  37. function Potwory2()
  38. doSummonCreature('Azerus3', {x = statue_pos.x-1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  39. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  40. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  41. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  42. addEvent(Potwory3, 35 * 1000)
  43. end
  44.  
  45. function Potwory3()
  46. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  47. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  48. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  49. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  50. addEvent(Potwory4, 40 * 1000)
  51. end
  52.  
  53. function Potwory4()
  54. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  55. doSummonCreature('Rat', {x = statue_pos.x+1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  56. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y+1, z = statue_pos.z, stackpos = 253})
  57. doSummonCreature('Rat', {x = statue_pos.x, y = statue_pos.y-1, z = statue_pos.z, stackpos = 253})
  58. doSummonCreature('Rat', {x = statue_pos.x-1, y = statue_pos.y, z = statue_pos.z, stackpos = 253})
  59. addEvent(NewPortal, 90 * 1000)
  60. end
  61.  
  62. function NewPortal()
  63. addEvent(RemoveAll, 60 * 1000)
  64.  
  65. end
  66.  
  67. function RemoveAll()
  68. doRemoveItem(getThingfromPos(portal_quest01_pos).uid,1)
  69. doRemoveItem(getThingfromPos(portal_quest02_pos).uid,1)
  70. end
  71.  
  72. function removeMonsterInArea(fromPos, toPos)
  73.   local positionsCheck = {}
  74.   for i = config.fromPos.x, config.toPos.x do
  75.    positionsCheck[#positionsCheck+1] = {x=i, y = config.fromPos.y, z = config.fromPos.z, stackpos = 0}
  76.    for j = config.fromPos.y+1, config.toPos.y do
  77.     positionsCheck[#positionsCheck+1] = {x=i, y = j, z = config.fromPos.z, stackpos = 0}
  78.    end
  79.   end
  80.   for j=1, #positionsCheck do
  81.    for i = 0, 255 do
  82.     positionsCheck[j].stackpos = i
  83.     local tile = getTileThingByPos(positionsCheck[j])
  84.     if isMonster(tile.uid) then
  85.     if getCreatureName(tile.uid) == config.boss then
  86.       doRemoveCreature(tile.uid)
  87.      end
  88.     end
  89.    end
  90.   end
  91. end
  92.  
  93. if item.uid == 11223 and getThingfromPos(portal_quest01_pos).itemid ~= 9772 then
  94. doCreateItem(9772,1,portal_quest01_pos)
  95. doCreateItem(9772,1,portal_quest02_pos)
  96. addEvent(Potwory1, 0)
  97. else
  98. doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
  99. end
  100. return TRUE
  101. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement