[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.
 
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?
 
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.
Back
Top