• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Demon hunter lost some new spells when morph

Status
Not open for further replies.
Level 4
Joined
Jun 29, 2014
Messages
27
I'm with a little problem, I'm making a map where the heroes learn new skills when the player level up a certain skill of this hero(for example learn self-destruct when thunder clap is in level 3, A EXAMPLE), but the problem is the demon hunter, when it uses metamorphose it becomes other unit, and lost all those new skills, and when he returns to normal form he continues without these skills!:vw_unimpressed: someone knows some trigger to the demon hunter continues with the abilities when he morphs, I'm not so good using triggers .-.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You need to make all abilities added by triggers "permanent" or they will be lost during morphs.

Below is the declaration of the native that does this.
JASS:
native UnitMakeAbilityPermanent takes unit whichUnit,boolean permanent,integer abilityId returns boolean

There is also a GUI action which calls this. I do not know its name off the top of my head however it will call this wrapper.
JASS:
function UnitMakeAbilityPermanentBJ takes boolean permanent,integer abilityId,unit whichUnit returns boolean
    return UnitMakeAbilityPermanent(whichUnit, permanent, abilityId)
endfunction
It is probably under unit but might also be environment or whatever crazy place the GUI writers decided it should be.

Making an ability permanent will mean that it will not get lost during morphs. Iinnate abilities appear to be permanent which is probably why they are not lost during morphs. Any ability you add to a unit using triggers will be lost during a morph unless you make it permanent.
 
I think UnitMakeAbilityPermanent can't be called with GUI.

But you simply can achieve the correct result with some help variables for example:

  • Set Unit = <YourUnit>
  • Set Ability = <YourAbility>
  • Custom script: call UnitMakeAbilityPermanent(udg_Unit, true, udg_Ability)
^If you set these two variables, the custom script must be exactly the same. <Ability> will be permanent for <Unit>.
 
Level 4
Joined
Jun 29, 2014
Messages
27
err.. I do something wrong? error.png
 
Level 4
Joined
Jun 29, 2014
Messages
27

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
already tried with udg_DH and appeared an similar error
udg_DH appears to be an integer not a unit, the function takes a unit (not unit type!).

Declare a global variable in GUI called "Unit" of type Unit. It must be called exactly "Unit" as otherwise it will not match the name of the variable you want. It must also be of type unit as it expects a unit handle to be passed and not an integer.

You call the function directly after you use a trigger to add an ability to a hero that you want it to keep between morphs. You use the same unit handle as you did for the add ability action.

Obviously you can use what ever variable name you like, after all they are just your GUI global name prefixed with "udg_". The only requirement is that it is a unit as otherwise it will throw a syntax error.
 
Status
Not open for further replies.
Top