• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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