• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

TasToolTipBox

This bundle is marked as pending. It has not been reviewed by a staff member yet.

Introduction


TasToolTipBox is a custom UI addition for Warcraft 3 V1.31 or higher in Lua & vjass.
It displays some generic spell values in a additional tooltip-box.

Details


Creates an custom TooltipBox with "multiple" rows of custom Icon-Text-Frames.
When an activ Spell or item is hovered it shows the box and displays MissileSpeed, Cooldown, Range, Area & CastTime.
One can adjust the used Icons and amount of infos. To make them display different data you need to edit the system code.
For items only the first skill is considered, which should be activ one anyway.
Does not work correctly in group selection.
Does not work correctly for sub menues like hero skill, built or spellbooks.
In V1.31.1 always display values of Level 1.

How to install


Requiers Warcraft 3 1.31+ or higher
  • Copy TasToolTipBox Lua (trigger Editor).
  • Copy required lib HoverOriginButton Lua.
  • Or Copy TasToolTipBox vjass (trigger Editor).
  • Copy required lib HoverOriginButton vjass.
  • export
    • war3mapImported\TasTooltipBox.fdf
    • war3mapImported\TasTooltipBox.toc
    • WHEN USING THE EXPORT ALL BUTTON, IT CAN HAPPEN THAT THE CONTENT OF THIS FILES SWAP
    • import them into your map
  • Installed

The system code this post, only contains the parts your as "user" care about.
At top some config.
Inside function StartUI the displayed text is set.
function endUI happens when the user stops pointing at a command button
When you want to change the displayed text, Beaware that both StartUI & endUI run in async context. Some things you should not do in this functions:
dont keep references to objects (that are going to be destroyed)
dont random
dont make new handleId
dont create
dont destroy
dont change gamestate

Lua:
--[[ TasToolTipBox V4a by Tasyen
  An additional TooltipBox for buttons in the command card/inventory which displays MissileSpeed, Cooldown, Range & Area values

  changes position of ORIGIN_FRAME_UBERTOOLTIP

  function TasToolTipBox.AddData(array, unitCode, objectCode)
    make unitCode use inside array objectCode as manual data
    uses x/y coords of objectCode, therefore with colisions you get unwanted results

  function TasToolTipBox.AddDataBatch(array, unitCode, objectCodeString)
    uses TasToolTipBox.AddData with many rawCodes at once.
        TasToolTipBox.AddDataBatch(TasToolTipBox.DataBuilt, 'hpea', "htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt")
        TasToolTipBox.AddDataBatch(TasToolTipBox.DataDefault, 'htow', "hpea,Rhpm,hkee")
    to get this string open the unit in object editor navigate to the field hold shift press enter which opens the field in text input, copy paste it.

  works incorrect when multiple skills use 1 slot in the command card
  works incorrect in group selection
  works incorrect with spellbooks

  requires BlzGetAbilityId for skills with more than 1 level (not Warcraft V1.31.1)
  requires HoverOriginButton
]]
do
    TasToolTipBox = {
        TocPath = "war3mapImported\\TasToolTipBox.toc"
        ,AutoRun = true --(true) will create Itself at 0s, (false) you need to TasToolTipBox.Init()
        ,ParentFunc = function() return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) end -- should not be simple
        ,Hide0Text = true
        ,InfoCount = 5 -- how many Infos you want, every 4 are one row
        ,FixedPos = false -- true default tooltip pos does not change when TasToolTipBox is not shown
        ,ExcludSlots = {[7] = true} -- for ability detection
        ,Icon = { -- filePaths used
            "replaceabletextures/passivebuttons/pasbtntrueshot"
            ,"ui/widgets/battlenet/bnet-tournament-clock"
            ,"replaceabletextures/commandbuttons/btnload"
            ,"replaceabletextures/selection/spellareaofeffect_undead"
            ,"replaceabletextures/commandbuttons/btnreplay-speedup"
            ,"UI/Widgets/ToolTips/Human/ToolTipManaIcon"
        }
        ,FilterItemSkills = true -- true items are never in the command card in your map
        ,EnableSubMenu = true -- true creates events/timer; changing it after the Init run is not supported/recommented.
        ,DataBuilt = {} -- Manual insert data in worker built submenu; expects TasToolTipBox.DataBuilt[unitCode][0 to 10] Use TasToolTipBox.AddDataBatch to fill it
        ,DataLearn = {} -- ^^ for submenu Hero Learn 
        ,DataDefault = {} -- ^^ manual data outside of sub menues like train unit research sell items
        ,YPos = 0.17
        ,EventCount = -1
        ,TimerUnit = -1
        ,LastAction = -1
        ,TimerCount = -1
    }
    local this = TasToolTipBox
    
    this.ActionSubMenuHero = function(buttonIndex, data, unit, unitCode)
        -- requires EnableSubMenu
        -- what to display inside hero skill menu        
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
    end
    this.ActionSubMenuBuilt = function(buttonIndex, data, unit, unitCode)
        -- what to display inside built menu
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
    end
    this.ActionDefaultData = function(buttonIndex, data, unit, unitCode)
        -- what to display with manual written data
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
    end
    this.ActionSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode)
        -- Update displayed Text
        -- this is the place you can change the displayed data
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
        --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))

        return true
    end
    this.ActionItemSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode, item)
        -- Update displayed Text
        -- this is the place you can change the displayed data
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
        BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
        --BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))
        return true
    end
