Alright, I just fixed a strange bug.
I had a trigger that would use a global to a.) deal damage and b.) create a floating text.
There was nothing between both function calls. They were back to back.
Yet somehow the the damage would be dealt but the floating text would always be 0.
Turns out the damage would cause another trigger with "EVENT_UNIT_DAMAGED" to fire and that function was using the same global.
Until now I was under the believe that event handlers firing mid tick would get pushed to the end of the stack or atleast behind the current function, but it looks like they get put on top of it instead.
Meaning that the game would execute the first half of my function, then an entirely different function that I didn't directly call and then the second half of my starting function.
Now my question, does it work like that for all Event Handlers? Do they just work like function calls?
If yes, why haven't I seen anyone talking about it?
I have been mapping (and lurking on here) for years now and this seems like the kind of bug new map makers would run into all the time.
I had a trigger that would use a global to a.) deal damage and b.) create a floating text.
There was nothing between both function calls. They were back to back.
Yet somehow the the damage would be dealt but the floating text would always be 0.
Turns out the damage would cause another trigger with "EVENT_UNIT_DAMAGED" to fire and that function was using the same global.
Until now I was under the believe that event handlers firing mid tick would get pushed to the end of the stack or atleast behind the current function, but it looks like they get put on top of it instead.
Meaning that the game would execute the first half of my function, then an entirely different function that I didn't directly call and then the second half of my starting function.
Now my question, does it work like that for all Event Handlers? Do they just work like function calls?
If yes, why haven't I seen anyone talking about it?
I have been mapping (and lurking on here) for years now and this seems like the kind of bug new map makers would run into all the time.