ToME: the Tales of Maj'Eyal
http://forums.te4.org/

What determines if a talent gets an icon in the hotkey bar?
http://forums.te4.org/viewtopic.php?f=36&t=49362
Page 1 of 1

Author:  Jurriaan [ Tue Jan 01, 2019 5:41 pm ]
Post subject:  What determines if a talent gets an icon in the hotkey bar?

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:
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:
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) ?

Author:  HousePet [ Wed Jan 02, 2019 12:12 am ]
Post subject:  Re: What determines if a talent gets an icon in the hotkey b

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.

Author:  Jurriaan [ Wed Jan 02, 2019 6:03 am ]
Post subject:  Re: What determines if a talent gets an icon in the hotkey b

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

Author:  HousePet [ Wed Jan 02, 2019 8:11 am ]
Post subject:  Re: What determines if a talent gets an icon in the hotkey b

Interesting. I'll have to look into it another time though.

Author:  Jurriaan [ Thu Jan 03, 2019 8:59 pm ]
Post subject:  Re: What determines if a talent gets an icon in the hotkey b

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

Code:
mode = "passive",


but used

Code:
mode = passive,


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

Author:  HousePet [ Fri Jan 04, 2019 12:10 am ]
Post subject:  Re: What determines if a talent gets an icon in the hotkey b

Interesting.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/