Reverse UnitMakeAbilityPermanent

Level 12
Joined
Jul 5, 2014
Messages
551
I hate to ask again, but one issue led to another. There was a case of morphing unit, like with metamorphosis, the spells disappeared from the spellbook. That was solved via UnitMakeAbilityPermanent apparently. The spellbook functions as a choice for spells and it should be removed once the spell is chosen. The morphed unit however, gets it back. Is there a reverse UnitMakeAbilityPermanent trigger that removes the spellbook from the morphed unit too if it's removed from the normal?
 
Level 12
Joined
Jul 5, 2014
Messages
551
You just need to call UnitMakeAbilityPermanent again on the ability but set the boolean parameter to false.
I'm not sure if you got the issue. There's a spellbook on the hero by default. It disappears once you've chosen a skill from it, making room for the skill. However, when the unit morphs, the disappeared spellbook reappears. Which is what I want to prevent.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You could use finished/stops casting event for the morph so it would only trigger after the unit has changed.

A wait has a minimum duration of about 0.27s no matter what smaller number you put in there.

If you are ever Permanent-ing a skill you don’t want to be permanent, then just don’t call the function to make that ability permanent in the first place. As said here the boolean argument to the function is what determines “yes permanent now” or “no not permanent any more”. If the spellbook is in both units’ ability list you do not have to make it permanent and it just will be there always; maybe you’ve done that? What if the unit levels up while morphed; it should still be able to rank up abilities in that state, right? Finally, you can still use an older trick to selectively disable abilities at-will with the Player - Disable ABILITY for PLAYER action; perhaps it makes more sense to do that when in the morphed form instead of outright removing the ability.
 
Level 12
Joined
Jul 5, 2014
Messages
551
You could use finished/stops casting event for the morph so it would only trigger after the unit has changed.

A wait has a minimum duration of about 0.27s no matter what smaller number you put in there.

If you are ever Permanent-ing a skill you don’t want to be permanent, then just don’t call the function to make that ability permanent in the first place. As said here the boolean argument to the function is what determines “yes permanent now” or “no not permanent any more”. If the spellbook is in both units’ ability list you do not have to make it permanent and it just will be there always; maybe you’ve done that? What if the unit levels up while morphed; it should still be able to rank up abilities in that state, right? Finally, you can still use an older trick to selectively disable abilities at-will with the Player - Disable ABILITY for PLAYER action; perhaps it makes more sense to do that when in the morphed form instead of outright removing the ability.
Here's the thing with the ability: it is a dummy skill within a spellbook. Clicking on it removes the spellbook and gives the real version of the ability via engineer upgrade. The spellbook returned upon morphing qnd after, even when it wasn't triggered with permanence. I made the dummy abilities permanent (they're getting removed with the spellbook anyway) but the spellbook itself needed an integer check for the chosen ability and also a periodic buff check for morphing (so they won't come back after the spell wears off. The spellbooks show up for a moment (likely due to the 0.27 minimal wait time) but that was the best solution I could come up with.
 
Top