JASS:
library TasToolTipBox initializer init_function requires HoverOriginButton, optional Ascii, optional FrameLoader
/* TasToolTipBox V4a by Tasyen
  An additional Box for a spell in the command card/inventory which displays MissileSpeed, Cooldown, Range & Area values

  changes position of ORIGIN_FRAME_UBERTOOLTIP

  function TasToolTipBox_GetUnitCodeData takes integer unitCode, boolean insert returns integer
    makes unitCode use an index and return it
    returns 0 when the unitcode was not used and insert == false
    only 32k/12 ~2666 unitCodes can have data in this system

  function TasToolTipBox_AddData takes gameevent dataType, integer unitCode, integer objectCode returns nothing
    make unitCode use inside array objectCode as manual data
    uses x/y coords of objectCode, therefore with colisions you get unwanted results

  function TasToolTipBox_AddDataBatch  takes gameevent dataType, integer unitCode, string objectCodeString returns nothing
    uses AddData with many rawCodes at once.
    requires Ascii
    call TasToolTipBox_AddDataBatch(EVENT_GAME_BUILD_SUBMENU, 'hpea', "htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt")
    call TasToolTipBox_AddDataBatch(EVENT_GAME_SHOW_SKILL, 'Hpal', "AHhb,AHds,AHre,AHad")
    call TasToolTipBox_AddDataBatch(null, 'ngme', "stwp,bspd,dust,tret,prvt,cnob,stel,pnvl,shea,spro,pinv")
    


  works incorrect when multiple skills use 1 slot in the command card
  works incorrect in group selection
  works incorrect with spellbooks

  requires BlzGetAbilityId for skills with more than 1 level (not Warcraft V1.31.1)
*/
globals
    constant boolean REFORGED = false // have BlzGetAbilityId? otherwise false
    public string TocPath = "war3mapImported\\TasToolTipBox.toc"
    public boolean AutoRun = true //(true) will create Itself at 0s, (false) you need to TasToolTipBox_Init()
    public boolean FixedPos = false // true default tooltip pos is the same even no TasToolTipBox is shown
    public boolean Hide0Text = true
    public boolean FilterItemSkills = true  // true items are never in the command card in your map
    public boolean EnableSubMenu = true  // creates events/timer; changing it after the Init run is not supported/recommented.
    public integer InfoCount = 5 // how many Infos you want, every 4 are one row
    public real YPos = 0.17

    public real SizeX
    public real SizeY
    public boolean array ExcludSlots
    public string array Icon
    public unit array Unit

    public integer array DataUnitCode // the unitcodes with Data
    public integer array DataBuilt // DataUnitCode*12
    public integer array DataLearn // DataUnitCode*12
    public integer array DataDefault // DataUnitCode*12


    public integer EventCount = -1
    public integer TimerUnit = -1
    public integer LastAction = -1
    public integer TimerCount = -1
    public boolean TimerCountChanged = false
    public gameevent currentAction = null
    
endglobals
public function ParentFunc takes nothing returns framehandle // should not be simple
    return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)
endfunction
public function InitUserData takes nothing returns nothing
    set Icon[1] = "replaceabletextures/passivebuttons/pasbtntrueshot"
    set Icon[2] = "ui/widgets/battlenet/bnet-tournament-clock"
    set Icon[3] = "replaceabletextures/commandbuttons/btnload"
    set Icon[4] = "replaceabletextures/selection/spellareaofeffect_undead"
    set Icon[5] = "replaceabletextures/commandbuttons/btnreplay-speedup"
    set Icon[6] = "UI/Widgets/ToolTips/Human/ToolTipManaIcon"

    set ExcludSlots[7] = true
endfunction

public function ActionSubMenuHero takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // requires EnableSubMenu
        // what to display inside hero skill menu        
        call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionSubMenuBuilt takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // what to display inside built menu
        call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionDefaultData takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
        // what to display with manual written data
        call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
        return true
endfunction
public function ActionSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode returns boolean
    // this is the place you can change the displayed data
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
    //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))

    return true
endfunction

public function ActionItemSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode, item it returns boolean
    // Update displayed Text
    // this is the place you can change the displayed data
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
    call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
    //call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))
    return true
endfunction


ChangeLog


V4a AddBatch - Hero Learn assumes now fill card from top left, Filter -coords
V4

can detect built & Hero Learn sub menu, this does not work 100% in all cases
can manual set data for default, subMenu Built & Hero Learn​
V3 Improved Skill detection (can ignore ItemSkills in the command card detection)
V2

Hide the box in more cases like shops
Can make default Tooltip repos itself when Box is not shown
Works now for Inventory Items​

Tags: Custom UI, Spell Info, Tooltip​
Previews
Contents

TasToolTipBox (Map)

Updated vjass to V3)
Improved Skill detection (can ignore ItemSkills in the command card detection)

Updated Lua to V4)
can detect peon built & Hero Learn sub menu, this does not work 100% in all cases
can manual set data for default, subMenu Built & Hero Learn
need to do it when you want to know stuff inside built or shops .
Manual data overpowers the ability detection.

uploaded map still includes Lua V3 because V4 differs quite from V3.

In the demo map only the 4 melee workers goblin shop and townhall have manual data.
goblin shop has colisions hence it will show wrong infos even when working.



not sure how to do the vjass V4 version with the data setup.

edit: Update both to V4a)
V4a AddBatch - Hero Learn assumes now fill card from top left, AddData Filters -coord abilities

vjass uses now an array and loops it to find the index of an unitcode in the system, but each dataset needs 12 slots. therefore the vjass version only supports upto 32k/12 unitcodes -> ~2.6k
 
Last edited:
Top