Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,226
In short, I want to give a player +1 lumber each time a worker attacks/harvests a tree.
I thought of a few ideas but none of them are good.
1. every X seconds check health of every single tree in the game and compare it to the hp when last checked. However I think a destructable group got a limit of 64 and I got a lot of trees in my map. This would also be very inefficient.
2. check when unit is ordered to harvest a tree, store the targeted tree into a variable and then keep track of the hp of that specific tree in a loop. This is what I am rolling with atm but it seems kinda.. bad.. somehow.
3. check when unit attacks and then give +1 lumber. I am not even sure if the event works on destructables and even so it's buggy since you could get lumber by canceling the animation.
4. checking for the current order id in a loop trigger and give player lumber every -animation length- seconds. This would be buggy since the issued order can be given from far away and the player would therefore be getting lumber by running to the tree.
I thought of a few ideas but none of them are good.
1. every X seconds check health of every single tree in the game and compare it to the hp when last checked. However I think a destructable group got a limit of 64 and I got a lot of trees in my map. This would also be very inefficient.
2. check when unit is ordered to harvest a tree, store the targeted tree into a variable and then keep track of the hp of that specific tree in a loop. This is what I am rolling with atm but it seems kinda.. bad.. somehow.
3. check when unit attacks and then give +1 lumber. I am not even sure if the event works on destructables and even so it's buggy since you could get lumber by canceling the animation.
4. checking for the current order id in a loop trigger and give player lumber every -animation length- seconds. This would be buggy since the issued order can be given from far away and the player would therefore be getting lumber by running to the tree.