| 12-18-2006, 07:00 PM | #1 |
The problem is that when steps is down to 0 none of the then-actions is ever called. i know that it goes down to 0 and stays there because of the debugmsg (highlighted). Everything else works so there's nothing wrong with the gc. Now, spamm me with thoughts. JASS:function GhostShakeTarget_Child takes nothing returns nothing local timer t = GetExpiredTimer() local real x local real y local unit target local unit ghost local integer steps local string s = "Timer_"+I2S(H2I(t)) set ghost = I2U(GetStoredInteger(udg_gc,s,"Ghost")) set steps = GetStoredInteger(udg_gc,s,"Steps") call BJDebugMsg(I2S(steps)) if GetUnitState(ghost,UNIT_STATE_LIFE) <= 0.405 or steps == 0 then call SetUnitX(target,GetStoredReal(udg_gc,s,"OriginX")) call SetUnitY(target,GetStoredReal(udg_gc,s,"OriginY")) call SetUnitUserData(target,0) call FlushStoredMission(udg_gc,s) call PauseTimer(t) call DestroyTimer(t) else set target = I2U(GetStoredInteger(udg_gc,s,"Target")) set x = GetStoredReal(udg_gc,s,"OriginX") set y = GetStoredReal(udg_gc,s,"OriginY") if GetUnitX(target) != x and GetUnitY(target) != y then call SetUnitX(target,x) call SetUnitY(target,y) else call SetUnitX(target,x + GetStoredReal(udg_gc,s,"Power")*Cos(GetRandomReal(0.,6.28))) call SetUnitY(target,y + GetStoredReal(udg_gc,s,"Power")*Sin(GetRandomReal(0.,6.28))) endif call StoreInteger(udg_gc,s,"Steps",steps-1) endif set s = null set t = null set target = null set ghost = null endfunction function GhostShakeTarget takes unit ghost, unit target, real power, real update, real duration returns nothing local timer t local string s if GetUnitUserData(target) == 0 then call SetUnitUserData(target,1) set t = CreateTimer() set s = "Timer_"+I2S(H2I(t)) call StoreInteger(udg_gc,s,"Target",H2I(target)) call StoreInteger(udg_gc,s,"Ghost",H2I(ghost)) call StoreInteger(udg_gc,s,"Steps",R2I(duration/update)) call StoreReal(udg_gc,s,"Power",power) call StoreReal(udg_gc,s,"OriginX",GetUnitX(target)) call StoreReal(udg_gc,s,"OriginY",GetUnitY(target)) call TimerStart(t,update,true,function GhostShakeTarget_Child) endif set s = null set t = null endfunction |
| 12-18-2006, 07:23 PM | #2 |
"target" is uninitialized in the top branch. Give grimoire a try, it catches this. |
| 12-18-2006, 07:34 PM | #3 | |
oh, that was clumsy :/ thanks Quote:
|
