how do i increase armour?

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

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

how do i increase armour?

#1 Post by Jurriaan »

I have this talent coded:

Code: Select all

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!

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

Re: how do i increase armour?

#2 Post by Jurriaan »

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.

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

Re: how do i increase armour?

#3 Post by HousePet »

A better way to do it is:

Code: Select all

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.

Post Reply