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

[Lua] [Lua] [Jass] Correcting attack/armor icon placement

Hello! I noticed a while ago that the Reforged icons were being cut off, or overlapping, in game. This is a script to correct that behavior.

In the image, you can see how both the (un-upgraded) and (upgradable) icons no longer overlap and cut each other off, versus the original, which removes a pixel line of the icon border, or covers the upgrade value box.

This also aligns the Damage text with Strength, on heroes.

JASS:
scope DamageAlignment initializer Init
    function UISetup takes nothing returns nothing
        local framehandle fh = BlzGetFrameByName("InfoPanelIconBackdrop", 0)
        call BlzFrameClearAllPoints(fh)
        call BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPRIGHT, 0.3455, 0.083)
        set fh = null
    endfunction
 
    private function Init takes nothing returns nothing
        call UISetup()
    endfunction
endscope

Lua:
do
    local timer = CreateTimer()
    TimerStart( timer, 0, false, function()
        local framehandle
        fh = BlzGetFrameByName("InfoPanelIconBackdrop", 0)
        BlzFrameClearAllPoints(fh)
        BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPRIGHT, 0.3455, 0.083)
        DestroyTimer(timer)
    end)
end

attackarmorexample.png
 
Last edited:
Undefined handles are already null, so no need to do that during local declaration.

However, you do need to null that handle at the end of the script.

Also you might as well define the local immediately:
JASS:
function UISetup takes nothing returns nothing
    local framehandle fh = BlzGetFrameByName("InfoPanelIconBackdrop", 0)
    // Fix Damage and Armor overlap
    call BlzFrameClearAllPoints(fh)
    call BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPRIGHT, 0.3455, 0.083)
     set fh = null
endfunction
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
You should add proper vJASS initialization. There is no need for a pure JASS version, because this resource is only for newer versions.
 
Even something simple like:

Lua:
do
    local timer = CreateTimer()
    TimerStart( timer, 0, false, function()
        local framehandle
        fh = BlzGetFrameByName("InfoPanelIconBackdrop", 0)
        BlzFrameClearAllPoints(fh)
        BlzFrameSetAbsPoint(fh, FRAMEPOINT_TOPRIGHT, 0.3455, 0.083)
        DestroyTimer(timer)
    end)
    print(“Timer Started”) -- won’t run. Or at least, didn’t run back in 2019.
end
 
Top