If an Infestor has 150 energy and 200 maximum energy and it burrows, the energy will not reset. However, if an Infestor has 250 energy and 200 maximum energy and it burrows, the energy will reset to the maximum. (200)
On my map the Infestor is a hero unit and has 0 starting energy and 0 maximum energy because all energy is gained through attributes. (intelligence) This is a problem because when the Infestor burrows and unburrows its energy is reset to the max. (0)
I want to solve this without triggers because there are upgrades on the map that increase your maximum energy along with many other Infestors and types of Infestors that would make using variables and manually setting energies extremely difficult and buggy.
If attributes merely increased the maximum energy rather than adding to it, then this would not be a problem. However, Blizzard's coding states that if a unit with its energy over the specified maximum burrows, its energy will be reset to the maximum.
I did not download and test your map but I might have a solution for you. It sounds like you don't want to edit the burrow unit's actual "max energy" field but, what about a validator check right when when the unit burrows? So, if your unburrow unit's current energy is > than the burrowed unit's max energy (in the validator , there is also a "Not max energy" reference that might be useful), your validator triggers the behavior which modifies the burrow unit's energy cap and sets the energy regen to "0".Then when you unburrow, the behavior is turn off and its back to normal. Do you use SC mapster IRC? Your names sounds familiar.