Уже задавал ранее вопрос почему были утечки - мне сказали и я разобрался но теперь не могу понять как правильно написать смешение переменной count и уничтожить структуру данного юнита по окончанию время действия .
struct DEfD
unit cast
unit targ
real damag
effect eff
real duration

method FuncDotUnit takes nothing returns nothing
    call UnitDamageTarget(this.cast,this.targ, 50, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
    set this.duration=this.duration-1.00
endmethod


static method UpdateFunc takes nothing returns nothing
integer i=0
loop
   set i = i+1
   call StructDot[i].FuncDotUnit()
   if (StructDot[i].duration ==0.00) then

       set StructDot[i].targ = null
       set StructDot[i].cast = null
       call DestroyEffect(StructDot[i].eff)
       set StructDot[i].eff = null
      // call StructDot[i].destroy()   // не правильно
      // set count=count-1              // не правильно 
   endif
   exitwhen i==count
endloop
   set i=0

endmethod

static timer TimerDot=null
static integer count=0
static DEfD StructDot[]

static method AddUnitDot takes unit ca, unit ta, string ef returns nothing

set count=count+1
set StructDot[count]=DEfD.create()
set StructDot[count].cast=ca
set StructDot[count].targ=ta
set StructDot[count].eff = AddSpecialEffectTarget(ef,ta,"origin")
set StructDot[count].duration=6.00
if (TimerDot==null)then
set TimerDot=CreateTimer()
call TimerStart(TimerDot,1.00,true,function DEfD.UpdateFunc)
endif
endmethod

endstruct

Sergey105, здесь здесь пример со стеком, думаю там есть то, что тебе нужно
`
ОЖИДАНИЕ РЕКЛАМЫ...
7
Sergey105, здесь здесь пример со стеком, думаю там есть то, что тебе нужно
Принятый ответ
Чтобы оставить комментарий, пожалуйста, войдите на сайт.