What determines if a talent gets an icon in the hotkey bar?

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Jurriaan
Wyrmic
Posts: 227
Joined: Mon Mar 25, 2013 9:39 am

What determines if a talent gets an icon in the hotkey bar?

#1 Post by Jurriaan »

I have a passive talent in my addon, that annoys by getting an icon in the hotkey bar that you can click on - which makes nothing happen.

I don't want that icon.

My example is the dwarven birth talent 'Power Is Money'. It gets no icon, of course,it just works in the background.

Code: Select all

newTalent{
        name = "Power is Money",
        type = {"race/dwarf", 3},
        require = racial_req3,
        points = 5,
        mode = "passive",
        getMaxSaves = function(self, t) return self:combatTalentScale(t, 8, 50) end,
        getGold = function(self, t) return self:combatTalentLimit(t, 40, 85, 65) end, -- Limit > 40
        -- called by _M:combatPhysicalResist, _M:combatSpellResist, _M:combatMentalResist in mod.class.interface.Combat.lua
        getSaves = function(self, t)
                return util.bound(self.money / t.getGold(self, t), 0, t.getMaxSaves(self, t))
        end,
        info = function(self, t)
                return ([[Money is the heart of the Dwarven Empire; it rules over all other considerations.
                Increases Physical, Mental and Spell Saves based on the amount of gold you possess.
                +1 save every %d gold, up to +%d. (currently +%d)]]):
                format(t.getGold(self, t), t.getMaxSaves(self, t), t.getSaves(self, t))
        end,
}
My talent:

Code: Select all

newTalent{
        -- shortname gives icon name
        name = "Smash Down", short_name = 'MT_SMASH_DOWN',
        type = {"race/mountaintroll", 1},
        mode = "passive",
        -- at level 5, prevent increase when wearing body / feet armour
        -- need to check if armour or feet has .size_category > 1, because those are allowed...

        require = { special={desc="After level 4, you can only study further when not wearing armour on your body and your feet", fct=function(self) return ((self.getTalentLevel(t) <= 4) or (self.GetTalentLevel(t) > 4 and not self:getInven("BODY") and not self:getInven("FEET"))) end}, stat = { str = function(level) return 12 + (level-1) * 5 end }, level = function(level) return 0 + (level-1) end },
        points = 10,
        -- start at 6, lvl 5 at 20 and lvl 10 at 43
        statBonus = function(self, t) return (3 + 3 * self:getTalentLevelRaw(t) + (self:getTalentLevelRaw(t) * self:getTalentLevelRaw(t)) / 10) end,
        passives = function(self, t, p)
                self:talentTemporaryValue(p, "inc_stats", {[self.STAT_STR]=t.statBonus(self, t)})
                self:talentTemporaryValue(p, "inc_stats", {[self.STAT_CON]=t.statBonus(self, t)})
        end,
        no_unlearn_last = true,
        on_learn = function(self, t)
                self:learnTalent(self.T_DUAL_WEAPON_MASTERY, true, 1, {no_unlearn=true})
                if self:getTalentLevel(t) >= 5 then self:attr("allow_mainhand_2h_in_1h", 1) end

                -- copied from Armour Training
                for inven_id, inven in pairs(self.inven) do
                        if inven.worn then
                                for i = #inven, 1, -1 do
                                        local o = inven[i]

                                        if (o.slot == "BODY") or (o.slot == "FEET") then
                                                local o = inven[i]
                                                game.logPlayer(self, "Your muscles have grown too big for your %s.", o:getName{do_color=true})
                                                local o = self:removeObject(inven, i, true)
                                                self:addObject(self.INVEN_INVEN, o)
                                                self:sortInven()
                                        end
                                end
                        end
                end
        end,

        info = function(self, t)
                return ([[You have trained long and hard with the masters to gain the strength (%d) and constition (%d) Mountain Trolls are known for. At talent level 5, you have grown enough to wield a 2 handed weapon in your main hand with a single-handed weapon in your other hand, but no armour on your body or feet will fit you anymore. At level 10, you can wield 2 handed weapons in each hand.]]):
                format(t.statBonus(self, t), t.statBonus(self, t))
        end,
}
How to I remove this icon from the hotkey area (without wiping it from the level upgrade dialog, which happens when I remove the png file, for example) ?
Last edited by Jurriaan on Wed Jan 02, 2019 5:47 am, edited 1 time in total.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: What determines if a talent gets an icon in the hotkey b

#2 Post by HousePet »

Hrm… What happens if you remove it from the hotbar and then make a new character?
Does it still assign it to the hot bar? I'm wondering if its just discovered that it was already set on there and is defaulting to a previous layout.
Also, post code with the Code wrapper, not the Quote one.
My feedback meter decays into coding. Give me feedback and I make mods.

Jurriaan
Wyrmic
Posts: 227
Joined: Mon Mar 25, 2013 9:39 am

Re: What determines if a talent gets an icon in the hotkey b

#3 Post by Jurriaan »

Yes, if I remove it it returns on a new character.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: What determines if a talent gets an icon in the hotkey b

#4 Post by HousePet »

Interesting. I'll have to look into it another time though.
My feedback meter decays into coding. Give me feedback and I make mods.

Jurriaan
Wyrmic
Posts: 227
Joined: Mon Mar 25, 2013 9:39 am

Re: What determines if a talent gets an icon in the hotkey b

#5 Post by Jurriaan »

Solved. I started with a fresh .t-engine directory and double checked my extension, and it turns out I wrote

Code: Select all

mode = "passive", 
but used

Code: Select all

mode = passive, 
which doesn't throw an error, and works as expected except for the icon in the toolbar.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: What determines if a talent gets an icon in the hotkey b

#6 Post by HousePet »

Interesting.
My feedback meter decays into coding. Give me feedback and I make mods.

Post Reply