HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

spell removal not working?

05-07-2010, 09:41 PM#1
shiFt...
Why is this not working, Im trying to remove the ghost ability from a unit.
Collapse JASS:
scope REMOVE1 initializer Init 

private function Conditions takes nothing returns boolean
   return IsUnitType(GetEnteringUnit(), UNIT_TYPE_HERO) == true 
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetEnteringUnit()
    call ShowUnit( u,false)
    call UnitRemoveAbility(u,'Agho')
    call ShowUnit( u,true)
    
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )

    call TriggerRegisterEnterRectSimple( t, gg_rct_Region_049  )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
    set t = null
    
endfunction

endscope 
05-09-2010, 05:05 PM#2
0zyx0
I'm not sure at all, but I think I remember something strange about the UnitRemoveAbility native. You could try setting the level of the ability to 0 instead, and see if you get the same result.
05-10-2010, 09:30 AM#3
Anitarf
Quote:
Originally Posted by 0zyx0
I'm not sure at all, but I think I remember something strange about the UnitRemoveAbility native. You could try setting the level of the ability to 0 instead, and see if you get the same result.
Whatever this alleged problem with UnitRemoveAbility might be, what you are proposing here simply won't work.

Try adding some debug messages to yor trigger to confirm that it is running and that the unit is properly selected. If the debug messages show that there is no problem, the issue might be with the ghost ability, try some other ability to see if that works.
06-01-2010, 04:30 AM#4
yatyfornetreg
Why not use GetTriggerUnit().
And maybe you cannot remove any abilities from a unit when it is hidden.
By the way, I would set u = null if I was you.
06-01-2010, 01:45 PM#5
Ammorth
I was able to remove Ghost (visible) from units without a problem (other than a pathing glitch).