• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Removing the shadow from a unit?

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
scope ShadowTest initializer init

    function GetFutureNextImage takes nothing returns image
        local image im = CreateImage("ReplaceableTextures\\Splats\\AuraRune9b.blp",0,0,0,0,0,0,0,0,0,1 )
        call DestroyImage(im)
        return im
    endfunction
    
    function CreateUnitAndGetShadow takes nothing returns image
        local image i = CreateImage("ReplaceableTextures\\Splats\\AuraRune9b.blp",0,0,0,0,0,0,0,0,0,1 ) // the last argument (integer) can't be 0
        // the image has to be created, else its id is -1, we have to use a valid string argument for the image
        // note that textags have a lame convention, id == 0 means both the last valid texttag created and an invalid one (limit of 100 texttags reached)
        call BJDebugMsg(I2S(GetHandleId(i))) // no handle id leak, woot, images are so special, or the handle id leak is fixed with locals ?!
        // i'm wondering if it's the same with texttags and also with other pseudo handles (sounds ?!)
        call DestroyImage(i)
        // we need to create a valid image to get the next id handle, we destroy it to recycle it
        call CreateUnit(Player(0), 'hpea', 0, 0, 270)
        // the shadow will use the recycled id : i
        return i
    endfunction
    
    private function init takes nothing returns nothing
        local image shadow = CreateUnitAndGetShadow()
        call DestroyImage(shadow)
        set shadow = CreateUnitAndGetShadow()
        call DestroyImage(shadow)
        set shadow = GetFutureNextImage()
        call CreateUnit(Player(0),'hfoo',0,0,0)
        call DestroyImage(shadow)
    endfunction
    
endscope

just use this to destroy its shadow
 
Status
Not open for further replies.
Top