• 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.

[vJASS] UnitAddAbility and UnitRemoveAbility

Status
Not open for further replies.
Level 9
Joined
Aug 26, 2010
Messages
573
Guy, I have a problem :|
Every such piece of code doesn't add second ability...
Both abilities with such IDs exist in my map but after this code execution first ability is deleted and second isn't added.
JASS:
call UnitRemoveAbility(GetSpellAbilityUnit(), 'SFiE')
call UnitAddAbility(GetSpellAbilityUnit(), 'DFiE')
I need this working to make a toggling spell.
 
Level 11
Joined
Mar 31, 2009
Messages
732
I wonder that the GetSpellAbilityUnit() is changing. Could you test this by changing that function to:

JASS:
  private function EnrageCast takes nothing returns nothing
       local unit caster = GetSpellAbilityUnit()
    set hPlayerHero[GetPlayerId(GetOwningPlayer(caster))].damageModifier = SCOPE_PRIVATE + "Enrage"
    call UnitRemoveAbility(caster, 'SFiE')
    call UnitAddAbility(caster, 'DFiE')
  endfunction

and let me know if anything changes. If not, when running your map, how do I test this?
 
Level 9
Joined
Aug 26, 2010
Messages
573
LOL, it works now.
About description - changed "loose" to "spend". Sorry, eng isn't my native language :D

Without any providen code i'm not going to believe you (you probably don't care though)
Look this maps code.
You are free to try it.
To change class change variable in the bottom of onInit function. They are listed just before hero creation.
 
Status
Not open for further replies.
Top