HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Spell Immunes

09-01-2004, 12:05 AM#1
Grater
Heres a simple method to detect spell immunes, it's pretty damn obvious when ya think about it but I've never seen anyone mention it before.
One trigger creates a "prober":
Code:
Init
    Events
        Map initialization
    Conditions
    Actions
        Unit - Create 1 Flying Sheep for Neutral Extra at (Center of (Playable map area)) facing Default building facing degrees
        Set MagicProber = (Last created unit)
        Unit - Hide MagicProber
        Unit - Add Immune Probe (Neutral Hostile) to MagicProber

The "Immune Probe" ability in this case is based on life drain, changed to target mechanical also. (and ofcourse no mana cost or cooldown)

Then to detect spell immunity do the following actions:
order the prober to "drain" on target.
See if the current order is "drain".
For example, this simple GUI trigger will tell you the immunity statis of units you click on:
Code:
Immunity Status
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
    Actions
        Unit - Order MagicProber to Stop
        Unit - Order MagicProber to Neutral Dark Ranger - Life Drain (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Current order of MagicProber) Equal to (Order(drain))
            Then - Actions
                Game - Display to (All players) the text: Unit is normal
            Else - Actions
                Game - Display to (All players) the text: Unit is magic Immune
        

Ofcourse you can use anything as the "probe" ability, if you wanted to find non-spell immune, organic, enemy units you could just use the normal life drain targets on a "prober" owned by the casting player. Also, depending on the owning player of the prober and visibility, units that are invisible will register as being "spell immune", or really as it is, untargetable by the probing ability.

It seems this method is VERY fast, as in doing it every second on 100 units causes no noticable lag spike.
09-01-2004, 03:19 PM#2
Vexorian
I think that now damage types render this (good) method useless, but it still is a good idea, to use Current Order as a replacement of checking the returned value when issueing the order.