• 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.

[vJASS] Custom UI - Item cooldowns not applied properly

Status
Not open for further replies.
Level 24
Joined
Feb 28, 2007
Messages
3,479
Hi all,

I have an issue with my custom UI inventory (which is basically just the normal inventory moved)

Here is the code that handles creating icon backdrops for each inventory slot, and then moving the origin inventory frames to the right location:
JASS:
set i = 0
loop
    exitwhen i >= 3
    set j = 0

    loop
        exitwhen j >= 2

        set icon = BlzCreateFrameByType("BACKDROP", "inv", UI_BackBar_HP, "", 0)
        call BlzFrameSetSize(icon, 0.028, 0.028)
        call BlzFrameSetVisible(icon, true)
        call BlzFrameSetAbsPoint(icon, FRAMEPOINT_TOPLEFT, 0.1 + (0.029 * j), 0.094 - (0.029 * i))
        call BlzFrameSetTexture(icon, "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNDust.blp", 0, true)
        call BlzFrameSetLevel(icon, 3)

        call BlzFrameSetParent(BlzGetFrameByName("InventoryButton_" + I2S((i * 2) + j), 0), BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_COMMAND_BUTTON, 3)))
        call BlzFrameClearAllPoints(BlzGetFrameByName("InventoryButton_" + I2S((i * 2) + j), 0))
        call BlzFrameSetAbsPoint(BlzGetFrameByName("InventoryButton_" + I2S((i * 2) + j),0), FRAMEPOINT_TOPLEFT, 0.1 + (0.029 * j), 0.094 - (0.029 * i))
        call BlzFrameSetScale(BlzGetFrameByName("InventoryButton_" + I2S((i * 2) + j), 0), 0.86)
        call BlzFrameSetLevel(BlzGetFrameByName("InventoryButton_" + I2S((i * 2) + j), 0), 4)

        set j = j + 1
    endloop

    set i = i + 1
endloop

This works well, for the most part. The issues begin when using items. It's as though the frames are not updated properly to reflect item cooldowns (for instance for staff of silence) as well as item charges being reduced by 1 with each use.

However if I drop the item and pick it up again, it correctly reflects the right cooldown and charges. Can I force the frame to be updated somehow, or is there some other fix I can apply to solve this?

Also, while we're at it, is there anyway to reduce the size of the cooldown indicator? Currently it looks rather bad since it's too large:
1659089727617.png


Thanks in advance!

Edit: I did some more testing and even more strangely, if I use all charges of an item (3 in the case of healing wards) the item does disappear from the inventory. But until then it keeps showing three charges...
 
Last edited:
Status
Not open for further replies.
Top