| 10-17-2006, 04:05 AM | #1 |
Well my ice slide trigger at map initilization instantly freezes me o_O so laggy! JASS:function Trig_Slide_Trigger_Actions takes nothing returns nothing local integer i = 1 local location L loop exitwhen i > 3 set L = GetUnitLoc( udg_Slider[i] ) if GetTerrainTypeBJ(L) == 'Lgrd' then call SetUnitPositionLoc( udg_Slider[i], PolarProjectionBJ(L, 13.00, GetUnitFacing(udg_Slider[i])) ) set i = ( i + 1 ) call RemoveLocation(L) endif endloop endfunction //=========================================================================== function InitTrig_Slide_Trigger takes nothing returns nothing set gg_trg_Slide_Trigger = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Slide_Trigger, 0.03 ) call TriggerAddAction( gg_trg_Slide_Trigger, function Trig_Slide_Trigger_Actions ) endfunction hmm, can 2 local variables be used in different triggers? JASS:function Trig_Death_Trigger_Actions takes nothing returns nothing local location L local integer i loop exitwhen i > 3 set L = GetUnitLoc( udg_Slider[i] ) set i = ( i + 1 ) if GetTerrainTypeBJ(L) == 'Lrok' then call KillUnit ( udg_Slider[i] ) call RemoveLocation(L) endif endloop endfunction //=========================================================================== function InitTrig_Death_Trigger takes nothing returns nothing set gg_trg_Death_Trigger = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Death_Trigger, 0.12 ) call TriggerAddAction( gg_trg_Death_Trigger, function Trig_Death_Trigger_Actions ) endfunction can anyone help? |
| 10-17-2006, 04:08 AM | #2 |
You are never cleaning the variable returned by PolarProjectionBJ |
| 10-17-2006, 04:10 AM | #3 |
Uhm, What variable o_O? lol I dont see it :/ Do i have to do I like have to type call RemoveLocation(PolarProjectionBJ) or something lol? isnt this calling it? isnt this doing it? call RemoveLocation(L) (obviously not, but what other variable do I have to clean XD?) |
| 10-17-2006, 04:16 AM | #4 |
JASS:function Trig_Slide_Trigger_Actions takes nothing returns nothing local integer i = 1 local location L local location lp loop exitwhen i > 3 set L = GetUnitLoc( udg_Slider[i] ) if GetTerrainTypeBJ(L) == 'Lgrd' then set lp=PolarProjectionBJ(L, 13.00, GetUnitFacing(udg_Slider[i])) call SetUnitPositionLoc( udg_Slider[i], lp ) call RemoveLocation(lp) set i = ( i + 1 ) call RemoveLocation(L) endif endloop // handles that are removed still leak 4 bytes if a function that used them as local variables keeps holding a reference of them, so set these to null set lp=null set L=null endfunction |
| 10-17-2006, 06:48 AM | #5 |
Still lags like crazy, I have seen ppl using X Y & A, as reals in slide trigger, is that better ? JASS:function Trig_Slide_Trigger_Actions takes nothing returns nothing local integer i = 1 local location L2 local location L loop exitwhen i > 3 set L = GetUnitLoc( udg_Slider[i] ) if GetTerrainTypeBJ(L) == 'Lgrd' then set L2 = PolarProjectionBJ(L, 13.00, GetUnitFacing(udg_Slider[i])) call SetUnitPositionLoc( udg_Slider[i], L2 ) call RemoveLocation(L2) call RemoveLocation(L) set i = ( i + 1 ) endif endloop set L2 = null set L = null endfunction //=========================================================================== function InitTrig_Slide_Trigger takes nothing returns nothing set gg_trg_Slide_Trigger = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Slide_Trigger, 0.03 ) call TriggerAddAction( gg_trg_Slide_Trigger, function Trig_Slide_Trigger_Actions ) endfunction |
| 10-17-2006, 07:05 AM | #6 |
Hmm the loop is infinite if the unit is not on ice, and L is never cleared if unit is not on ice either. Can't post a working script now since i have to go to school |
| 10-17-2006, 07:16 AM | #7 |
I am trying this now JASS:function Trig_Slide_Actions takes nothing returns nothing local real x local real y local real a local integer i = 1 loop exitwhen i > 3 set x = GetUnitX(udg_Slider[i]) set y = GetUnitY(udg_Slider[i]) if GetTerrainType(x, y) == 'Lgrd' then set a = GetUnitFacing(udg_Slider[i])*bj_RADTODEG call SetUnitPosition(udg_Slider[i], x + 13*Cos(a), y + 13*Sin(a)) endif set i = ( i + 1 ) endloop endfunction //=========================================================================== function InitTrig_Slide takes nothing returns nothing set gg_trg_Slide = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Slide, 0.03 ) call TriggerAddAction( gg_trg_Slide, function Trig_Slide_Actions ) endfunction FIXED, changed it to DEGTORAD |
| 10-17-2006, 05:07 PM | #8 |
are you sure your death trigger works? you aren't declaring your integer i there so it would just be counting null + 1 |
