- Joined
- Jul 14, 2011

- Messages
- 3,213

JASS:

```
local unit Caster = GetEnumUnit()
local real CasterX = GetUnitX(Caster)
local real CasterY = GetUnitY(Caster)
local unit BeamCharge
local real x = CasterX + 500 * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
local real y = CasterY + 500 * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
local group g = CreateGroup()
local real Radians
if GetUnitCurrentOrder(u) == OrderId("channeling") then
set BeamCharge = CreateUnit(p, 'h000', x, y, bj_UNIT_FACING)
call UnitApplyTimedLife(BeamCharge, 'BTLF', 1)
call GroupEnumUnitsInRange(g, CasterX, CasterY, 500, null)
loop
set BeamCharge = FirstOfGroup(g)
exitwhen BeamCharge == null
if (GetUnitTypeId(BeamCharge) == 'h000') then
set Radians = Atan2(CasterY-GetUnitY(BeamCharge), CasterX-GetUnitX(BeamCharge))
call SetUnitX(BeamCharge, CasterX+Cos(Radians)*25)
call SetUnitY(BeamCharge, CasterY+Cos(Radians)*25)
endif
call GroupRemoveUnit(g,BeamCharge)
endloop
call DestroyGroup(g)
set Caster = null
set BeamCharge = null
```