| 07-04-2009, 08:35 PM | #1 |
Somehow, the dat.aa becomes null and I'm almost certain the problem is not with TimerUtils. Bugs with both 1.24 and 1.23b. JASS:scope RoadKill initializer Init globals private constant real INTERVAL = 0.1 private constant real AOE = 275. endglobals //================================================================= private struct Road unit aa timer t static unit Pass private method onDestroy takes nothing returns nothing call ReleaseTimer( .t ) call GroupRefresh( ENUM_GROUP ) endmethod private static method Ground takes nothing returns boolean return IsAlive( GetFilterUnit() ) and GetFilterUnit() != Road.Pass endmethod private static method Callback takes nothing returns nothing local Road dat = GetTimerData( GetExpiredTimer() ) call BJDebugMsg(GetUnitName(dat.aa)) //this shows (null) if IsAlive( dat.aa ) then call BJDebugMsg("run") set Road.Pass = dat.aa call GroupEnumUnitsInRange( ENUM_GROUP, GetUnitX( dat.aa ), GetUnitY( dat.aa ), AOE, Condition( function Road.Ground ) ) call UnitDamageTarget( dat.aa, FirstOfGroup( ENUM_GROUP ), 99999, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS ) else call BJDebugMsg("end") call dat.destroy() endif endmethod static method startKilling takes unit a returns Road local Road dat = Road.allocate() set dat.aa = a set dat.t = NewTimer() call BJDebugMsg(GetUnitName(dat.aa)) //this actually shows the name call SetTimerData( dat.t, dat ) call TimerStart( dat.t, INTERVAL, true, function Road.Callback ) return dat endmethod endstruct //================================================================= private function Actions takes nothing returns nothing call Road.startKilling( GetTriggerUnit() ) endfunction private function Conditions takes nothing returns boolean return GetUnitAbilityLevel( GetTriggerUnit(), 'A007' ) > 0 endfunction private function Init takes nothing returns nothing call UnitEnterEvent( Condition( function Conditions ), function Actions, bj_mapInitialPlayableArea ) endfunction endscope |
| 07-04-2009, 09:10 PM | #2 |
Maybe it happens when the unit is removed by the function RemoveUnit or when the unit is removed by the game (end of decay, some abilities like finger of death, explode unit, etc ...) ? |
| 07-04-2009, 09:11 PM | #3 |
No, i'm certain there are no outside influences. I never ever see the "run" msg. |
| 07-04-2009, 09:13 PM | #4 | |
Quote:
|
| 07-04-2009, 09:20 PM | #5 |
JASS:library IsAlive function IsAlive takes unit a returns boolean return GetWidgetLife( a ) > 0.406 endfunction endlibrary EDIT: What the hell. It simply doesn't work on preplaced units. I created a unit ingame and it worked. |
| 07-04-2009, 09:49 PM | #6 | |
Quote:
i guess this will then be because your event runs at map init, and therefor bugs with struct/libtrary initializers. simply make it run after a 0.0 timer, that should solve. |
| 07-05-2009, 11:08 AM | #7 |
Preplaced units are created before any initializer but you can enum them. Also it's > 0.405 |
| 07-06-2009, 12:28 AM | #8 | |
Quote:
|
| 07-06-2009, 03:43 PM | #9 | |
Quote:
Personally i use also this one, i don't care about the performance "issue", it should be safer, but i remember that Vexorian thought it isn't. |
| 07-06-2009, 08:17 PM | #10 | |
Quote:
|
| 07-06-2009, 08:20 PM | #11 |
I see, thx. |
