Schulliya Posted September 16, 2021 Share Posted September 16, 2021 Hi, I want to make my custom character not to gain armor. I think I can do this adding a component post init, but I'm not sure how... Link to comment https://forums.kleientertainment.com/forums/topic/133680-how-i-make-a-character-not-receieve-armor-bonus-when-armor-is-equipped/ Share on other sites More sharing options...
DecDuck Posted September 16, 2021 Share Posted September 16, 2021 In the Inventory:ApplyDamage function there's this: local absorbers = {} for k, v in pairs(self.equipslots) do if v.components.resistance ~= nil and v.components.resistance:HasResistance(attacker, weapon) and v.components.resistance:ShouldResistDamage() then v.components.resistance:ResistDamage(damage) return 0 elseif v.components.armor ~= nil then absorbers[v.components.armor] = v.components.armor:GetAbsorption(attacker, weapon) end end This is what you want to change. Either you have to override your character's inventory ApplyDamage function or create a custom inventory component which does the same. Link to comment https://forums.kleientertainment.com/forums/topic/133680-how-i-make-a-character-not-receieve-armor-bonus-when-armor-is-equipped/#findComment-1495217 Share on other sites More sharing options...
Schulliya Posted September 17, 2021 Author Share Posted September 17, 2021 On 9/16/2021 at 3:59 AM, decduck3 said: In the Inventory:ApplyDamage function there's this: local absorbers = {} for k, v in pairs(self.equipslots) do if v.components.resistance ~= nil and v.components.resistance:HasResistance(attacker, weapon) and v.components.resistance:ShouldResistDamage() then v.components.resistance:ResistDamage(damage) return 0 elseif v.components.armor ~= nil then absorbers[v.components.armor] = v.components.armor:GetAbsorption(attacker, weapon) end end This is what you want to change. Either you have to override your character's inventory ApplyDamage function or create a custom inventory component which does the same. why is this inside the inventory component? Link to comment https://forums.kleientertainment.com/forums/topic/133680-how-i-make-a-character-not-receieve-armor-bonus-when-armor-is-equipped/#findComment-1495896 Share on other sites More sharing options...
DecDuck Posted September 19, 2021 Share Posted September 19, 2021 It uses all the equipped items to calculate the damage reduction percent, so it (kind of) makes sense for it to be in inventory Link to comment https://forums.kleientertainment.com/forums/topic/133680-how-i-make-a-character-not-receieve-armor-bonus-when-armor-is-equipped/#findComment-1496386 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now