This topic has come up once before, but got no clear answer. And on my own research, I'm finding it particularly difficult to resolve. The goal here is simple - I want a building that has an arbitrary amount of mana to be able to upgrade into one with a higher maximum mana, but without changing the actual mana it has at the time of upgrade. (Retaining the old amount is crucial to how this system's supposed to work.) However, by default, the building always leaps to the new max mana as soon as the upgrade begins.
Scouring the unit fields, I cannot find anything to control what mana it has upon upgrading, as my default value is '0', yet that's clearly not what I get upon upgrade. I cannot find any constant that changes this behavior. And for the life of me, I can't find any object exposed to the trigger system to catch what the mana value was before. Thus far, the only possible solutions I can find would be to apply a dummy ability that performs all the checks of a normal upgrade command, but replaces the building with a new one instead and sets the mana manually; or to prevent the building from upgrading without hitting maximum mana, and then resetting its mana via triggers to the previous maximum upon starting the upgrade. I can probably run either version if I have to, but both would generate an enormous headache for me and some gameplay dynamics that would make the experience of playing it moderately worse.
I apologize for bringing this up after someone else already had, especially as I doubt there will have been any radical discoveries in the past couple years. But given how significant this is to my project, I wished to make as certain as I could before committing to less desirable options. Does anyone know any way to change upgrade behavior when it comes to mana values, or any way to capture a unit or building's mana values prior to starting the upgrade?
Scouring the unit fields, I cannot find anything to control what mana it has upon upgrading, as my default value is '0', yet that's clearly not what I get upon upgrade. I cannot find any constant that changes this behavior. And for the life of me, I can't find any object exposed to the trigger system to catch what the mana value was before. Thus far, the only possible solutions I can find would be to apply a dummy ability that performs all the checks of a normal upgrade command, but replaces the building with a new one instead and sets the mana manually; or to prevent the building from upgrading without hitting maximum mana, and then resetting its mana via triggers to the previous maximum upon starting the upgrade. I can probably run either version if I have to, but both would generate an enormous headache for me and some gameplay dynamics that would make the experience of playing it moderately worse.
I apologize for bringing this up after someone else already had, especially as I doubt there will have been any radical discoveries in the past couple years. But given how significant this is to my project, I wished to make as certain as I could before committing to less desirable options. Does anyone know any way to change upgrade behavior when it comes to mana values, or any way to capture a unit or building's mana values prior to starting the upgrade?