No, not via addmagazine...
They will rearm when you give them the rearm action, but they won't move to the ammobox. It's like the "hidebody" action from a SpecialOps, when you use it on a body miles away it still sinks into the ground. Actually a nice way to remove bodies...
Maybe you can force him to run back to his position by a switchmove command that makes him run forward, you just have to find the compasheading between ammobox an unit and after he rearmed between unit and trenchposition (with dirtoobj.sqf)
Then slew him in the right direction. (I never tried it before)
I think they did something like that with the rappelscript, the officer rappels down, moves forward via switchmove, chrouches and all the other lay down in a perimeter around the chopper.
But it all depends how far the ammobox is from the unit...
How many switchmoves are needed before the unit is in the right place?
Otherwise, it won't be cheating, when the missionmaker don't put a ammobox on his map, there is simply no ammo support. Maybe you can make the ammobox param optional?
Anyway...
_unit = _this select 0
_mag = _this select 1
_unit action ["take magazine",ammobox,0,0,_mag]
~1
_unit action ["take magazine",ammobox,0,0,_mag]
exit
This works, I tried it. But he will take his magazines from where he's standing.
That's the most reliable way imo and you don't have to use enableAI.sqf.
OK, the only thing I'm still worried about is extra unit spawning bug. I think it's fixed.As soon as you confirm this - I'll upload it all to the ed. depot.
AFAIK you and I are the only guys betatesting this baby here, so I would wait a while, maybe other bugs show up.