Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. function solarBeam(cid, positions, c)
  2.     if not isCreature(cid) then return true end
  3.     if #positions == 0 then
  4.         local effect = {
  5.             [0] = {
  6.                 [1] = {{x = 0, y= -1}, 118},
  7.                 [2] = {{x = 0, y= -2}, 117},
  8.                 [3] = {{x = 0, y= -3}, 117},
  9.                 [4] = {{x = 0, y= -4}, 119},
  10.             },
  11.             [1] = {
  12.                 [1] = {{x = 1, y= 0}, 110},
  13.                 [2] = {{x = 2, y= 0}, 112},
  14.                 [3] = {{x = 3, y= 0}, 112},
  15.                 [4] = {{x = 4, y= 0}, 111},
  16.             },
  17.             [2] = {
  18.                 [1] = {{x = 0, y= 1}, 115},
  19.                 [2] = {{x = 0, y= 2}, 117},
  20.                 [3] = {{x = 0, y= 3}, 117},
  21.                 [4] = {{x = 0, y= 4}, 116},
  22.  
  23.             },
  24.             [3] = {
  25.                 [1] = {{x = -1, y= 0}, 113},
  26.                 [2] = {{x = -2, y= 0}, 112},
  27.                 [3] = {{x = -3, y= 0}, 112},
  28.                 [4] = {{x = -4, y= 0}, 114},
  29.             }
  30.         }
  31.  
  32.         for status = 1, 4 do
  33.             local dir = effect[Creature(cid):getDirection()][status]
  34.             c.pos = Creature(cid):getPosition()
  35.             local pos = {x = c.pos.x + dir[1].x, y = c.pos.y + dir[1].y, z = c.pos.z}
  36.             doAreaCombatHealth(c.cid, c.type, pos, 0, c.min, c.max, dir[2])
  37.         end
  38.         return true
  39.     end
  40.     local randomPos = math.random(1, #positions)
  41.     doSendDistanceShoot(positions[randomPos], Creature(cid):getPosition(), 38)
  42.     doSendMagicEffect(Creature(cid):getPosition(), 40)
  43.     table.remove(positions, randomPos)
  44.     addEvent(solarBeam, 300, cid, positions, c)
  45. end
  46.  
  47. function onCastSpell(cid, var)
  48.     local c = spellConfig(cid, "Solar Beam")
  49.     local positions = {}
  50.     for x = -1, 1 do
  51.         for y = -1, 1 do
  52.             table.insert(positions, {x = c.pos.x + x, y = c.pos.y + y, z = c.pos.z})
  53.         end
  54.     end
  55.     solarBeam(cid, positions, c)
  56.     return true
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement