It's impossible to change a unit's damage with triggers. No editor can ever be made to do this. As moose said, the closest you can get would be to replace it with a similar unit with a different attack.
If you have a trigger constantly give the unit that is out of ammo to a neutral player and back again, it will interrupt any attack order the user may have given. The downside of this method is that the player will lose selection on the unit when it changes owners, no matter how briefly. You would want to make the interval between switching owners longer, but then the player has a bigger window to attack in. Of course, losing the selection will slow them down if there are trying to attack manually, too - but also if they are trying to retreat.
Another option is to use invincibility. This can interfere with other players, so you should probably have a location follow the player's unit around when they are out of ammo and only apply this technique within that location. This presupposes that the players have a limited number of units under their control, but if you're trying to do an ammo system for the players I think that's a safe assumption. What you do is turn on invincibility for all enemy units in the location, wait 100 or so milliseconds, turn invincibility off, and wait another 100 or so milliseconds. You'd need hyper triggers too. What happens is that if the player is allied to the enemy and had manually tried to attack, they'd have to keep doing it every 100 milliseconds and have to get the timing pretty accurate. The player would have to take a lot of hits just to get a few shots off. If you're not allied, then attacking is mostly the same as normal. On occasion the timing will be off (it has to do with how long you're waiting and how often the enemy fires) and your unit will run away, but if you use the hold command it's pretty good. Like I said before, this situation will only happen if one player that is not out of ammo is within range of another player that
is out of ammo, because the invincibility trigger will only apply within that location.
Finally, you can do away with normal units and use spells as bullets. Check out Tux's
Trigger Happy Defense to see what I mean.
EDIT: After some more testing, I'm not really confident that my methods are any better than just hyper-triggering the alliance. If you are using units that aren't too fast to attack and have no splash damage, I think that's the best way to go and you probably won't have any problems.