В коде все в порядке, где утекают так и не нашел 0_О
Такой простой код а каждый сек увеличивает лаги... Других триггеров нет!
Такой простой код а каждый сек увеличивает лаги... Других триггеров нет!
globals
constant real time_Interval = 1/32
timer text_move_Timer = CreateTimer()
integer text_move_Max = 0
texttag array text_move_FloatingText
unit array text_move_Target
real array text_move_Count
endglobals
function onEventTextMove takes nothing returns nothing
local integer i = 0
local real x
local real y
loop
exitwhen i >= text_move_Max
set text_move_Count[i] = text_move_Count[i] + time_Interval
if text_move_Count[i] <= 1.20 then
set x = GetUnitX(text_move_Target[i])
set y = GetUnitY(text_move_Target[i])
set x = x-22
set y = y+30
call SetTextTagPos(text_move_FloatingText[i], x, y, 0)
else
call DestroyTextTag(text_move_FloatingText[i])
set text_move_Max = text_move_Max - 1
set text_move_FloatingText[i] = text_move_FloatingText[text_move_Max]
set text_move_Target[i] = text_move_Target[text_move_Max]
set text_move_Count[i] = text_move_Count[text_move_Max]
set text_move_FloatingText[text_move_Max] = null
set text_move_Target[text_move_Max] = null
set text_move_Count[text_move_Max] = 0
set i = i - 1
if text_move_Max == 0 then
call PauseTimer(text_move_Timer)
endif
endif
set i = i + 1
endloop
endfunction
function onEventDamage takes nothing returns nothing
local unit unit_damage_Source = GetEventDamageSource()
local unit unit_damage_Target = GetTriggerUnit()
local real unit_damage_Taken = GetEventDamage()
local location unit_damage_Point = GetUnitLoc(unit_damage_Target)
if unit_damage_Taken > 0.00 then
if text_move_Max == 0 then
call TimerStart(text_move_Timer, time_Interval, true, function onEventTextMove)
endif
call CreateTextTagLocBJ(I2S(R2I(unit_damage_Taken)), unit_damage_Point, 0, 10.00, 100.00, 100.00, 100.00, 0.00 )
call SetTextTagVelocityBJ(GetLastCreatedTextTag(), 100.00, 90.00 )
call SetTextTagFadepointBJ(GetLastCreatedTextTag(), 1.00 )
call SetTextTagLifespanBJ(GetLastCreatedTextTag(), 1.20 )
call SetTextTagPermanentBJ(GetLastCreatedTextTag(), false )
call ShowTextTagForceBJ(false, GetLastCreatedTextTag(), GetPlayersAll() )
call ShowTextTagForceBJ(true, GetLastCreatedTextTag(), GetForceOfPlayer(GetOwningPlayer(unit_damage_Source)) )
set text_move_FloatingText[text_move_Max] = GetLastCreatedTextTag()
set text_move_Target[text_move_Max] = unit_damage_Target
set text_move_Count[text_move_Max] = 0
set text_move_Max = text_move_Max + 1
endif
call RemoveLocation( unit_damage_Point )
endfunction
function InitTrig_Damage_Show takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterUnitEvent( t, gg_unit_hfoo_0001, EVENT_UNIT_DAMAGED )
call TriggerRegisterUnitEvent( t, gg_unit_hfoo_0002, EVENT_UNIT_DAMAGED )
call TriggerAddAction( t, function onEventDamage )
endfunction
Принятый ответ
Sergey105, нет его 1раз запускают если они с нуля а так растет каждый атак +1 потом таймер удаляет его, причиной было это
constant real time_Interval = 1/32 тут почему то трабл таймер в мега скорость идет,
поэтому поставил constant real time_Interval = 0.03 и стало норм
поэтому поставил constant real time_Interval = 0.03 и стало норм
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
if text_move_Max == 0 then
call TimerStart(text_move_Timer, time_Interval, true, function onEventTextMove)
endif
поэтому поставил constant real time_Interval = 0.03 и стало норм
...до нуля. Напиши "1.0/32.0" и всё вылечится.
32.
.1
3.14
иначе поведение движка неопределено. ух сколько проблем я поимел с подобной херни.
triggerEvalCounter/20
без точки. Начиная с какой-то версии он начала баговать, возвращая целое, хотя до этого годами работал, возвращая дробное. Так что неопределено. Я этот код не менял вообще никак, целые числа оставались целыми, но подход движка изменился.