I'm having this really weird problem with a trigger. I've debugged extensively and yet I can't find a solution.
For some reason, the execution of a particular bit of code in that trigger stops at one point. Stops, just like that. I'm using a local trigger with a periodic event, and after that aforementioned point, it runs normally.
A simple example to illustrate the circumstances:
My spell works by damaging a fixed number of unique units one after another, and the part labelled Block 1 has some priority conditions for picking targets. If there are insufficient targets in the AoE, UnitB and UnitA both are set to null.
If, for instance, there are 3 targets and the spell targets on 5, UnitA and UnitB would be nulled after the third time the trigger runs, since UnitA and UnitB cannot be damaged again. That's where the problem is: at "Line in question", the execution stops. Everything after that line is bypassed, but yet the trigger runs normally after that and continuously damages UnitA. No new target is picked.
I'll clarify if you don't understand the problem. It seems to have something to do with UnitA and UnitB being null at that point. I've added all sorts of code before and after the line in question, and concluded that execution just stops there.
I remember this happening with the functions SetUnitX() and SetUnitY(), some time back. To correct the problem then, I replaced both with SetUnitPosition(); I've yet to find out why the latter worked.
I've spent a few days cracking my head over this and am incredibly frustrated. Any help at all would be appreciated.
For some reason, the execution of a particular bit of code in that trigger stops at one point. Stops, just like that. I'm using a local trigger with a periodic event, and after that aforementioned point, it runs normally.
A simple example to illustrate the circumstances:
JASS:
local trigger t = GetTriggeringTrigger()
local unit UnitA = (something)
local unit UnitB
call Function1()
call Damage(UnitA)
loop
exitwhen (some conditions)
If (some conditions) then // Block 1
set UnitB = (something)
endif
endloop
set UnitA = UnitB // Line in question
if UnitA == null then
call DestroyTrigger(t)
endif
My spell works by damaging a fixed number of unique units one after another, and the part labelled Block 1 has some priority conditions for picking targets. If there are insufficient targets in the AoE, UnitB and UnitA both are set to null.
If, for instance, there are 3 targets and the spell targets on 5, UnitA and UnitB would be nulled after the third time the trigger runs, since UnitA and UnitB cannot be damaged again. That's where the problem is: at "Line in question", the execution stops. Everything after that line is bypassed, but yet the trigger runs normally after that and continuously damages UnitA. No new target is picked.
I'll clarify if you don't understand the problem. It seems to have something to do with UnitA and UnitB being null at that point. I've added all sorts of code before and after the line in question, and concluded that execution just stops there.
I remember this happening with the functions SetUnitX() and SetUnitY(), some time back. To correct the problem then, I replaced both with SetUnitPosition(); I've yet to find out why the latter worked.
I've spent a few days cracking my head over this and am incredibly frustrated. Any help at all would be appreciated.