• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Abilities disappear when metamorphisis

Status
Not open for further replies.
Level 10
Joined
Jun 13, 2010
Messages
398
Hero A has 5 abilities (max added in object editor) and gain 1 additional ability (Ability F) through triggers at max level.

One of the 5 abilities is Metamorphisis, which when used transforms Hero A to Hero B.

Hero B has the same initial 5 abilities through object editor, but doesn't get to keep Ability F from Hero A.

When Metamorphisis ends and it turns to Hero A yet again, Ability F is nowhere to be found.

How do I prevent this?
 
Make ability F permanent:
 
Make ability F permanent:
Thanks, but I have never used custom scripts. This isn't right, how do I do this? Ability F is based off of Berserk.


JASS:
Ultimate Ability Doom Guard Slain
    Events
        Unit - A unit Dies
    Conditions
        (Triggering unit) Equal to Boss_Doomlord
    Actions
        Set VariableSet Integer_Roll = 1
        For each (Integer Integer_Roll) from 1 to PlayerCount, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of Hero[Integer_Roll]) Equal to Demon Hunter
                    Then - Actions
                        Unit - Add Demon Hunter F to Hero[Integer_Roll]
                        Custom script:   call UnitMakeAbilityPermanent(Hero[Integer_Roll], true, Absk)
                    Else - Actions
 
One of these two should work:
  • Set Variable MyAbility = Berserk
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, udg_MyAbility )
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, 'Absk' )
You have to prefix all global variables with udg_ and I believe rawcodes need semi quotes.
 
One of these two should work:
  • Set Variable MyAbility = Berserk
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, udg_MyAbility )
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, 'Absk' )
You have to prefix all global variables with udg_ and I believe rawcodes need semi quotes.
Tried the first one, it crashes.

JASS:
For each (Integer Integer_Roll) from 1 to PlayerCount, do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of Hero[Integer_Roll]) Equal to Demon Hunter
            Then - Actions
                Unit - Add Demon Hunter F to Hero[Integer_Roll]
                Set VariableSet Ability = (Unit: Hero[Integer]'s Ability with Ability Code: Demon Hunter F)
                Custom script:   call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, udg_Demon Hunter F)
            Else - Actions

The second one didn't crash this time with the 'Absk', but it still lost the ability.
 
This is incorrect:
Code:
udg_Demon Hunter F
You don't have a variable named Demon Hunter F, nor could you since it has spaces in it's name.

You would reference your Ability variable like this:
  • Set Variable Ability = Demon Hunter F
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, udg_Ability )
And your variable that is named Ability is using the wrong variable type. It's supposed to be an Ability Code variable.

Side note: When referencing rawcodes, make sure that you're using the correct one. You said the ability is based on Berserk, but is it a copy of it? If it's a copy it'll have a different rawcode.
 
Last edited:
This is incorrect:
Code:
udg_Demon Hunter F
You don't have a variable named Demon Hunter F, nor could you since it has spaces in it's name.

You would reference your Ability variable like this:
  • Set Variable Ability = Demon Hunter F
  • Custom script: call UnitMakeAbilityPermanent( udg_Hero[udg_Integer_Roll], true, udg_Ability )
And your variable that is named Ability is using the wrong variable type. It's supposed to be an Ability Code variable.

Side note: When referencing rawcodes, make sure that you're using the correct one. You said the ability is based on Berserk, but is it a copy of it? If it's a copy it'll have a different rawcode.
Thank you - now it works. And thank you for your detail and patience :)
 
Status
Not open for further replies.
Back
Top