Snippet UnitRemoveLocust

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
After some testing, I finally worked it out how to completely remove 'Locust' with no side-effects (unit being invulnerable after hiding/unhiding).

It seems the ability 'Locust' itself makes the unit invulnerable (and unclickable).

I thought adding 'Locust' adds the ability 'Invulnerable' as well, but I guess I was wrong.


Anyway, feel free to test and prove me wrong!

Feedback and comments appreciated.

JASS:
function UnitRemoveLocust takes unit whichUnit returns nothing
    local boolean array selected
    local integer index = 0
    loop
        exitwhen (index > bj_MAX_PLAYERS)
        set selected[index] = IsUnitSelected(whichUnit, Player(index))
        set index = index + 1
    endloop
    call ShowUnit(whichUnit, false)
    call UnitRemoveAbility(whichUnit, 'Aloc')   
    call ShowUnit(whichUnit, true)
    set index = 0
    loop
        exitwhen (index > bj_MAX_PLAYERS)
        if (selected[index]) then
            call SelectUnitAddForPlayer(whichUnit, Player(index))
        endif
        set index = index + 1
    endloop
endfunction
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> After some testing

Hm...

This idea isn't new. And it was rejected as "not complete".
Though I would have to have a look to remember what the problem was.

Either way, you missed something in those tests.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
After removing 'Locust':

- Pressing 'Alt' shows the health bar
- GroupEnumUnits... functions group the units perfectly
- No problems selecting the unit again
- No selection-circle issues, it's still there
- The unit is not invulnerable
- Other units are still able to acquire it as a target and attack it
- The unit still has it's collision, pathing

So far there are no side effects.


It would be excellent if you, or anyone else, could find and post other side effects, which this function does not remove.
 

Switch33

New Member
Reaction score
12
AceHart is right simple mousing over units no longer shows health bars. :/ But then again... it's not really much of a downside health bars can get irritating.

You also can't target the unit with allied units for spells or attack(meaning no healing/buffing that unit etc). However, an enemy comp can cast spells on the unit (didn't test enemy player and only tested an autocast skill so... someone should retest this by doing it online).
--->> Actually from my testing using priest/sorcresses it appears that i guess autocast abilties like heal/slow work.
(although if they aren't autocast you can't target the unit. Meaning any single target skill might not work at all.)

(As long as this isn't used on any single player's units but rather on a creep type unit it would be fine, cause players would get irritated probably.)

As long as this isn't used for heros and as the like though, why not just simply remove the unit and create a new one without the aloc ability?(Because removing it in-game from a unit does have some side effects even with this :/)

Also this all you really need in the script(the selecting part does absolutely nothing as far as i've tested):
JASS:
function UnitRemoveLocust takes unit whichUnit returns nothing
    call ShowUnit(whichUnit, false)
    call UnitRemoveAbility(whichUnit, 'Aloc')   
    call ShowUnit(whichUnit, true)
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top