There is no way to detect that - there is no event that would tell you which wisp gathered lumber at the time.
All options I could think about have some drawbacks:
Option 1:
Use this event:
-
Player - Your_Player's Current lumber becomes Greater than 0.00
This event fires any time your lumber amount changes. But it tells you just that, nothing else. So you don't know if it was gathered, or because hero bought/sold item or because you spent lumber on unit training, or whatever else.
Given that you could keep track of player's previous amount of lumber and use that to determine if the lumber gained was +5 (and thus assume it was by wisp), unless the player has only a single wisp then you still don't know which wisp did it.
Option 2:
For each wisp that begins gathering wood, start a repeating timer that matches its interval to the wisp's gathering interval. Any time the timer expires, reduce tree's life. The problem here is that you don't know when is wisp flying towards a tree and when it begins gathering (since the current order for both is the same). You also don't know for sure which tree the wisp will gather from (for example: order 2 wisps to gather from same tree - one will occupy the targeted tree and the second will choose a random tree nearby). The only solution here would be to run a trigger that fires every ~0.02 seconds and for each wisp that was ordered to gather wood, but does not yet do that, pick all destructibles nearby and check if picked wisp is on top of any of the picked tree. If so, you know it started harvesting, so you can start its timer.
The disadvantage here is that you basically have 2 timers (the default gathering timer from wisp's gather ability, and your own timer in triggers) and hope that they match or the difference between both timers' start times is very tiny.
Option 3:
Trigger the entire wood harvesting yourself. You could have just a single timer, so you would know which wisp gathered which wood when. The disadvantage is that you would need to mirror the default harvesting behavior in your triggers (like the behavior when 2 wisps ordered to harvest same tree, etc.) which could prove challenging.