[Trigger] Problems with Adding and Removing locust using Trigger

Level 10
Aug 12, 2008
I creating an ability that it takes to charge towards a target unit thus I add locust to the unit. Then remove it after casting.
The problem is after I remove the locust ability, I can't select the caster but the enemies able to the caster. Weird!

I used the following functions because I can't find the locust ability in adding ability through trigger. Thus, I used trigger and then convert it to custom text and then I change the ability ID.
  • Custom script: call UnitAddAbilityBJ( 'Aloc', udg_C_caster[udg_C_index2] )
  • Custom script: call UnitRemoveAbilityBJ( 'Aloc', udg_C_caster[udg_C_index3] )
Is there any wrong with the above functions?


Code Reviewer
Level 26
Mar 19, 2008
For removing use:
  • Unit - Hide C_caster[C_index3]
  • Custom script: call UnitRemoveAbilityBJ( 'Aloc', udg_C_caster[udg_C_index3] )
  • Unit - Unhide C_caster[C_index3]
However, I do not recommend unit Locust this way, it makes recastering any spell on given unit buggy.
Last edited:
Level 22
Nov 14, 2008
Test with

if UnitAddAbility(udg_C_caster[udg_C_index3], 'Aloc') then
call UnitRemoveAbility(udg_C_caster[udg_C_index3], 'Aloc')

I think locust is autoremoved if I remember correctly if you just hid the unit and unhid it instantly afterwards. Try with that instead of the solution above.
Level 37
Mar 6, 2006
To completely remove the effects of locust, you must also use a transformation ability. You can base it on bear form. Set the alternate unit to some other hero.

  • Untitled Trigger 113
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Paladin 0031 <gen>
      • Custom script: call UnitAddAbility(udg_u, 'Aloc')
      • Wait 1.00 seconds
      • Unit - Hide u
      • Custom script: call UnitRemoveAbility(udg_u, 'Aloc')
      • Unit - Unhide u
      • Unit - Add Bear Form Rem Loc to u
      • Unit - Order u to Night Elf Druid Of The Claw - Bear Form
      • Unit - Remove Bear Form Rem Loc from u
Level 22
Nov 14, 2008
Whats wrong? I gave a good egzample of removing locust, except Maker once again proofs to know how to fix every glich.

My bad, I meant my if state above that sentence :D

Maker didn't use the BJ, he used the native instead. The BJ calls the native so it's just a performance loss if you use it but in GUI it doesn't matter. (If you use custom script ofc you should avoid this.)