What item/abilty increases range? and is permanent?
Look at the Long Rifles upgrade in the human techtree, I think the effect is called Attack Range Increase.
This map has several items that increase a melee hero's range when equipped and resets when unequipped, you could ask the maker how he did it.
I'm pretty sure that map uses metamorphosis ability to trigger the attack range increase. I say this because range themed weapons have the same range.
With the upcoming 1.29 version (still in public test phase) you will be able to decrease research levels, allowing to dinamically modify attack ranges PER UNIT TYPE (with the attack range increase you suggested). Maybe we will get a function that modifies attack range for a singular unit.
What you can do right now is to use the metamorphosis trick (from now on "met"):
- Create a modified met ability (with 0.0 casting/transform times, uninterruptible, etc., so it runs as smoothly as possible)
- Create 2 units: same models, one melee, one ranged (this will be the standart range), then remember to vinculate each unit in the met ability (i suggest the alternate unit should be the ranged one), and add the met ability to the created units.
- Make 2 triggers: a Map Init trigger that disables the met ability for all players (so it doesn't show in the UI); and an equip system that fits your map or needs.
- In the equip system you must track the equip event (ie. If you go for a simple system that equips weapons that are indeed items that have to be picked up then in this case the event is indeed "A unit picks up an item"); then you must track if the new weapon equipped is a ranged one (while the previous weapon, ex. a sword, is melee, but also vice versa -my previous weapon is ranged and my new weapon is melee), ordering the equipped unit to metamorphosis (this is a "complex" step, you must first enable the met ability for the triggering player, ie. the owner of the equipping unit, issue the met order id/string, then disable the ability again).
- You can even have 2 "ranges" for the ranged weapons (one standart, lets say 300, and other augmented, lets say 1000, for bows and the like). Here you must modify the equip trigger, and when a unit equips an augmented ranged weapon you must create a unit that is vinculated as recquisite for an Attack Range Increase (+700) upgrade (in the upgrades menu, each upgrade can have a unit as recquisite, also remember to add the upgrade to the ranged unit). Of course you must remove the unit if it equips another non augmented weapon, so i suggest to make a unit array (here you track the triggering player id) variable called "RangeAugmenter" for easy standarized access. I'm not quite sure, but this option can instanciate for each UNIT TYPE (for each unit you must create a different upgrade, a different dummy unit and a different unit array variable), so its functionallity is limited to RPG and heroes i guess.
I'm pretty sure i messed up some steps, but i have an effective "on Equip" system made on vjass (its very hardcoded tho, as the equip event is not an item pick up) so this is indeed effective and feasible.
Also this system can help you:
[System] Melee/Ranged Attack Switch v1.1.1.1
I still encourage you to learn how it can be done, since that system might not adjust to your needs.