JASS:
library SpellSystem
// NOTICE: This system uses DAMAGE POINT!
struct line
unit c
real x
real y
real tx
real ty
string fx
integer n
real dmg
real dmgaoe
static method make takes nothing returns line
local line l = line.allocate()
local integer i = 0
local real dx = l.tx - l.x
local real dy = l.ty - l.y
local real dist = SquareRoot(dx * dx + dy * dy) / l.n
local real angle = Atan2(l.ty - l.y, l.tx - l.x)
local real px
local real py
loop
set i = i + 1
exitwhen i > l.n
set px = l.x + (dist * i) * Cos(angle)
set py = l.y + (dist * i) * Sin(angle)
call DestroyEffect(AddSpecialEffect(l.fx, px, py))
call UnitDamagePoint(l.c, 0, l.dmgaoe, px, py, l.dmg, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endloop
return l
endmethod
method GetLastCreatedLine takes nothing returns line
return 0
endmethod
endstruct
endlibrary
As some of you might know, I have never been good at structs. Now, I'm trying to make it so that you can create different spell stuff with some structs. Somehow, my make() doesn't execute, when I do this:
JASS:
library test requires SpellSystem
function Trig_test_Actions takes nothing returns nothing
local line l = line.create()
set l.x = GetUnitX(udg_unit[1])
set l.y = GetUnitY(udg_unit[1])
set l.tx = GetUnitX(udg_unit[2])
set l.ty = GetUnitY(udg_unit[2])
set l.fx = "Abilities\\Weapons\\ChimaeraLightningMissile\\ChimaeraLightningMissile.mdl"
set l.n = 5
set l.dmg = 0
set l.dmgaoe = 0
call l.make()
endfunction
//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
call TimerStart(CreateTimer(), 1, false, function Trig_test_Actions)
endfunction
endlibrary
Any ideas?