You need to give each unit you want to use two weapons. One weapon only works at melee range, and the other one only works at a certain range.
The hydralisk has this already. The damage is the same, but depending on the range, the unit will either fire projectiles, or use its arms to attack melee enemies.
The big problem, of course, is that it requires a lot of work. You need to duplicate each weapon and need to change the actor events of the unit's actor to use animations for the new weapon as well. But otherwise it's doable.
PS: You can hide weapons, so the game only shows the weapon with the ranged attack, but not the melee range weapon. There should be an option for this in the weapon flag.
Another route is to use a switch effects with range validators on each case. You can set as many ranges as you likes for a fully dynamic damage amounts. I like to use a switch because you might decide you want other amounts of damage applied.
On the Impact effect of the Hydralisk missile, use a Switch Effect instead of the default damage amount. For your needs you only need to types of damage effects the standard full amount and the 50% amount. Then setup a range validator on the 50% amount that checks the distance of the target from the caster.
For the full amount of damage you can put the default hydra damage effect on the Default Field in the Switch effect.