HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Can't Remove Ability

10-28-2007, 12:22 PM#1
Dg!Mortal
In a spell I tried to add an ability based of items(Item armor Bonus with negative value) to unit then remove it after some moment but I Couldn't remove it Bug?
10-28-2007, 04:13 PM#2
Mystic Prophet
post you're exact trigger and maybe I can tell what went wrong.
10-28-2007, 07:15 PM#3
Dg!Mortal
I dont Have that trigger cos I changed it and I used acid bomb for that instead. but it was st like this
Collapse JASS:
////AC///haha
function Corouption_of_The_Souls_AC_Learn_Conds takes nothing returns boolean
return GetLearnedSkill()=='A027'
endfunction
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXfunXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
function Corouption_of_The_Souls_AC_Detect takes nothing returns boolean
    if GetTriggerEventId()==EVENT_PLAYER_UNIT_ATTACKED and GetUnitAbilityLevel(GetAttacker(),'A027')>0 then        
        return true           
    elseif GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT and GetSpellAbilityId()=='A027' then        
        return true        
    endif
    return false
endfunction

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 function Corouption_of_The_Souls_AC_Effects takes nothing returns nothing
    local unit targ=GetTriggerUnit()
    local unit cast=GetEventDamageSource()
    local effect se
    //local unit u
    if GetUnitAbilityLevel(targ,'B008')>0 and GetUnitAbilityLevel(cast,'A027')>0 and GetUnitAbilityLevel(targ,'Blcb')==0 then
        call DisableTrigger(GetTriggeringTrigger())                
        //set se=AddSpecialEffectTarget("Abilities\\Spells\\Items\\OrbCorruption\\OrbCorruptionSpecialArt.mdl",targ,"chest")
        //set u=CreateUnitAtLoc(GetOwningPlayer(cast),'h008',GetUnitLoc(targ),0)
        call UnitAddAbility(targ,'A01H')
        //call SetUnitAbilityLevel(u,'A01H',GetUnitAbilityLevel(cast,'A027'))
        //call IssueTargetOrderBJ(u,"acidbomb",targ)
        call PolledWait(2)
        call UnitRemoveAbility(targ,'A01H')
        //call RemoveUnit(u)
    endif
    set u=null
    set se=null
    set targ = null
    set cast = null       
endfunction

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 

function Corouption_of_The_Souls_AC_Actions takes nothing returns nothing
    local trigger trig = CreateTrigger()  
    local triggeraction ta  
    local unit u
    if GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT then        
        set u = GetSpellTargetUnit()
    else        
        set u = GetTriggerUnit()
    endif
    call TriggerRegisterUnitEvent(trig,u, EVENT_UNIT_DAMAGED)
    set ta = TriggerAddAction(trig, function Corouption_of_The_Souls_AC_Effects)
    call PolledWait(2)
    
    call DisableTrigger(trig)
    call TriggerRemoveAction(trig,ta)    
    call DesTrig(trig)     
     
    set ta = null  
    set u = null
    set trig = null
endfunction 
 function P_InitTrig_Corouption_of_The_Souls_AC takes nothing returns nothing
    local trigger Corouption_of_The_Souls_AC = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(Corouption_of_The_Souls_AC, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerRegisterUnitEvent(Corouption_of_The_Souls_AC,GetLearningUnit(), EVENT_UNIT_SPELL_EFFECT)        
    call TriggerAddCondition(Corouption_of_The_Souls_AC, Condition(function Corouption_of_The_Souls_AC_Detect))
    call TriggerAddAction(Corouption_of_The_Souls_AC, function Corouption_of_The_Souls_AC_Actions)
endfunction
function InitTrig_Corouption_of_The_Souls_AC takes nothing returns nothing 
    set gg_trg_Corouption_of_The_Souls_AC = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Corouption_of_The_Souls_AC, EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(gg_trg_Corouption_of_The_Souls_AC, Condition(function Corouption_of_The_Souls_AC_Learn_Conds))
    call TriggerAddAction(gg_trg_Corouption_of_The_Souls_AC, function P_InitTrig_Corouption_of_The_Souls_AC)
endfunction

...and simply does not works
10-28-2007, 09:11 PM#4
Mystic Prophet
hmm well I'm a GUI guy. (I know i'm lazy) Glad you see you found a way around it though.
10-29-2007, 06:06 PM#5
Dg!Mortal
So no one knows? that it is bug or I did something wrong?
10-29-2007, 07:45 PM#6
CommanderZ
Maybe the wait corrupts it. I would suggest you to use timer instead.
10-30-2007, 05:56 AM#7
Pyrogasm
I'd blame it on a weird, freak bug.
10-30-2007, 04:48 PM#8
SkriK
I made a spell once (that worked perfectly fine), that when it finished casting, the caster gained +20 Damage Item Bonus. Something like this:
Trigger:
Collapse Events
Unit - A Unit Finishes Casting an Ability
Collapse Conditions
Ability being cast is Equal to "Ability"
Collapse Actions
Unit - Add "20dmgAbility" to (Triggering Unit)
Wait 10 Seconds
Unit - Remove "20dmgAbility" from (Triggering Unit)
So if this is kinda the concept, i'd say it's a bug in yours.