Advertisement
Guest User

Untitled

a guest
May 12th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. local magePositions = {
  2. Position(33328, 31859, 9),
  3. Position(33367, 31873, 9),
  4. Position(33349, 31899, 9)
  5. }
  6.  
  7. local positions = {
  8. Position(33313, 31852, 9),
  9. Position(33313, 31865, 9),
  10. Position(33313, 31881, 9),
  11. Position(33328, 31860, 9),
  12. Position(33328, 31873, 9),
  13. Position(33328, 31885, 9),
  14. Position(33308, 31873, 9),
  15. Position(33320, 31873, 9),
  16. Position(33335, 31873, 9),
  17. Position(33360, 31873, 9),
  18. Position(33336, 31914, 9),
  19. Position(33343, 31914, 9),
  20. Position(33353, 31914, 9),
  21. Position(33361, 31914, 9),
  22. Position(33345, 31900, 9),
  23. Position(33352, 31900, 9),
  24. Position(33355, 31854, 9),
  25. Position(33355, 31861, 9),
  26. Position(33355, 31885, 9),
  27. Position(33345, 31864, 9),
  28. Position(33345, 31881, 9),
  29. Position(33309, 31867, 9),
  30. Position(33317, 31879, 9),
  31. Position(33311, 31854, 9),
  32. Position(33334, 31889, 9),
  33. Position(33340, 31890, 9),
  34. Position(33347, 31889, 9)
  35. }
  36.  
  37. local servants = {
  38. 'iron servant',
  39. 'golden servant',
  40. 'diamond servant'
  41. }
  42.  
  43. local function fillFungus(fromPosition, toPosition)
  44. for x = fromPosition.x, toPosition.x do
  45. for y = fromPosition.y, toPosition.y do
  46. local position = Position(x, y, 9)
  47. local tile = Tile(position)
  48. if tile then
  49. local item = tile:getItemById(13590)
  50. if item then
  51. item:transform(math.random(13585, 13589))
  52. position:sendMagicEffect(CONST_ME_YELLOW_RINGS)
  53. end
  54. end
  55. end
  56. end
  57. end
  58.  
  59. local function summonServant(position)
  60. Game.createMonster(servants[math.random(#servants)], position)
  61. position:sendMagicEffect(CONST_ME_TELEPORT)
  62. end
  63.  
  64. function onKill(creature, target)
  65.  
  66. local targetMonster = target:getMonster()
  67. if not targetMonster then
  68. return true
  69. end
  70.  
  71. if not isInArray(servants, targetMonster:getName():lower()) then
  72. return true
  73. end
  74.  
  75. local wave, killedAmount = Game.getStorageValue(984), Game.getStorageValue(985)
  76. if killedAmount == #positions and wave < 15 then
  77. Game.setStorageValue(985, 0)
  78. Game.setStorageValue(984, wave + 1)
  79.  
  80. for i = 1, #positions do
  81. addEvent(summonServant, 5 * 1000, positions[i])
  82. end
  83.  
  84. elseif killedAmount < #positions and wave < 15 then
  85. Game.setStorageValue(985, killedAmount + 1)
  86.  
  87. elseif killedAmount == #positions and wave == 15 then
  88. Game.createMonster('mad mage', magePositions[math.random(#magePositions)])
  89. targetMonster:say('The Mad Mage has been spawned!', TALKTYPE_MONSTER_SAY)
  90. fillFungus({x = 33306, y = 31847}, {x = 33369, y = 31919})
  91. end
  92. return true
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement