ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Mon Jan 22, 2018 6:23 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Dec 10, 2017 8:54 pm 
Offline
Thalore

Joined: Mon Mar 25, 2013 9:39 am
Posts: 159
I have this talent coded:

Code:
newTalent{
        shortname = 'MOUNTAINTROLLSKIN',
        name = "Mountain Troll Skin",
        type = {"race/mountaintroll", 3},
        require = racial_req3,
        mode = "passive",
        points = 5,
        no_energy = true,
        getArmour = function(self, t) return self:getTalentLevelRaw(t) * 12 end,
        tactical = { DEFEND = 2 },
        action = function(self, t)
                self:addTemporaryValue("combat_armour", t.getArmour(self, t))
                self:addTemporaryValue("combat_armour_hardiness", t.getArmour(self, t))
                return true
        end,

        on_learn = function(self, t)
                if self:getTalentLevelRaw(t) >= 5 then
                        self.size_category = self.size_category + 2
                else
                         if self:getTalentLevelRaw(t) >= 3 then
                                self.size_category = self.size_category + 1
                        end
                end
        end,
        on_unlearn = function(self, t)
                if self:getTalentLevelRaw(t) == 4 then
                        self.size_category = self.size_category - 1
                end
                if self:getTalentLevelRaw(t) == 2 then
                        self.size_category = self.size_category - 1
                end
        end,

        info = function(self, t)
                local armour = t.getArmour(self, t);
                return ([[Mountain Troll-skin is extremely hard and resistant to physical effects (+%d%% armour and %d%% armour hardiness). On talent level 3 and 5, your size will increase by 1.]]):format(armour, armour)
        end,
}


but, armour value does not increase on investing points. I experimented with 'passives =' instead of 'action =' and saw no difference. I experimented with 'self:talentTemporaryValue(p, "combat_armour", t.getArmour(self, t))' but also saw nothing happening.

It must be something simple? Any hints?

Thanks!


Top
 Profile  
 
PostPosted: Mon Dec 11, 2017 9:35 pm 
Offline
Thalore

Joined: Mon Mar 25, 2013 9:39 am
Posts: 159
It turns out increasing armour has yet another mechanism:

on_learn
self.combat_armor = self.combat_armor + 12
self.combat_armor_hardiness = self.combat_armor_hardiness + 12

on_unlearn
self.combat_armor = self.combat_armor + 12
self.combat_armor_hardiness = self.combat_armor_hardiness + 12

seems to work.


Top
 Profile  
 
PostPosted: Wed Dec 13, 2017 11:34 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5553
A better way to do it is:
Code:
passives = function(self, t, p)
self:talentTemporaryValue(p, "combat_armor_hardiness", self:getTalentLevel(t) * 12)      
self:talentTemporaryValue(p, "combat_armor", self:getTalentLevel(t) * 12)
end,

_________________
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  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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