Gold filter / Updating gold on panorama UI

edited July 2015 in Questions

I managed to get gold from my custom bounties/selling builldings to show up on my Panorama UI - then I realised I wasn't reflecting ability costs (that cost gold) as a negative in my UI; as I'm using buildinghelper the onabilityused table doesnt have the actual build a tower ability therefore you can't get the ability cost there, then I started thinking this is going to get silly if I ever add a shop for new abilities/items!

BMD on irc suggested I try the gold filter, I looked it up and there is a single paragraph not really explaining anything on the valve wiki! My hope is to watch all the gold changes and ship them off to panorama to use in the UI (without changing them)! Is this the only way to use (dynamic) panorama UI gold counter(s)?

So I couldn't find much info on the gold filter specifically so I checked some orderfilter's and came up with this:

http://hastebin.com/cabigobome.lua

The first line is right after my 'normal' events in the init section, the second is a function in the same script; I initially tried the second function in another file where it wasn't working either (after including that file in the main script)!

Should I be seeing any output during gold loss/gain or did I do something wrong?

Comments

  • edited July 2015 Posts: 1,670

    In game/dota_addons/tutorial_assist_game/scripts/vscripts:

    GameRules:GetGameModeEntity():SetModifyGoldFilter(Dynamic_Wrap(CTutorialAG,"FilterModifyGold"),self)
    
    function CTutorialAG:FilterModifyGold( filterTable )
    --  for k, v in pairs( filterTable ) do
    --      print("MG: " .. k .. " " .. tostring(v) )
    --  end
    
        -- give a bonus if the player isn't doing well
        if ( filterTable["player_id_const"] == 0 ) then
            print("modifying player gold, Difficulty " .. tostring( self._nCurrentPlayerDifficulty ) )
            if ( self._nCurrentPlayerDifficulty == 0 ) then
                filterTable["gold"] = 1.75*filterTable["gold"]
            elseif ( self._nCurrentPlayerDifficulty == 1 ) then
                filterTable["gold"] = 1.5*filterTable["gold"]
            elseif ( self._nCurrentPlayerDifficulty == 2 ) then
                filterTable["gold"] = 1.25*filterTable["gold"]
            end
        end
    
        return true
    end
    

    You don't seem to have done anything wrong in your lua, but try this valve example

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited July 2015 Posts: 11

    Can't see the modify working even with filterTable["gold"] = 1.5*filterTable["gold"] on without any conditions; I did notice once I turned these two on back to on check:

    //GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_INVENTORY_PANEL, false );      
            //GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_INVENTORY_GOLD, false );   
    

    The gold on my goldscoreboard started getting set to the same value... seems I just need to update the scoreboard on think or something?