• 🏆 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!

How to remove building shadow?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I set the unit shadow fields to zero, but my building still has an ugly shadow. I just want no shadow at all. How do I get rid of it?

JASS:
    //! i makechange(current, "ushx", "0.00")
    //! i makechange(current, "ushy", "0.00")
    //! i makechange(current, "ushh", "0.00")
    //! i makechange(current, "ushw", "0.00")

That's just the luascript, where I set the fields for a unit's shadow to 0.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can try this, but it can have side effects, mainly about selection circle:

JASS:
    // Credit to Deaod, edited by Maker
    private function CreateUnitWithoutShadow takes player owner, integer uid, real facing, string shadowfile returns unit
        local image i = CreateImage(shadowfile, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3) // creates a dummy image
        if GetHandleId(i) == -1 then // if the new shadow is invalid, abort, it can screw up the game
            debug call BJDebugMsg("CreateUnitWithShadow: Invalid path for new shadow!") // it could also be caused by an imageType of 0, but thats a less common cause
            return null // since the image is invalid, we dont need to destroy it
        endif
        call DestroyImage(i) // destroy the dummy.
        set u = CreateUnit(owner, uid, CREATE_X, CREATE_Y, facing) // create the unit. this also creates a new image which functions as the shadow of the unit. The shadow will use the ID of the dummy image.
        call DestroyImage(i) // destroy the shadow of the unit
        call CreateImage(shadowfile, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3) // this creates the new shadow for the unit, note that i dont need to overwrite "i" as the id this image will get is predictable
        call SetImageRenderAlways(i, false) // Hides the shadow
        call SetImageColor(i, 0, 0, 0, 0)   // Makes the shadow invisible
        // no need to null "i", as images dont use ref-counting
        return u
    endfunction
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
You can try this, but it can have side effects, mainly about selection circle:

JASS:
    // Credit to Deaod, edited by Maker
    private function CreateUnitWithoutShadow takes player owner, integer uid, real facing, string shadowfile returns unit
        local image i = CreateImage(shadowfile, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3) // creates a dummy image
        if GetHandleId(i) == -1 then // if the new shadow is invalid, abort, it can screw up the game
            debug call BJDebugMsg("CreateUnitWithShadow: Invalid path for new shadow!") // it could also be caused by an imageType of 0, but thats a less common cause
            return null // since the image is invalid, we dont need to destroy it
        endif
        call DestroyImage(i) // destroy the dummy.
        set u = CreateUnit(owner, uid, CREATE_X, CREATE_Y, facing) // create the unit. this also creates a new image which functions as the shadow of the unit. The shadow will use the ID of the dummy image.
        call DestroyImage(i) // destroy the shadow of the unit
        call CreateImage(shadowfile, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3) // this creates the new shadow for the unit, note that i dont need to overwrite "i" as the id this image will get is predictable
        call SetImageRenderAlways(i, false) // Hides the shadow
        call SetImageColor(i, 0, 0, 0, 0)   // Makes the shadow invisible
        // no need to null "i", as images dont use ref-counting
        return u
    endfunction

Why would I need to dynamically create it? I just want the object to have no shadow at all.
 
Status
Not open for further replies.
Top