Hi, I coded a spell in JASS. That creates terrain deformations and special effects in a line. It is based on shockwave. So it also damages. Problem is: When my spell is casted, a great lag starts. Where does my trigger leak? Thanks for help..
JASS:
function Trig_ES_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A001039; // Büyünün Raw Value si
endfunction
function Trig_ES_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local integer z = 50 // Kac Range de bir efekt olcak
local real array x
local real array y
local integer i = 3
local real r = 800 // Büyünün Rangei
local integer loops
local integer level
local real angle
local string ef1 = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
set x[3] = GetUnitX(u)
set y[3] = GetUnitY(u)
set x[2] = GetLocationX(GetSpellTargetLoc())
set y[2] = GetLocationY(GetSpellTargetLoc())
set x[1] = x[2] - x[3]
set y[1] = y[2] - y[3]
set loops = R2I(r) / z
set angle = bj_RADTODEG * Atan2(y[2] - y[3], x[2] - x[3])
loop
exitwhen i == loops + 3
set i = i + 1
set x<i> = x[i-1] + I2R(z) * Cos(angle * bj_DEGTORAD)
set y<i> = y[i-1] + I2R(z) * Sin(angle * bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(ef1, x<i>, y<i>))
call TerrainDeformCrater(x<i>, y<i>, 150., 75, 0, false)
endloop
call TriggerSleepAction(10)
set i = 3
loop
exitwhen i == loops + 3
set i = i + 1
set x<i> = x[i-1] + I2R(z) * Cos(angle * bj_DEGTORAD)
set y<i> = y[i-1] + I2R(z) * Sin(angle * bj_DEGTORAD)
call TerrainDeformCrater(x<i>, y<i>, 150., -75, 0, false)
endloop
endfunction
/////////////////////////////////
/////////////////////////////////
function InitTrig_ES takes nothing returns nothing
local trigger ES = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( ES, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( ES, Condition( function Trig_ES_Conditions ) )
call TriggerAddAction( ES, function Trig_ES_Actions )
endfunction</i></i></i></i></i></i></i></i></i></i>