ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Fri Mar 22, 2019 10:32 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Jan 01, 2019 5:41 pm 
Offline
Thalore

Joined: Mon Mar 25, 2013 9:39 am
Posts: 172
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) ?


Last edited by Jurriaan on Wed Jan 02, 2019 5:47 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Jan 02, 2019 12:12 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5819
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.


Top
 Profile  
 
PostPosted: Wed Jan 02, 2019 6:03 am 
Offline
Thalore

Joined: Mon Mar 25, 2013 9:39 am
Posts: 172
Yes, if I remove it it returns on a new character.


Top
 Profile  
 
PostPosted: Wed Jan 02, 2019 8:11 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5819
Interesting. I'll have to look into it another time though.

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


Top
 Profile  
 
PostPosted: Thu Jan 03, 2019 8:59 pm 
Offline
Thalore

Joined: Mon Mar 25, 2013 9:39 am
Posts: 172
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.


Top
 Profile  
 
PostPosted: Fri Jan 04, 2019 12:10 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5819
Interesting.

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group