I would prefer we understand why, or when exactly it doesn't work, and potentially can fix it.
Thanks for encouraging me to make more tests.. It was worth it
Once again I took your proposal (version without 'wait') and start tests, and when bug appears game also prints debug message (in game):
"unit issued point order 852512 , grabtree".
Strange because it is a target order. I think order becomes 'point order' after dummy-tree was removed and unit had
no time to grab it. Why?
'Grab tree' ability requires from unit to be
directly in front of a tree.
If unit is moving, patroling, turning around patroling point - then if we order to stop, he stops. But his
facing angle may change (esspecialy when patroling and just turning back).
If this happends unit has no time to turn directly to the tree to grab it = bug.
Ordering stop will not help, but I found that SetUnitPosition + SetUnitFacing is the solution.
After SetUnitPosition + SetUnitFacing we create the tree in front of the unit and then there is no risk that unit will not grab the tree instantly.
Once agains thanks
IcemanBo you were right from the beginning with no-wait version
Reventhous thanks for your smart hints, I'll change system as you suggested. Let's keep it GUI, advanced mappers may write a function based on this idea in 3min. It supposed to be for GUI users.
Made test on this new version: 15min game with randomly switichng weapons for random units for few seconds = hundreds changes, while units still re-ordered to partol random points / fight with hostile. No bugs at all.